Image sequence to video quality

brux picture brux · Jul 1, 2010 · Viewed 40k times · Source

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();

Answer

Jason B picture Jason B · Jul 1, 2010

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 have 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.