Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to figure out how to get avconv to concatenate a bunch of .bmps together into a video file.

Here's what I've got so far:

avconv -f image2 -i Capture/%d.bmp -vcodec mpeg4 -r 24 -b:v 20M Capture.mkv

While this does work, the quality is terrible - there are tons of artifacts that are visible, the colours are distorted and everything is blurred.

I've trawled through the documentation for avconv and ffmpeg, but can't find anything that increases the quality.

Any ideas as to how I can get the quality as close to the original bmps as possible?

share|improve this question

migrated from stackoverflow.com Jul 9 '12 at 13:52

This question came from our site for professional and enthusiast programmers.

    
I haven't even been able to get this to work... The command I'm using appears to overwrite the original bitmap: Same command as yours except I am using -i output_{0..1023}.bmp – user3728501 Feb 22 '15 at 14:06
-vcodec mpeg4

That could be your problem. MPEG-4 is a fairly good codec, but it's easily outperformed by h.264 – x264 being a popular example for an h.264 encoder. I'm not sure how big of a role the bitrate plays here, but it would help to just try x264. Therefore, use

-c:v libx264

to change your encoder.* In order to tune the quality, set the Constant Rate Factor to a level of your choice. Sane values are from 19 to 24, where lower values mean better quality.

avconv -f image2 -i Capture/%d.bmp -c:v libx264 -r 24 -crf 21 Capture.mkv

If you still see artifacts, you might want to give us more info, and update your post with the full, uncut console output from your avconv command.

* -c:v is the new syntax used instead of vcodec, similar to -b:v. Try to keep sticking to that.

share|improve this answer

I had a similar problem. To get the best match to your BMP, I suggest doing what I did: convert to TIF or JPEG since avconv doesn't handle BMP very nicely - no matter many high quality settings I discovered and set.

A visual way to do this is simply get GIMP and BIMP (which is an excellent batch program anyway) and do a batch conversion of your BMPs to JPEGs at 100% quality or TIF (you could use TIF compression).

Now try the same avconv action. I used avconv -f image2 -r 15 -i animation%04d.jpg -r:v 15 -c:v h264 -crf 1 -an "animation_test.mov" but it should be fine with your mkv action now.

share|improve this answer

Try using a different video codec. It might only work in QuickTime files (not Matroska), but qtrle is a lossless video codec, although it doesn't compress very well.

share|improve this answer

You must log in to answer this question.