Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
2  
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
1  
You can run ffmpeg -i myfiletoconvert.m4v -c copy output.webm so that the codecs are copied from the input to the output file. –  green7 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
1  
@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

1 Answer 1

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

 
discard

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.