#!/bin/sh # # Given a base.mpg file, generate a time-base.avi file scaled down to a # small size with video timestamp added to the bottom right of the image. # While doing this conversion, also convert the audio to mp3 so # we can extract it later. # # The video timestamp helps when manually fixing a .keep file and the audio # is sometimes helpful to catch commercials as well as the video. # mydir=`dirname $0` PATH=`$mydir/echo-path` export PATH # dt="fontsize=18" dt="$dt:fontfile=/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf" dt="$dt:box=1" dt="$dt:text="'%{pts}' dt="$dt:x=(w-text_w-5)" dt="$dt:y=(h-text_h-5)" # sc="320:-1" # vid="-c:v libx264 -preset ultrafast -threads 8 -crf 28" # aud="-acodec libmp3lame -ab 128k -ac 2" # infile="$1" if [ -f "$infile" ] then basefile=`basename $infile .mpg` ffmpeg -i "$infile" -nostats -vf "scale=$sc,drawtext=$dt" \ $vid $aud "time-$basefile.avi" < /dev/null else echo "Input file $infile does not exist." 1>&2 exit 2 fi