本文介绍了ffmpeg为MJPEG编码生成更高质量的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆mov / H.264文件,我想编码成mov / MJPEG。但是我的产品质量非常低。这是我试过的:

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

对于H.264编码, -crf -preset 标志产生更高的质量。但是,这对于MJPEG来说似乎不起作用。

解决方案

使用 -q:v



默认情况下,MJPEG ffmpeg 可能会使用默认值 b:v 200k 。这是非常好的,当它被设置为超过10年前的默认(我猜这个年龄),但不再是。



您可以使用 -q:v 对于MJPEG,有效范围是2-31的线性比例,较低的值将导致更高的质量输出。 p>

如果您要应用霍夫曼优化,请添加 -huffman optimization



示例



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



私人选项



MJPEG编码器不使用 -crf 预设;这些是某些编码器的。您可以看到这样的私人选项: ffmpeg -h encoder = mjpeg


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.

解决方案

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.

这篇关于ffmpeg为MJPEG编码生成更高质量的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 05:55