Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I have several m4v files, which I need to convert to webm.

I am using ffmpeg for doing so and have used commands such as:

ffmpeg -i myfiletoconvert.m4v output.webm

The conversion works fine, and the resolution is still the same, however the quality is just not the same.

What I actually would like is that the conversion is lossless. I would like the properties of the input file to be the same for the output file, so that I do not have a noticeable quality change.

How would I accomplish that?

share|improve this question
Welcome to Ask Ubuntu! Can you share a bit more about the codecs you're using? M4V and WebM are just containers. (where WebM requires specific codecs) Unless your M4V file consists of Vorbis audio and VP8 video this is impossible to do lossless. – gertvdijk Feb 9 '13 at 12:29
You can run ffmpeg -i myfiletoconvert.m4v -c copy output.webm so that the codecs are copied from the input to the output file. – green Feb 9 '13 at 12:37
have you tried any of the preset files available wit ffmpeg. e.g libvpx-720p.ffpreset also try to set the bitrate as close as possible to input bitrate. – rajneesh Feb 9 '13 at 15:01
@green7 webm is designed for VP8 video and Vorbis audio. I don't know how well it will work with other arbitrary formats. – LordNeckbeard Feb 11 '13 at 23:45
@rajneesh Matching bitrates is not recommended. Not all encoders are equal (and not all formats are equal) in terms of bitrate requirements. – LordNeckbeard Feb 11 '13 at 23:45

I would like the properties of the input file to be the same for the output file, so that I do not have a noticeable quality change.

You're going from a lossy codec to another lossy codec. That means you will lose quality no matter what, unless you set the target bit rate so high that the quality loss won't be noticeable (even if it's still there).

The downside is, of course, that the file size will increase. How much, you ask, will it increase? No one can tell. It depends on how good the quality of your input video is, and how easy the video is to encode.

To force a bit rate during conversion, do the following, e.g. for constant 1 MBit/s:

ffmpeg -i in.m4v -c:v libvpx -b:v 1M -c:a libvorbis out.webm

The libvpx encoder can also work with variable quality, using the -qmin, -qmax options:

ffmpeg -i in.m4v -c:v libvpx -qmin 10 -qmax 42 -c:a libvorbis out.webm

Use lower values for both parameters to achieve better quality. Usually FFmpeg would set them to 2/31, but WebM needs a different scale here AFAIK.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.