View Single Post
Old 20th April 2019, 21:42   #44  |  Link
sunshine
Registered User
 
Join Date: Apr 2019
Posts: 17
OK here's the full version of my workflow. Perhaps it'll help someone one day.

Source: MiniDV (Digital8 and Hi8)

Connect camcorder via FireWire and import video using WinDV. Save the clips somewhere with a lot of space..

Code:
#!/usr/bin/bash

# I include my VapourSynth script right inside my script that automates all of this.. it keeps things in one place.
################
read -r -d '' VAPOURSYNTH <<'VSScript'
#!/usr/bin/env python

# import the needed modules
import vapoursynth as vs
import havsfunc as haf
import edi_rpow2 as edi

core = vs.get_core()

clip = core.ffms2.Source(source=INVID)
clip = core.resize.Bicubic(clip, format=vs.YUV422P8, matrix_in_s="170m", matrix_s="709")
clip = haf.QTGMC(clip, Preset="Slower", TFF=False)

clip.set_output()

VSScript
##############

# This outputs the python VapourSynth script to "Deinterlace.py"
echo "$VAPOURSYNTH" > ./Deinterlace.py


# List all your clips here, full paths, one per line
ALLVIDS="/clips/clip1.avi
/clips/clip2.avi
/clips/clip3.avi"

# I took this approach vs. a "find /clips -name \*.avi | while read INVID; do" approach because ffmpeg seems to mess with STDIN/ OUT and makes looping that way painful.. This avoids that pain.

for INVID in $ALLVIDS; do
        echo "--------------------------------------"
        OUTVID=$(echo "$INVID" | sed -e 's/\.avi/\.mov/')
        #OUTVID=$(echo "$OUTVID" | sed -e 's/\.mov/\.10-11\.mov/')
        #OUTVID=$(echo "$OUTVID" | sed -e 's/\.mov/\.8-9\.4-3\.mov/')
        if [ -e "$OUTVID" ]; then
                if [ -e "$OUTVID.complete" ]; then
                        echo "Found existing complete version of this video; skipping"
                        echo "--------------------------------------"
                        continue
                else
                        rm "$OUTVID"
                fi
        fi


        mediainfo "$INVID" | grep -qi "16:9"
        if [ $? -eq 0 ]; then
                # some of my videos are wide-angle SD DV.. I'll deal with them later.
                echo "This video is in 16:9 - skipping it and do it by hand later"
                echo "--------------------------------------"
                continue
        fi


        echo "Processing Input $INVID and outputting to $OUTVID"
        vspipe --y4m ./Deinterlace.py -a "INVID=$INVID" - | ffmpeg -nostdin -i pipe: -i "$INVID" -pix_fmt yuv422p -c:v libx264  -crf 0 -tune fastdecode -x264opts keyint=1 -c:a copy -map 0:0 -map 1:1 -vf setsar=sar=10/11 "$OUTVID" 2>&1
  
        if [ $? -eq 0 ]; then
                echo "Successfully converted $INVID"
                (
                        echo "Vapoursynth Script:"
                        echo "$VAPOURSYNTH"
                        echo
                        echo "ffmpeg:"
                        echo "vspipe --y4m ./Deinterlace.py -a \"INVID=$INVID\" - | ffmpeg -nostdin -i pipe: -i \"$INVID\" -pix_fmt yuv422p -c:v libx264  -crf 0 -tune fastdecode -x264opts keyint=1 -c:a copy -map 0:0 -map 1:1 -vf setsar=sar=10/11 \"$OUTVID\""
                ) > "$OUTVID.complete"

        fi
        echo "--------------------------------------"
done | tee process.$(date +%Y%m%d%H%M%S).log
sunshine is offline   Reply With Quote