Both avconv
and ffmpeg
suffer from the poorly chosen defaults for each container and codec. Therefore you should not simply give the command in the format as you have presented, but also tell it what to do.
I use avconv
, but if you are still using ffmpeg
then the format is rather similar, so you should be able to follow.
You will need to specify the audio settings. In many cases you will want to copy your audio without actually reencoding. This is done via -c:a copy
. For example:
avconv -i video.wmv -c:a copy (...) video.mkv
This wasn't a complete line, so don't yet try it.
You can also chose to reencode your audio, in that case rather than copy
you should use the name of the codec (or for some reason often the library that does the encoding). For example, you can write:
avconv -i video.wmv -c:a libvorbis (...) video.mkv
But this will not produce good results, because we didn't give any parameters for the audio conversion. Let's just give it a quality setting, and then we will be all set with audio:
avconv -i video.wmv -c:a libvorbis -q:a 3 (...) video.mkv
Now the video. We can often just copy that one as well, but this is rarely what we want. If you want to just remux the file (meaning you want to change the format, but not codecs), then you can do:
avconv -i video.wmv -c:a copy -c:v copy video.mkv
As you see we have copied both video and audio, and we put them in the new file that is of Matroska format. This command line already will work, and you can give it a try.
You should keep in mind that not each format can take every possible codec, some of them are more picky than others.
Let's say you now want to reencode the video into something. Personally i prefer libtheora, due to the fact that it is a free codec, but you can have different preferences. I will let you decide for yourself which one you use.
So we can have something like this:
avconv -i video.wmv -c:a copy -c:v libtheora -q:v 8 video.mkv
In there i have asked avconv
to copy the audio, but to reencode the video with the library libtheora
and video quality of 8. The entire thing will be saved inside video.mkv, which means it's a Matroska file.
You can play around with settings, but you should very rarely use default presets. And keep in mind, that even if the file format is the same for output as for the input, avconv
will reencode it by default. If you want to copy streams, you should specify it manually.
-t
option if encoding a short duration will suffice to help explain the issue.