How to get better quality converting MP4 to WMV with ffmpeg?
Asked Answered
U

5

20

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)?

Urian answered 18/6, 2012 at 8:53 Comment(0)
R
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

Rathskeller answered 18/1, 2016 at 10:2 Comment(1)
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."Prosper
U
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
Urian answered 18/6, 2012 at 9:23 Comment(3)
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.Eudora
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.Eudora
-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.Flagman
C
10

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

ffmpeg -i input.mp4 -q:v 1 -q:a 1 output.wmv
Conventioneer answered 30/9, 2020 at 13:41 Comment(0)
L
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.

Lawgiver answered 7/2, 2013 at 22:59 Comment(0)
C
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
Cesaro answered 7/9, 2020 at 14:22 Comment(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.Eudora

© 2022 - 2024 — McMap. All rights reserved.