gpt4 book ai didi

ffmpeg H265 到 H264 颜色关闭?

转载 作者:行者123 更新时间:2023-12-04 22:48:59 26 4
gpt4 key购买 nike

我想将 H265 视频转换为 H264,质量损失几乎没有。但是,当转换输出颜色时,最明显的是红色变为橙色。通常,输出视频颜色较暗/饱和/灰色。
我相信this问题是相关的,所以是否可以将 color_range、color_space、color_transfer 和 color_primaries 标志添加到文件中而无需再次重新编码整个内容?
命令:

ffmpeg -i input.mkv -c:v libx264 -crf 17 output.mp4
输入视频流:
{
"index": 0,
"codec_name": "hevc",
"codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
"profile": "Main 10",
"codec_type": "video",
"codec_time_base": "1/24",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"width": 1920,
"height": 1080,
"coded_width": 1920,
"coded_height": 1080,
"closed_captions": 0,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p10le",
"level": 120,
"color_range": "tv",
"color_space": "bt2020nc",
"color_transfer": "smpte2084",
"color_primaries": "bt2020",
"refs": 1,
"r_frame_rate": "24/1",
"avg_frame_rate": "24/1",
"time_base": "1/1000",
"start_pts": 0,
"start_time": "0.000000",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "eng",
"BPS": "4421595",
"DURATION": "00:41:46.417000000",
"NUMBER_OF_FRAMES": "60154",
"NUMBER_OF_BYTES": "1385295394",
"_STATISTICS_WRITING_APP": "mkvmerge v62.0.0 ('Apollo') 64-bit",
"_STATISTICS_TAGS": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES"
}
}
输出视频流:
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "High 10",
"codec_type": "video",
"codec_time_base": "1/48",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1920,
"height": 1080,
"coded_width": 1920,
"coded_height": 1088,
"closed_captions": 0,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p10le",
"level": 40,
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "24/1",
"avg_frame_rate": "24/1",
"time_base": "1/12288",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 30798848,
"duration": "2506.416667",
"bit_rate": "4073900",
"bits_per_raw_sample": "10",
"nb_frames": "60154",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "eng",
"handler_name": "VideoHandler"
}
}

最佳答案

其中一些元数据也可能在比特流中发出信号,但您可以对视频执行 remux(复制视频比特,不重新编码)并使用如下命令设置 mp4 容器元数据:

ffmpeg -i output.mp4 -c:v copy -color_primaries bt2020 -color_range tv -colorspace bt2020nc -color_trc smpte2084 output_updated.mp4
这设置为匹配您的输入视频设置。
reference FFMPEG docs (搜索 color_trc 以找到正确的部分)

关于ffmpeg H265 到 H264 颜色关闭?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69942821/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com