19

I am converting MP4 files to WMV with these two rescaling commands:

ffmpeg -i test.mp4 -y -vf scale=-1:360 test1.wmv
ffmpeg -i test.mp4 -y -vf scale=-1:720 test2.wmv

I've also tried:

ffmpeg -g 1 -b 16000k -i test1.mp4 test1.wmv

However, the .wmv files that are produced are "blocky and grainy" as you can see here in a small section of a video screenshot:

enter image description here

These are the sizes:

test.mp4 - 106 MB
test1.wmv - 6 MB
test2.wmv - 16 MB

How can I increase the quality/size of the resulting .wmv files (the size of the .wmv files is of no concern)?

Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047

5 Answers5

24

Consider the following command instead (some outdated commands in the final answer section):

ffmpeg -i test.mp4 -c:v wmv2 -b:v 1024k -c:a wmav2 -b:a 192k test1.wmv

REFERENCES

John Weisz
  • 30,137
  • 13
  • 89
  • 132
  • Nice, this works perfect for me. Only change is I set '-b:v 5120k' (ie 5*1024). Higher bitrate removed the graininess. According to the web - "For 1080p videos, the ideal bitrate ranges from 3,500 to 6,000 Kbps. If you're using a standard frame rate (30fps), aim for the lower end of the range, between 3,500 and 5,000 Kbps. If you have a high frame rate (60fps), aim for a bitrate of 4,500 to 6,000 Kbps." – LT Dan Aug 25 '23 at 20:11
14

You can simply use the -sameq parameter ("use same quantizer as source") which produces a much larger sized video file (227 MB) but with excellent quality.

ffmpeg -sameq -i test.mp4 -y -vf scale=-1:360 test1.wmv

In newer versions of ffmpeg flag '-sameq' has been removed. To achieve similar results one should use 'qscale' flag with 0 value:

ffmpeg -sameq -i test.mp4 -qscale 0 -vf scale=-1:360 test1.wmv
kwmen
  • 63
  • 2
  • 5
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
  • 13
    A better solution is to use `-qscale` (or `-qscale:v` or `-q:v` depending on your syntax preference); generally with a value of 2-5. A lower value is higher quality, and 2 can be considered "visually lossless". `-sameq` is not designed to be used between formats that do not share the same quantizer scale, and this may be the case for you. – llogan Jun 18 '12 at 16:03
  • 2
    Also you're applying `-sameq` as an input option (anything before `-i`). Probably works as expected, but keep in mind not all options applied to the input will be applied to the output. – llogan Jun 18 '12 at 16:07
  • 7
    -sameq has been removed. When you try to use it ffmpeg offers "use -qscale 0 or an equivalent quality factor option", and it errors out with an invalid argument. – Robert Koernke Jan 06 '16 at 17:04
10

Working answer in 2020, producing an output video without blockiness:

ffmpeg -i input.mp4 -q:v 1 -q:a 1 output.wmv
simon
  • 12,666
  • 26
  • 78
  • 113
5

One thing I discovered after many frustrating attempts of enhancing the final quality was that if you don't specify a bitrate, it'll use a quite low average. Try -b 1000k for a starting point, and experiment increasing or decreasing it until you reach the desired result. Your file will be quite bigger or smaller, accordingly.

Fabio Ceconello
  • 15,819
  • 5
  • 38
  • 51
0

I used this and it turned out quite well

ffmpeg -i "file1.mp4" -q:v 0 -c:v wmv2 -b:v 1024k -c:a wmav2 -b:a 192k test2.wmv
Martin
  • 1
  • 2
  • 1
    `-q:v` and `-b:v` are mutually exclusive meaning only one will be used and the other will be ignored. So you should choose one or the other but not both. – llogan Sep 08 '20 at 17:37