(adapted from comments above)
Depending on the codecs used (some codecs are incompatible with some containers), you could always simply copy the streams (-codec copy
). That is the best way to avoid quality changes, as you're not reencoding the streams, just repackaging those in a different container.
When dealing with audio/video files, it is important to keep in mind that containers are mostly independent from the used codecs. It is common to see people referring to files as "AVI video" or "MP4 video", but those are containers and tell us little about whether a player will be able to play the streams, as, apart from technical limitations (for example, AVI may have issues with h264 and Ogg Vorbis), you could use any codec.
-same_quant
seems to be a way to tell ffmpeg to try to achieve a similar quality, but as soon as you reencode the video (at least with lossy codecs), you have no way to get the same quality. If you're concerned with quality, a good rule of thumb is to avoid reencoding the streams when possible.
So, in order to copy the streams with ffmpeg, you'd do:
ffmpeg -i video.mp4 -codec copy video.avi
(As @Peter.O mentioned, option order is important, so that's where -codec copy
must go. You could still keep -same_quant
, but it won't have any effect as you're not reencoding the streams.)
-codec copy
). That is the best way to avoid quality changes, as you're not reencoding the streams, just repackaging those in a different container.Unknown decoder 'copy'
.-codec copy
must go after-i video.mp4
-- can you tryffmpeg -i video.mp4 -codec copy video.avi
? (-same_quant
works here too, but will do nothing, as this just copies the streams)-codec copy
on the right place is works.