Skip to content

Instantly share code, notes, and snippets.

@AntumDeluge
Created February 11, 2021 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntumDeluge/931ac01e29d98810a3430382c18db8c7 to your computer and use it in GitHub Desktop.
Save AntumDeluge/931ac01e29d98810a3430382c18db8c7 to your computer and use it in GitHub Desktop.
FFmpeg Single Image to Video

Convert image to video in FFmpeg

To convert a single image to video, use the -loop option to specify we are looping an image & the -t option to specify the duration of the resulting video:

-loop 1 -i <img_in> -t <duration>

To add empty audio, use the lavfi format with anullsrc input (change channel layout & sample rate as needed):

-f lavfi -i anullsrc=channel_layout=mono:sample_rate=44100

Example:

ffmpeg -loop 1 -i <img_in> -f lavfi -i anullsrc=channel_layout=mono:sample_rate=44100 \
  -r 30 -c:v libx264 -c:a aac -t 8 <vid_out>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment