将格式从 yuvj420p 转换为 yuv420p [英] convert format from yuvj420p to yuv420p

查看:62
本文介绍了将格式从 yuvj420p 转换为 yuv420p的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行一种算法以将 yuvj420p 转换为 yuv420p.两种格式的区别在于范围值.

i'm trying to perform an algorithm to convert from yuvj420p to yuv420p. The difference between both formats are the range values.

yuvj420p [0-255] 和 yuv420p [16-239]

yuvj420p [0-255] and yuv420p [16-239]

我想知道如何使值适应新的范围.

I want to know how to adapt the values to the new range.

推荐答案

这有点晚了,但为了将来参考,如果它对任何人有帮助,这里是如何用 FFmpeg 处理这个问题.

A bit late to this, but for future reference, in case it helps anyone, here is how to deal with this problem with FFmpeg.

例如从 After Effects 导出未压缩的 AVI 时,有时 FFmpeg 转换似乎缺乏对比度,就像范围被压缩一样.添加

When exporting, say, an uncompressed AVI from After Effects, sometimes the FFmpeg conversion seems to lack contrast, as if the range was being compressed. Adding

-pix_fmt yuvj420p

...到命令,当用libx264编码时,可以解决这个问题.但是,在不支持这种像素格式的 webm (VP8) 等格式上,我发现 选项 scale filtergraph 允许我调整范围,同时保留在 yuv420p 中,这对您的情况可能更有帮助,并且在任何情况下 yuvj420p 可能不支持.尝试添加此标志:

...to the command, when encoding with libx264, can fix this. However, on formats like webm (VP8) which don't support this pixel format, I've found options of the scale filtergraph have allowed me to adjust the range, while remaining in yuv420p, which might be more helpful in your case, and in any case where yuvj420p might not be supported. Try adding this flag:

-vf "in_range=mpeg:out_range=full"

来自文档:

in_rangeout_range:设置输入/输出 YCbCr 样本范围.

in_range, out_range: Set in/output YCbCr sample range.

这允许覆盖自动检测的值以及允许强制用于输出和编码器的特定值.如果不指定,范围取决于像素格式.

This allows the autodetected value to be overridden as well as allows forcing a specific value used for the output and encoder. If not specified, the range depends on the pixel format.

所以,就我而言,整个命令最终看起来像这样:

So, in my case, the entire command ended up looking like this:

ffmpeg -i master.mp4 -c:v libvpx -crf 12 -vf "scale=300:-1:in_range=mpeg:out_range=full, crop=300:168" -b:v 1M -c:a libvorbis -b:a 64k -ac 1 output_from_mp4_ranged.webm

这篇关于将格式从 yuvj420p 转换为 yuv420p的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆