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 a 1080p wmv video that I'd like to convert to a lower quality (preferably 720p) video. I would like to keep the audio intact. How can I accomplish this in Ubuntu?

share|improve this question
up vote 8 down vote accepted

Since you used an ffmpeg tag I will use that for the answer.

ffmpeg -i input.wmv -s hd720 -c:v libx264 -crf 23 -c:a aac -strict -2 output.mp4

Change the video quality by specifying a different CRF parameter. See the x264 encoding guide for more info.

share|improve this answer
Option 'sameq' was removed. If you are looking for an option to preserve the quality (which is not what -sameq was for), use -qscale 0 or an equivalent quality factor option. – juanmah Apr 4 '13 at 9:15

Newer versions of FFmpeg would perhaps use the scale video filter, I give an example below which also simply copies the audio track as you have requested:

ffmpeg -i input.wmv \
       -c:v libx264 -preset veryslow -tune film -crf 22 -vf scale=-2:720 \
       -c:a copy \

The -tune option can be omitted or you could try -tune animation depending on the type of video clip you are using.

If you decided that you would like to transcode the audio you could do worse than to use the external library libfdk_aac as follows:

ffmpeg -i input.wmv \
       -c:v libx264 -preset veryslow -tune film -crf 22 -vf scale=-2:720 \
       -c:a libfdk_aac -b:a 128k \

and this is certainly what I would do with a wmv file that I was scaling, you should find the results more than acceptable...

share|improve this answer
Using -2 instead of -1 in the scale filter will additionally ensure that the value will be divisible by 2, which is required by libx264 for videos with 4:2:0 chroma subsampling. – LordNeckbeard Feb 14 at 19:02
Done, and thanks again :) – andrew.46 Feb 14 at 19:25

If you want to keep intact all the audio tracks, subtitles and so on, you should use something like this:

ffmpeg -i input.mkv \
       -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 \
       -vf scale=-1:720 -c:v libx264 -crf 18 -preset veryslow \
       -c:a:0 copy -c:a:1 copy -c:s copy \

In this case, the input.mkv file has two audio tracks and two subtitles. You can specify all the audio tracks (or subtitles, or videos, etc.) one by one or as a single entity (as I specified for subtitles).

Hope it helps...

share|improve this answer
You don't need to specify each stream in the manner above: -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 Instead, you can simply specify -map 0 instead. This will automatically select all streams in input 0. similar with audio copy codecs. The only codec options you need to specify are -c:copy -c:v libx264. This means: "set all stream codecs to copy, except video which should transcode to x264." – Cheekysoft May 26 at 14:59
Equivalent (showing parameter ordering): ffmpeg -i input.mkv -map 0 -vf scale=-1:720 -c:copy -c:v libx264 -crf 18 -preset veryslow output.mkv – Cheekysoft May 26 at 15:07

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.