Sun, 19 Jan 2014 20:45:00 +0100
Rename text to speech script files for consistency with existing tts.
michael@0 | 1 | #! /bin/sh |
michael@0 | 2 | |
michael@0 | 3 | # Set variables |
michael@0 | 4 | INFILE=$1 |
michael@0 | 5 | INAUDI=$2 |
michael@0 | 6 | INPREV=$3 |
michael@0 | 7 | INPOST=$4 |
michael@0 | 8 | INTITLE=$5 |
michael@0 | 9 | THREAD=4 |
michael@0 | 10 | |
michael@0 | 11 | # Following is not needed |
michael@0 | 12 | ## Get the number of frames for fading out |
michael@0 | 13 | #FRAMES=`ffmpeg -i $INFILE -an -codec:v copy -f null /dev/null 2>&1 | grep 'frame=' | cut -f 2 -d ' '` |
michael@0 | 14 | |
michael@0 | 15 | # Start log |
michael@0 | 16 | #script procfilm-`date +%Y%m%d:%H:%M:%S`.log |
michael@0 | 17 | echo "Redirecting command line out to log file `date +%Y%m%d:..._`.log" |
michael@0 | 18 | exec > procfilm-`date +%Y%m%d:%H:%M:%S`.log 2>&1 |
michael@0 | 19 | |
michael@0 | 20 | # Usage |
michael@0 | 21 | echo 'This program will produce six output files, one of each format:' |
michael@0 | 22 | echo ' 720p and 360p, WEBM (VP8+VORBIS in WEBM)' |
michael@0 | 23 | echo ' 720p and 360p, XIPH (THEORA+VORBIS in OGV)' |
michael@0 | 24 | echo ' 720p and 360p, MPEG (H.264+AAC in MP4)' |
michael@0 | 25 | echo '' |
michael@0 | 26 | echo "Usage: $0 <Srcfile> <Srcaudio> <Prevfile> <Postfile> '<Titel>'" |
michael@0 | 27 | echo "Example: $0 Myfilm.avi Myaudio.wav Myprev Mypost 'My best film'" |
michael@0 | 28 | echo 'Note: Myprev and Mypost must be PNG files (without file extension.)' |
michael@0 | 29 | echo 'Note: Titel can be only one word unless you wrap a phrase in quotes.' |
michael@0 | 30 | echo '' |
michael@0 | 31 | echo 'Warning: Check your preset paths like /usr/share/ffmpeg and $HOME/.ffmpeg' |
michael@0 | 32 | echo '' |
michael@0 | 33 | echo "Starting with log processing on `date +%Y%m%d\ %H:%M:%S`" |
michael@0 | 34 | echo '' |
michael@0 | 35 | |
michael@0 | 36 | # Create working subdirectories |
michael@0 | 37 | for format in webm xiph mpeg; do |
michael@0 | 38 | for resol in 360 720; do |
michael@0 | 39 | mkdir work$format-$resol; |
michael@0 | 40 | done; |
michael@0 | 41 | done |
michael@0 | 42 | |
michael@0 | 43 | # |
michael@0 | 44 | # START OF WEBM ENCODING |
michael@0 | 45 | # |
michael@0 | 46 | |
michael@0 | 47 | # 720p Webm (VP8/Vorbis) |
michael@0 | 48 | cd ./workwebm-720 || return 1 |
michael@0 | 49 | |
michael@0 | 50 | # 720p Prepare main film part |
michael@0 | 51 | time ffmpeg -v warning -threads $THREAD -i ../$INFILE -an -codec:v libvpx -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -pass 1 -f null /dev/null 2>&1 |
michael@0 | 52 | echo 'Finished first pass main film part encoding...' |
michael@0 | 53 | echo '' |
michael@0 | 54 | # For only watermark (no delogo nor fade) do this: |
michael@0 | 55 | # -vf 'movie=../procomwater.png [watermark]; [in][watermark] overlay=24:608 [out]' |
michael@0 | 56 | time ffmpeg -v warning -threads $THREAD -i ../$INFILE -an -codec:v libvpx -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -f webm -pass 2 $INFILE-vidnur720p.webm |
michael@0 | 57 | echo 'Finished second pass main film part encoding...' |
michael@0 | 58 | echo '' |
michael@0 | 59 | |
michael@0 | 60 | # 720p Generate front and back matter |
michael@0 | 61 | # WARNING: -loop, -t, -r, -vf, -f, or something else causing sync problems! |
michael@0 | 62 | ffmpeg -v warning -loop 1 -i ../$INPREV.png -c:v libvpx -t 12.45 -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -vf 'fade=t=in:st=0:d=1.5:alpha=0, fade=t=out:st=11.5:d=0.5:alpha=0' -f webm $INPREV-720p.webm |
michael@0 | 63 | echo 'Finished generation of front matter...' |
michael@0 | 64 | echo '' |
michael@0 | 65 | ffmpeg -v warning -loop 1 -i ../$INPOST.png -c:v libvpx -t 15 -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -vf 'fade=t=in:st=0:d=1:alpha=0' -f webm $INPOST-720p.webm |
michael@0 | 66 | echo 'Finished generation of back matter...' |
michael@0 | 67 | echo '' |
michael@0 | 68 | |
michael@0 | 69 | # 720p Concatanate film parts |
michael@0 | 70 | mkvmerge --title "$INTITLE" --default-language en -w -o $INFILE-vidcat720p.webm $INPREV-720p.webm + $INFILE-vidnur720p.webm + $INPOST-720p.webm |
michael@0 | 71 | echo 'Finished concatanating front, main, and back part files...' |
michael@0 | 72 | echo '' |
michael@0 | 73 | |
michael@0 | 74 | # 720p Join video and audio in film |
michael@0 | 75 | ffmpeg -v warning -i $INFILE-vidcat720p.webm -i ../$INAUDI -map 0 -map 1 -strict -2 -codec:a vorbis -aq 20 -ac 2 -codec:v copy -pix_fmt yuv420p -f webm output-720p.webm |
michael@0 | 76 | echo "Finished joining video with audio to produce $INFILE-720p.webm" |
michael@0 | 77 | echo '' |
michael@0 | 78 | echo '' |
michael@0 | 79 | |
michael@0 | 80 | # 360p Webm (VP8/Vorbis) |
michael@0 | 81 | cd ../workwebm-360 || return 1 |
michael@0 | 82 | |
michael@0 | 83 | # 360p Prepare main film part |
michael@0 | 84 | time ffmpeg -v warning -threads $THREAD -i ../$INFILE -an -codec:v libvpx -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -pass 1 -f null /dev/null 2>&1 |
michael@0 | 85 | echo 'Finished first pass main film part encoding...' |
michael@0 | 86 | echo '' |
michael@0 | 87 | time ffmpeg -v warning -threads $THREAD -i ../$INFILE -an -codec:v libvpx -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -f webm -pass 2 $INFILE-vidnur360p.webm |
michael@0 | 88 | echo 'Finished second pass main film part encoding...' |
michael@0 | 89 | echo '' |
michael@0 | 90 | |
michael@0 | 91 | # 360p Generate front and back matter |
michael@0 | 92 | # WARNING: -loop, -t, -r, -vf, -f, or something else causing sync problems! |
michael@0 | 93 | ffmpeg -v warning -loop 1 -i ../$INPREV.png -c:v libvpx -t 12.45 -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -vf 'fade=t=in:st=0:d=1.5:alpha=0, fade=t=out:st=11.5:d=0.5:alpha=0' -f webm $INPREV-360p.webm |
michael@0 | 94 | echo 'Finished generation of front matter...' |
michael@0 | 95 | echo '' |
michael@0 | 96 | ffmpeg -v warning -loop 1 -i ../$INPOST.png -c:v libvpx -t 15 -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -vf 'fade=t=in:st=0:d=1:alpha=0' -f webm $INPOST-360p.webm |
michael@0 | 97 | echo 'Finished generation of back matter...' |
michael@0 | 98 | echo '' |
michael@0 | 99 | |
michael@0 | 100 | # 360p Concatanate film parts |
michael@0 | 101 | mkvmerge --title "$INTITLE" --default-language en -w -o $INFILE-vidcat360p.webm $INPREV-360p.webm + $INFILE-vidnur360p.webm + $INPOST-360p.webm |
michael@0 | 102 | echo 'Finished concatanating front, main, and back part files...' |
michael@0 | 103 | echo '' |
michael@0 | 104 | |
michael@0 | 105 | # 360p Join video and audio in film |
michael@0 | 106 | ffmpeg -v warning -i $INFILE-vidcat360p.webm -i ../$INAUDI -map 0 -map 1 -strict -2 -codec:a vorbis -aq 20 -ac 2 -codec:v copy -pix_fmt yuv420p -f webm output-360p.webm |
michael@0 | 107 | echo "Finished joining video with audio to produce $INFILE-360p.webm" |
michael@0 | 108 | echo '' |
michael@0 | 109 | echo '' |
michael@0 | 110 | |
michael@0 | 111 | # |
michael@0 | 112 | # START OF MPEG4 ENCODING |
michael@0 | 113 | # |
michael@0 | 114 | |
michael@0 | 115 | # 720p MPEG4 (H.264/MP4) |
michael@0 | 116 | cd ../workmpeg-720 || return 1 |
michael@0 | 117 | |
michael@0 | 118 | # 720p Prepare main film part |
michael@0 | 119 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libx264 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre fastfirstpass -pass 1 -f null /dev/null 2>&1 |
michael@0 | 120 | echo 'Finished first pass main film part encoding...' |
michael@0 | 121 | echo '' |
michael@0 | 122 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libx264 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre hq -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -bsf:v h264_mp4toannexb -f mpegts -pass 2 $INFILE-vidnur720p.ts |
michael@0 | 123 | echo 'Finished second pass main film part encoding...' |
michael@0 | 124 | echo '' |
michael@0 | 125 | |
michael@0 | 126 | # 720p Generate front and back matter |
michael@0 | 127 | # WARNING: -loop, -t, -r, -vf, -f, or something else causing sync problems! |
michael@0 | 128 | ffmpeg -v warning -loop 1 -i ../$INPREV.png -c:v libx264 -t 12.45 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1.5:alpha=0, fade=t=out:st=11.5:d=0.5:alpha=0' -f mpegts $INPREV-720p.ts |
michael@0 | 129 | echo 'Finished generation of front matter...' |
michael@0 | 130 | echo '' |
michael@0 | 131 | ffmpeg -v warning -loop 1 -i ../$INPOST.png -c:v libx264 -t 15 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1:alpha=0' -f mpegts $INPOST-720p.ts |
michael@0 | 132 | echo 'Finished generation of back matter...' |
michael@0 | 133 | echo '' |
michael@0 | 134 | |
michael@0 | 135 | # Now prepare for H.264 concatanation |
michael@0 | 136 | # http://trac.ffmpeg.org/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files |
michael@0 | 137 | |
michael@0 | 138 | ## Dont use this because it reencodes when copying is desired |
michael@0 | 139 | ##ffmpeg -v warning -i <filmpre.mp4> -i $INFILE -i <filmpost.mp4> -filter_complex '[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' fullfilm.mp4 |
michael@0 | 140 | |
michael@0 | 141 | # 720p Concatanate film parts |
michael@0 | 142 | # Actually dont need this if we encode H.264 to MPEGTS in previous encoding |
michael@0 | 143 | ##ffmpeg -v warning -i $INFILE.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate.ts |
michael@0 | 144 | ffmpeg -i "concat:$INPREV-720p.ts|$INFILE-vidnur720p.ts|$INPOST-720p.ts" -c copy -bsf:a aac_adtstoasc -f mp4 $INFILE-vidcat720p.mp4 |
michael@0 | 145 | echo 'Finished concatanating front, main, and back part files...' |
michael@0 | 146 | echo '' |
michael@0 | 147 | |
michael@0 | 148 | # 720p Join video and audio in film |
michael@0 | 149 | ffmpeg -v warning -i $INFILE-vidcat720p.mp4 -i ../$INAUDI -map 0 -map 1 -strict -2 -codec:a aac -b:a 128k -ac 2 -sample_fmt:1 fltp -codec:v copy -pix_fmt yuv420p -f mp4 output-720p.mp4 |
michael@0 | 150 | echo "Finished joining video with audio to produce $INFILE-720p.mp4" |
michael@0 | 151 | echo '' |
michael@0 | 152 | echo '' |
michael@0 | 153 | |
michael@0 | 154 | # 360p MPEG4 (H.264/MP4) |
michael@0 | 155 | cd ../workmpeg-360 || return 1 |
michael@0 | 156 | |
michael@0 | 157 | # 360p Prepare main film part |
michael@0 | 158 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libx264 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre fastfirstpass -pass 1 -f null /dev/null 2>&1 |
michael@0 | 159 | echo 'Finished first pass main film part encoding...' |
michael@0 | 160 | echo '' |
michael@0 | 161 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libx264 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre hq -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -bsf:v h264_mp4toannexb -f mpegts -pass 2 $INFILE-vidnur360p.ts |
michael@0 | 162 | echo 'Finished second pass main film part encoding...' |
michael@0 | 163 | echo '' |
michael@0 | 164 | |
michael@0 | 165 | # 360p Generate front and back matter |
michael@0 | 166 | # WARNING: -loop, -t, -r, -vf, -f, or something else causing sync problems! |
michael@0 | 167 | ffmpeg -v warning -loop 1 -i ../$INPREV.png -c:v libx264 -t 12.45 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1.5:alpha=0, fade=t=out:st=11.5:d=0.5:alpha=0' -f mpegts $INPREV-360p.ts |
michael@0 | 168 | echo 'Finished generation of front matter...' |
michael@0 | 169 | echo '' |
michael@0 | 170 | ffmpeg -v warning -loop 1 -i ../$INPOST.png -c:v libx264 -t 15 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1:alpha=0' -f mpegts $INPOST-360p.ts |
michael@0 | 171 | echo 'Finished generation of back matter...' |
michael@0 | 172 | echo '' |
michael@0 | 173 | |
michael@0 | 174 | # Now prepare for H.264 concatanation |
michael@0 | 175 | # http://trac.ffmpeg.org/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files |
michael@0 | 176 | |
michael@0 | 177 | ## Dont use this because it reencodes when copying is desired |
michael@0 | 178 | ##ffmpeg -v warning -i <filmpre.mp4> -i $INFILE -i <filmpost.mp4> -filter_complex '[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' fullfilm.mp4 |
michael@0 | 179 | |
michael@0 | 180 | # 360p Concatanate film parts |
michael@0 | 181 | # Actually dont need this if we encode H.264 to MPEGTS in previous encoding |
michael@0 | 182 | ##ffmpeg -v warning -i $INFILE.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate.ts |
michael@0 | 183 | ffmpeg -i "concat:$INPREV-360p.ts|$INFILE-vidnur360p.ts|$INPOST-360p.ts" -c copy -bsf:a aac_adtstoasc -f mp4 $INFILE-vidcat360p.mp4 |
michael@0 | 184 | echo 'Finished concatanating front, main, and back part files...' |
michael@0 | 185 | echo '' |
michael@0 | 186 | |
michael@0 | 187 | # 360p Join video and audio in film |
michael@0 | 188 | ffmpeg -v warning -i $INFILE-vidcat360p.mp4 -i ../$INAUDI -map 0 -map 1 -strict -2 -codec:a aac -b:a 128k -ac 2 -sample_fmt:1 fltp -codec:v copy -pix_fmt yuv420p -f mp4 output-360p.mp4 |
michael@0 | 189 | echo "Finished joining video with audio to produce $INFILE-360p.mp4" |
michael@0 | 190 | echo '' |
michael@0 | 191 | echo '' |
michael@0 | 192 | |
michael@0 | 193 | # |
michael@0 | 194 | # START OF XIPH ENCODING |
michael@0 | 195 | # |
michael@0 | 196 | |
michael@0 | 197 | # 720p OGV |
michael@0 | 198 | cd ../workxiph-720 || return 1 |
michael@0 | 199 | |
michael@0 | 200 | # 720p Prepare main film part |
michael@0 | 201 | #ffmpeg -i ../$INFILE -codec:v theora -qscale:v 7 -codec:a vorbis -qscale:a 5 output.ogv |
michael@0 | 202 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libtheora -b:v 2400k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -f null -pass 1 /dev/null 2>&1 |
michael@0 | 203 | echo 'Finished first pass main film part encoding...' |
michael@0 | 204 | echo '' |
michael@0 | 205 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libtheora -b:v 2400k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -f ogg -pass 2 $INFILE-vidnur720p.ogv |
michael@0 | 206 | echo 'Finished second pass main film part encoding...' |
michael@0 | 207 | echo '' |
michael@0 | 208 | |
michael@0 | 209 | # 720p Generate front and back matter |
michael@0 | 210 | # WARNING: -loop, -t, -r, -vf, -f, or something else causing sync problems! |
michael@0 | 211 | ffmpeg -v warning -loop 1 -i ../$INPREV.png -c:v libtheora -t 12.55 -b:v 2400k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1.5:alpha=0, fade=t=out:st=11.5:d=0.5:alpha=0' -f ogg $INPREV-720p.ogv |
michael@0 | 212 | echo 'Finished generation of front matter...' |
michael@0 | 213 | echo '' |
michael@0 | 214 | ffmpeg -v warning -loop 1 -i ../$INPOST.png -c:v libtheora -t 15 -b:v 2400k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1:alpha=0' -f ogg $INPOST-720p.ogv |
michael@0 | 215 | echo 'Finished generation of back matter...' |
michael@0 | 216 | echo '' |
michael@0 | 217 | |
michael@0 | 218 | # 720p Concatanate film parts |
michael@0 | 219 | #oggCat $INFILE-vidcat720p.ogv $INPREV-720p.ogv $INFILE-vidnur720p.ogv $INPOST-720p.ogv |
michael@0 | 220 | mkvmerge --title "$INTITLE" --default-language en -o $INFILE-vidcat720p.mkv $INPREV-720p.ogv + $INFILE-vidnur720p.ogv + $INPOST-720p.ogv |
michael@0 | 221 | echo 'Finished concatanating front, main, and back part files...' |
michael@0 | 222 | echo '' |
michael@0 | 223 | |
michael@0 | 224 | # 720p Join video and audio in film |
michael@0 | 225 | ffmpeg -v warning -i $INFILE-vidcat720p.mkv -i ../$INAUDI -map 0 -map 1 -strict -2 -codec:a vorbis -qscale:a 6 -ac 2 -codec:v copy -pix_fmt yuv420p -f ogg output-720p.ogv |
michael@0 | 226 | echo "Finished joining video with audio to produce $INFILE-720p.ogv" |
michael@0 | 227 | echo '' |
michael@0 | 228 | echo '' |
michael@0 | 229 | |
michael@0 | 230 | # 360p OGV |
michael@0 | 231 | cd ../workxiph-360 || return 1 |
michael@0 | 232 | |
michael@0 | 233 | # 360p Prepare main film part |
michael@0 | 234 | #ffmpeg -i ../$INFILE -codec:v theora -qscale:v 7 -codec:a vorbis -qscale:a 5 output.ogv |
michael@0 | 235 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libtheora -b:v 1024k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -f null -pass 1 /dev/null 2>&1 |
michael@0 | 236 | echo 'Finished first pass main film part encoding...' |
michael@0 | 237 | echo '' |
michael@0 | 238 | time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libtheora -b:v 1024k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -f ogg -pass 2 $INFILE-vidnur360p.ogv |
michael@0 | 239 | echo 'Finished second pass main film part encoding...' |
michael@0 | 240 | echo '' |
michael@0 | 241 | |
michael@0 | 242 | # 360p Generate front and back matter |
michael@0 | 243 | # WARNING: -loop, -t, -r, -vf, -f, or something else causing sync problems! |
michael@0 | 244 | ffmpeg -v warning -loop 1 -i ../$INPREV.png -c:v libtheora -t 12.50 -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1.5:alpha=0, fade=t=out:st=11.5:d=0.5:alpha=0' -f ogg $INPREV-360p.ogv |
michael@0 | 245 | echo 'Finished generation of front matter...' |
michael@0 | 246 | echo '' |
michael@0 | 247 | ffmpeg -v warning -loop 1 -i ../$INPOST.png -c:v libtheora -t 15 -b:v 1024k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1:alpha=0' -f ogg $INPOST-360p.ogv |
michael@0 | 248 | echo 'Finished generation of back matter...' |
michael@0 | 249 | echo '' |
michael@0 | 250 | |
michael@0 | 251 | # 360p Concatanate film parts |
michael@0 | 252 | #oggCat $INFILE-vidcat360p.ogv $INPREV-360p.ogv $INFILE-vidnur360p.ogv $INPOST-360p.ogv |
michael@0 | 253 | mkvmerge --title "$INTITLE" --default-language en -o $INFILE-vidcat360p.mkv $INPREV-360p.ogv + $INFILE-vidnur360p.ogv + $INPOST-360p.ogv |
michael@0 | 254 | echo 'Finished concatanating front, main, and back part files...' |
michael@0 | 255 | echo '' |
michael@0 | 256 | |
michael@0 | 257 | # 360p Join video and audio in film |
michael@0 | 258 | ffmpeg -v warning -i $INFILE-vidcat360p.mkv -i ../$INAUDI -map 0 -map 1 -strict -2 -codec:a vorbis -qscale:a 5 -ac 2 -codec:v copy -pix_fmt yuv420p -f ogg output-360p.ogv |
michael@0 | 259 | echo "Finished joining video with audio to produce $INFILE-360p.ogv" |
michael@0 | 260 | echo '' |
michael@0 | 261 | echo '' |
michael@0 | 262 | |
michael@0 | 263 | # |
michael@0 | 264 | # Closing |
michael@0 | 265 | # |
michael@0 | 266 | cd .. |
michael@0 | 267 | echo 'Processed files: work*-*/output-*.*' |
michael@0 | 268 | ls -ld work*-*/output-*.* |
michael@0 | 269 | echo '' |
michael@0 | 270 | echo 'Tip: If using HTML5 video, then consider:' |
michael@0 | 271 | echo " <video poster='poster.png' width=640 height=360 preload='metadata' controls>" |
michael@0 | 272 | echo '' |
michael@0 | 273 | |
michael@0 | 274 | # |
michael@0 | 275 | # Scratch block (unused logic) |
michael@0 | 276 | # |
michael@0 | 277 | |
michael@0 | 278 | # 480p H.264/AAC in MP4 |
michael@0 | 279 | #time ffmpeg -v warning -threads 0 -i ../$INFILE -an -codec:v libx264 -b:v 1000k -r 25 -s 854x480 -aspect 16:9 -pix_fmt yuv420p -vpre fastfirstpass -pass 1 -f null /dev/null 2>&1 |
michael@0 | 280 | #time ffmpeg -v warning -threads 0 -i ../$INFILE -codec:a aac -b:a 128k -ac 2 -sample_fmt:1 fltp -codec:v libx264 -b:v 1000k -r 25 -s 854x480 -aspect 16:9 -pix_fmt yuv420p -vpre hq -vf '[in] delogo=x=38:y=616:w=254:h=68:band=4:t=4:show=0 [delogo]; movie=../procomwater.png [watermark]; [delogo][watermark] overlay=24:608, fade=t=in:st=0:d=1:alpha=0, fade=t=out:st=298:d=2:alpha=0 [out]' -f mp4 -pass 2 $INFILE-480p.mp4 |
michael@0 | 281 | |
michael@0 | 282 | # 720p WEBM |
michael@0 | 283 | #$ time ffmpeg -v warning -threads 4 -i ../procomplota.ts -an -codec:v libvpx -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -pass 1 -f null /dev/null 2>&1 |
michael@0 | 284 | #$ time ffmpeg -v warning -threads 4 -i ../procomplota.ts -an -codec:v libvpx -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -vf 'movie=../procomwater.png [watermark]; [in][watermark] overlay=24:608 [out]' -f webm -pass 2 procomplota-vidnur720p.webm |
michael@0 | 285 | #$ ffmpeg -v warning -loop 1 -i ../procomnach.png -c:v libvpx -t 15 -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre 720p -vf 'fade=t=in:st=0:d=1:alpha=0' -f webm procomnach-720p.webm |
michael@0 | 286 | #$ mkvmerge --title "Procom Quick Overview" --default-language en -w -o procomplota-vidcat720p.webm procomplota-vidnur720p.webm + procomnach-720p.webm |
michael@0 | 287 | #$ ffmpeg -v warning -i procomplota-vidcat720p.webm -i ../procomplota.wav -map 0 -map 1 -strict -2 -codec:a vorbis -aq 20 -ac 2 -codec:v copy -pix_fmt yuv420p -f webm output-720p.webm |
michael@0 | 288 | |
michael@0 | 289 | # 360p WEBM |
michael@0 | 290 | #$ time ffmpeg -v warning -threads 4 -i ../procomplota.ts -an -codec:v libvpx -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -pass 1 -f null /dev/null 2>&1 && time ffmpeg -v warning -threads 4 -i ../procomplota.ts -an -codec:v libvpx -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -vf 'movie=../procomwater.png [watermark]; [in][watermark] overlay=24:608 [out]' -f webm -pass 2 procomplota-vidnur360p.webm && ffmpeg -v warning -loop 1 -i ../procomnach.png -c:v libvpx -t 15 -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre 360p -vf 'fade=t=in:st=0:d=1:alpha=0' -f webm procomnach-360p.webm && mkvmerge --title "Procom Quick Overview" --default-language en -w -o procomplota-vidcat360p.webm procomplota-vidnur360p.webm + procomnach-360p.webm && ffmpeg -v warning -i procomplota-vidcat360p.webm -i ../procomplota.wav -map 0 -map 1 -strict -2 -codec:a vorbis -aq 20 -ac 2 -codec:v copy -pix_fmt yuv420p -f webm output-360p.webm |
michael@0 | 291 | |
michael@0 | 292 | # 720p MPEG |
michael@0 | 293 | #$ time ffmpeg -v warning -threads 0 -i ../procomplota.ts -an -codec:v libx264 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre fastfirstpass -pass 1 -f null /dev/null 2>&1 && time ffmpeg -v warning -threads 0 -i ../procomplota.ts -an -codec:v libx264 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vpre hq -vf 'movie=../procomwater.png [watermark]; [in][watermark] overlay=24:608 [out]' -bsf:v h264_mp4toannexb -f mpegts -pass 2 procomplota.ts-vidnur720p.ts && ffmpeg -v warning -loop 1 -i ../procomnach.png -c:v libx264 -t 15 -b:v 2048k -r 25 -s 1280x720 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1:alpha=0' -f mpegts procomnach-720p.ts && ffmpeg -i "concat:procomplota.ts-vidnur720p.ts|procomnach-720p.ts" -c copy -bsf:a aac_adtstoasc -f mp4 procomplota.ts-vidcat720p.mp4 && ffmpeg -v warning -i procomplota.ts-vidcat720p.mp4 -i ../procomplota.wav -map 0 -map 1 -strict -2 -codec:a aac -b:a 128k -ac 2 -sample_fmt:1 fltp -codec:v copy -pix_fmt yuv420p -f mp4 output-720p.mp4 |
michael@0 | 294 | |
michael@0 | 295 | # 360p MPEG |
michael@0 | 296 | #$ time ffmpeg -v warning -threads 0 -i ../procomplota.ts -an -codec:v libx264 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre fastfirstpass -pass 1 -f null /dev/null 2>&1 && time ffmpeg -v warning -threads 0 -i ../procomplota.ts -an -codec:v libx264 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vpre hq -vf 'movie=../procomwater.png [watermark]; [in][watermark] overlay=24:608 [out]' -bsf:v h264_mp4toannexb -f mpegts -pass 2 procomplota.ts-vidnur360p.ts && ffmpeg -v warning -loop 1 -i ../procomnach.png -c:v libx264 -t 15 -b:v 768k -r 25 -s 640x360 -aspect 16:9 -pix_fmt yuv420p -vf 'fade=t=in:st=0:d=1:alpha=0' -f mpegts procomnach-360p.ts && ffmpeg -i "concat:procomplota.ts-vidnur360p.ts|procomnach-360p.ts" -c copy -bsf:a aac_adtstoasc -f mp4 procomplota.ts-vidcat360p.mp4 && ffmpeg -v warning -i procomplota.ts-vidcat360p.mp4 -i ../procomplota.wav -map 0 -map 1 -strict -2 -codec:a aac -b:a 128k -ac 2 -sample_fmt:1 fltp -codec:v copy -pix_fmt yuv420p -f mp4 output-360p.mp4 |