ffmpeg Magic Command Lines

ffmpeg is a swis-knife, which will save your arse in most difficult conditions. here are some of my favourite command lines:

make old AVI for poor windows users:

ffmpeg -i input.mov -vf "yadif=0:-1:0, scale=iw/3:-1" -acodec libmp3lame -vcodec libxvid -ab 160k -bf 2 -q:v 3 -f avi output.avi

join more MP4s together and rescale them to 1920x1080 and 25fps

ffmpeg `cat list.txt` -filter_complex "[0:v:0] [0:a:0] [1:v:0] [1:a:0] concat=n=17:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" -c:v libx264 -preset fast -r 25 -s 1920x1080 -c:a aac output.mp4 where list.txt is list like: -i P1320241.MP4 -i P1320242.MP4 -i P1320243.MP4 -i P1320244.MP4 -i P1320245.MP4 -i P1320246.MP4 .... generated by simple sh script and "=17" is number of pieces in the list

DVD iso to mp4

(thx matěj strnad) ffmpeg -i input.iso -c copy -bsf:a aac_adtstoasc output.mp4

convert MXF to mp4 (rescale to fullhd), discarding first audio track (timecode beep)

ffmpeg -i Clip0001.MXF -map 0:v:0 -map 0:a:1 -c:v libx264 -vf scale=1920x1080 -profile:v baseline output.mp4

EBU norm volume measurement (telka)

(thx tom potočný) ffmpeg -i input.mp4 -filter_complex ebur128=peak=true+sample -vn -sn -dn -hide_banner -f null /dev/null


copy metadata to file

ffmpeg -i file.mp4 -f ffmetadata metadata.txt

show metadata:

ffprobe -show_streams -show_format filename.mp4

show all (requires mediainfo)

mediainfo -f --Language=raw filename.mp4

delete metadata --- not working right now

ffmpeg -y -i "test.mp4" -c copy -map_metadata -1 -metadata title=" " -metadata creation_time=2016-09-20T21:30:00 -map_chapters -1 "test.mp4" ffmpeg -y -i input.mp4 -c copy -map 0 -map_metadata 0 -metadata title=" " -metadata creation_time=2016-11-29T21:47:32 -metadata CodecID/Url=" " -metadata encoder=" " -metadata CodecID/Url=" " -metadata Encoded_Application=" " -map_chapters -1 "output.mp4"

stream download/capture windows media to local file:

ffmpeg -i mmsh://xxx.xxx.xxx/xxxx -acodec copy -vcodec copy output.mp4 (replace mms: to mmsh:)

psp download

ffmpeg -i mmsh:// -acodec copy -vcodec copy psp-2017-01-19.wmv EOF Comments requested ~~~~~~~~~ Binary Sxizophreny - index of comp related stuff Kangaroo's Homepage (czech)