Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find all mpeg2 MKV files in my archive on my NAS, copy to local disk, transcode to h264.
for i in *.mkv; do
ffprobe -loglevel quiet -show_format -show_streams -select_streams v -print_format flat=h=0 "$i" | egrep 'codec_name="mpeg2video"|filename' | cut -d '"' -f 2 | tr '\n' '|'
echo
done | grep mpeg2video | cut -d '|' -f 2 > ~/mpeg2movies.txt
rsync -Pav --size-only --files-from=:/home/davidb/mpeg2movies.txt udun:/data/movies /Volumes/element/incoming
#!/bin/zsh
IN=/Volumes/element/incoming
OUT=/Volumes/element/done
for i in $IN/*.mkv; do
oname="$OUT/`basename $i`"
echo "Processing to $oname"
if [[ ! -f $oname ]]; then
ffmpeg -i "$i" -map 0 -c:v libx264 -preset slow -crf 18 -c:a copy -c:s copy "$oname"
fi
#rm "$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment