FFMPEG Commands

From Hawk Wiki
Revision as of 16:22, 4 August 2011 by Hall (Talk | contribs) (Add water mark & H264 output)

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 water mark & 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