smooth-dl.py: add support for downloading chunks with the 'd' attribute
[smooth-dl.git] / scripts / mux_reencode_ffmpeg.sh
1 #!/bin/sh
2
3 VIDEO_FILE="_video.vc1"
4 AUDIO_FILE="_audio.raw.wav"
5 OUTPUT_FILE="out.mp4"
6
7 # Exactly what "smooth-dl -s" tells us
8 AV_DELAY="0.441333"
9
10 VIDEO_BITRATE="1500k"
11 AUDIO_BITRATE="128k"
12
13 VIDEO_OPTIONS="-g 100 -keyint_min 50 -flags2 -mbtree"
14 AV_SYNC="-itsoffset $AV_DELAY -async 1"
15
16 AUDIO_NONE="-an"
17 AUDIO_OPTIONS="-acodec libmp3lame -ac 2 -ab $AUDIO_BITRATE"
18 VIDEO_PASS1="-vcodec libx264 -vpre veryfast_firstpass ${VIDEO_OPTIONS}"
19 VIDEO_PASS2=-"vcodec libx264 -vpre veryfast ${VIDEO_OPTIONS}"
20
21 # iPhone compatible streams
22 VIDEO_PASS1="$VIDEO_PASS1 -vpre baseline"
23 VIDEO_PASS2="$VIDEO_PASS2 -vpre baseline"
24
25 echo $VIDEO_FILE $AUDIO_FILE $OUTPUT_FILE $AUDIO_NONE $VIDEO_PASS1
26
27 LANG=C ffmpeg -y  -i $VIDEO_FILE $AUDIO_NONE                            $VIDEO_PASS1 -pass 1 -b $VIDEO_BITRATE $OUTPUT_FILE
28 LANG=C ffmpeg -y  -i $VIDEO_FILE $AV_SYNC -i $AUDIO_FILE $AUDIO_OPTIONS $VIDEO_PASS2 -pass 2 -b $VIDEO_BITRATE $OUTPUT_FILE