ffmpeg mp4 to wmv

Posted 天王星天

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ffmpeg mp4 to wmv相关的知识,希望对你有一定的参考价值。


//大小=》变小
ffmpeg -i 1.mp4 -b:v 2M -vcodec msmpeg4 -acodec wmav2 1_mp4.wmv
//大小=》变大
ffmpeg -i 1.mp4 -qscale 2 -vcodec msmpeg4 -acodec wmav2 2_mp4.wmv

ffmpeg -i 1.mp4 -q:a 2 -q:v 2 -vcodec msmpeg4 -acodec wmav2 3_mp4.wmv

 

ffmpeg -i 1.mp4 outputfile.wmv


ffmpeg -i 1.MP4 -c:v wmv2 -b:v 20M -c:a wmav2 -b:a 192k output.wmv


ffmpeg -i input.wmv -c:v libx264 -crf 23 -profile:v high -r 30 -c:a libfaac -q:a 100 -ar 48000 output.mp4


ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a libfaac -q:a 100 output.mp4

 

 

 

How to get better quality converting MP4 to WMV with ffmpeg?

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:

技术分享

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

shareimprove this question
 

3 Answers

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
shareimprove this answer
 
7  
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. – LordNeckbeard 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. – LordNeckbeard Jun 18 ‘12 at 16:07
    
-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 6 at 17:04
 

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.

shareimprove this answer
 

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

shareimprove this answer
 

 

 

http://stackoverflow.com/questions/11079577/how-to-get-better-quality-converting-mp4-to-wmv-with-ffmpeg

以上是关于ffmpeg mp4 to wmv的主要内容,如果未能解决你的问题,请参考以下文章

使用ffmpeg来转换media Video

FFmpeg 常用转换命令

使用FFmpeg处理视频文件:视频转码剪切合并播放速调整

使用 JavaCV 和 FFmpeg 播放视频

10 ffmpeg剪辑视频

获取音视频时长(NAudio,Shell32,FFmpeg)