FFMPEG Commands

From Hawk Wiki
Revision as of 21:48, 9 August 2011 by Hall (Talk | contribs)

Jump to: navigation, search

Extracting images (jpeg) from a video:

ffmpeg -i foo.avi -f image2 f%03d.jpg


ffmpeg convert to photo-jpeg

ffmpeg -i input.mov -pix_fmt yuv420p -vcodec mjpeg -qscale 1 output.mov
ffmpeg -i f%03d.jpg -pix_fmt yuv420p -vcodec mjpeg -qscale 1 output.mov


Add Watermark/Overlay & H264 output

ffmpeg -i image.%04d.jpg -vcodec libx264 -b 15M -f mov -g 30 -bf 3 -b_strategy 1 -coder 1 -qmin 20 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 1 -flags2 +fastpskip -dts_delta_threshold 1 -acodec libfaac -ab 192k -y -vf "movie=0:png:o.png, scale=1280x720 [wm];[in][wm] overlay=0:0:1 [out]" -s 1280x720 output_watermark.mov

Another version. For windows build and newer version of ffmpeg
ffmpeg -i image.%04d.jpg -vcodec libx264 -b 15M -f mov -g 30 -bf 3 -b_strategy 1 -coder 1 -qmin 20 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 1 -flags2 +fastpskip -dts_delta_threshold 1 -acodec libfaac -ab 192k -y -vf "movie=o.png, scale=1280:720 [mask];[in][mask] overlay=0:0:1 [out]" -s 1280x720 output_watermark.mov


Split video

use -ss 00:00:01.000 #start position
-t 00:00:30.000 #duration


Padding & Overlay

//padding 90px top and bottom
ffmpeg -i image.%04d.jpg -vcodec libx264 -b 15M -f mov -g 30 -bf 3 -b_strategy 1 -coder 1 -qmin 20 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 1 -flags2 +fastpskip -dts_delta_threshold 1 -acodec libfaac -ab 192k -y -vf "[in]pad=1280:900:0:90:black[pd];movie=o.png, scale=1280:900 [mask];[pd][mask] overlay=0:0:1 [out]" -s 1280x720 output_padding90.mov


Convert to ipad

ffmpeg -y -i input.avi -acodec aac -ar 48000 -ab 128k -ac 2 -s 1024×768 -vcodec libx264 -b 1200k -flags +loop+mv4 -cmp 256 -partitions +parti4x4+partp8x8+partb8x8 -subq 7 -trellis 1 -refs 5 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 1200k -maxrate 1200k -bufsize 1200k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 16:9 -r 30 -g 90 -async 2 output.mp4