ffmpeg generate higher quality images for MJPEG encoding

匿名 (未验证) 提交于 2019-12-03 01:48:02

问题:

I have a bunch of mov / H.264 files, that I'd like to encode into mov/MJPEG. However I'm getting very low quality output. Here's what I tried:

ffmpeg -i a.mov -an -crf 11 -preset slower -pix_fmt yuv420p -vcodec mjpeg -f mov -y b.mov 

For H.264 encoding the -crf and -preset flags generate higher quality. But that doesn't seem to work for MJPEG.

回答1:

Use -q:v

By default for MJPEG ffmpeg will probably use the default of -b:v 200k. This was fine when it was set as the default more than 10 years ago (I'm guessing the age), but not anymore.

You can use -q:v instead. For MJPEG the effective range is a linear scale of 2-31, and a lower value will result in a higher quality output.

If you want to apply Huffman optimization add -huffman optimal. It can result in a somewhat smaller output file size.

Example

ffmpeg -i input.mov -c:v mjpeg -q:v 3 -huffman optimal -an output.mov 

Private options

The MJPEG encoder does not use -crf and -preset; these are "private" options for some encoders. You can see private options like this: ffmpeg -h encoder=mjpeg.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!