Image sequence to video quality

42,084

The quality of that command's output is bad for a few reasons:

  • It is encoding using the MPEG-1 codec, which is quite outdated.
  • You are not setting the bitrate, so it is coming up with its own guess, which is probably inadequate.

Try something like:

ffmpeg -f image2 -i image%d.jpg -vcodec mpeg4 -b 800k video.avi

for mpeg 4 video or:

ffmpeg -f image2 -i image%d.jpg -vcodec libx264 -b 800k video.avi

for H.264 video (You will need to have libx264 installed for this to work). You can play around with the bitrate because it depends on the size of your frames what bitrate you will need. Also, running ffmpeg -formats will display all of the output formats and codecs if you want to experiment more.

See the ffmpeg documentation for even more options.

Share:
42,084
brux
Author by

brux

I enjoy tinkering with android and web dev.

Updated on January 09, 2022

Comments

  • brux
    brux over 2 years

    I have been experimenting with creating a video from a sequence of images.

    When I use the suggested ffmpeg method:

    ffmpeg -f image2 -i image%d.jpg video.mpg
    

    The video is not really as good as I hoped it would be :/

    For example with VDUB, If I export avi from the same image sequence its perfect qulality, however the file size can be huge if theres a lot of jpegs.

    In the past I have used x264 gui front-ends such as staxrip and the video produced from an uncompressed AVI is very exceptional and the compression is very very good, relitively tiny output files (mp4).

    So what is the best way to compress the image sequence so that there is very high quality? Surely there is something better than ffmpeg? is it possible to use the x264 from an image sequence as you would with ffmpeg, and get higher quality? FYI i will be excecuting the task from within a c#.net project using startprocess();

  • PJ Brunet
    PJ Brunet almost 9 years
    The -b applies to everything, audio and video. You can specify what stream the bitrate applies to... "stream_type is one of following: ’v’ or ’V’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. ’v’ matches all video streams, ’V’ only matches video streams which are not attached pictures, video thumbnails or cover arts. If stream_index is given, then it matches stream number stream_index of this type. Otherwise, it matches all streams of this type."