Home-FFmpeg-Examples

Convert Video to Images

Convert video to images at rate of 1 image per second:
	ffmpeg -i video.mp4 -vf fps=1 %04d_1perSec.jpg -hide_banner

Convert video to images at rate of 2 images per second:
	ffmpeg -i video.mp4 -vf fps=1/2 %04d_2perSec.jpg -hide_banner

Select Video 'by keyframes' ** to Images:
ffmpeg -i video.mp4 -vf "select=eq(pict_type\,I)" -vsync vfr %04d_keyframes.jpg -hide_banner

Select all frames to images
ffmpeg -i video.webm %04d_all.jpg -hide_banner ( this is all frames )

get just one frame: 
ffmpeg -i video.webm -ss 00:00:07.000 -vframes 1 thumb.jpg

Start at specific time get series of images:
start at -ss 00:00:07.000 (seven seconds even) and get five frames
This can let you pick best of five images.

ffmpeg -i video.mp4 -ss 00:00:07.000 -vframes 5 %04d_series.jpg -hide_banner

** The above is 'by keyframe' ref: 
https://www.bugcodemaster.com/article/extract-images-frame-frame-video-file-using-ffmpeg

Simple Single image Overlay Without Sound

Simple Single image Overlay Without Sound

Example: Simple Single image Overlay Without Sound

EXAMPLE

ffmpeg -i vids/short.mp4 -loop 1 -i small.png -filter_complex \
"[1:v]fade=t=in:st=10:d=2,fade=t=out:st=20:d=3[over];[0:v][over]overlay=50:50" \
-pix_fmt yuv420p -c:a copy -t 30 vids/VIDEO.mp4

         

ffmpeg -i vids/short.mp4 -vf "zoompan=z='zoom+0.001':x='if(gte(zoom,1.5),x,x-1)':y='y':d=700" \
-c:a copy -t 30 vids/ZOOM.mp4	

Simple Zoom

ffmpeg -i vids/ZOOM.mp4 -i small.png -filter_complex 'overlay[out]' -map '[out]' vids/zoom-small.mp4	

Simple Sliding Overlay Without Sound

Simple Sliding Overlay Without Sound

Example: Simple Sliding Overlay Without Sound
ffmpeg -i vids/short.mp4 -i small.png -filter_complex \
"[0:v][1:v]overlay=enable='between=(t,5,20)':x=120+t*28:y=t*10[out]" \
-map "[out]" vids/imageslide.mp4	

Scrolling a Text Image Across a Video

Simple Sliding Overlay Without Sound

Scrolling a Text Image Across a Video
ffmpeg -i vids/short.mp4 -i scrolling-text.png -filter_complex \
"[0:v][1:v]overlay=enable='between=(t,3,30)':x=1220-t*60:y=50[out]" \
-map "[out]" vids/imagescroll.mp4
ffmpeg -i credit.jpg overlay=enable='between=(t,0,10)':x=1220-t*60:y=50[out]" -map "[out]" credit-fade.mp4

ffmpeg -loop 1 -i credit.jpg -c:v libx264 \
-vf drawtext="fontsize=100:fontcolor=yellow:fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:textfile=header_text.txt:x=(w-text_w)/2:y=(h-text_h-line_h)/2","crop=1240:940:40:10" -t 3 -pix_fmt yuv420p -crf 16 -r 12 -y header.mp4


ffmpeg -loop 1 -i credit.jpg -c:v libx264 \



ffmpeg -i short.mp4 -i scrolling-text.png -loop 1 imagescroll.mp4