ffmpeg 中使用 H265 的 Lavf58.29.100 和 Lavc58.134.100 eac3 编码有什么区别?
我使用 ffmpeg 和 handbrake 软件创建了一个 mkv 文件,但两者都使用不同的编码,handbrake 使用 Lavf58.29.100 而 ffmpeg 使用 Lavc58.134.100 eac3 我怎样才能告诉 ffmpeg 使用与 handbrake 相同的 Lavf58.29.100?
ffmpeg -i 0.mp4 -c:v libx265 -preset fast -crf 28 -tag:v hvc1 -c:a eac3 -b:a 224k out.mkv
Handbrake 视频 ffprobe:
{
"streams": [
{
"index": 0,
"codec_name": "hevc",
"codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
"profile": "Main",
"codec_type": "video",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"width": 1280,
"height": 720,
"coded_width": 1280,
"coded_height": 720,
"closed_captions": 0,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p",
"level": 93,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"refs": 1,
"r_frame_rate": "30/1",
"avg_frame_rate": "30/1",
"time_base": "1/1000",
"start_pts": 23,
"start_time": "0.023000",
"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": {
"DURATION": "00:01:49.823000000"
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "fltp",
"sample_rate": "44100",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"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": {
"title": "Stereo",
"DURATION": "00:01:49.876000000"
}
}
],
"format": {
"filename": "0.mkv",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "matroska,webm",
"format_long_name": "Matroska / WebM",
"start_time": "0.000000",
"duration": "109.876000",
"size": "30483436",
"bit_rate": "2219479",
"probe_score": 100,
"tags": {
"title": "0",
"creation_time": "2021-07-13T14:44:04.000000Z",
"ENCODER": "Lavf58.29.100"
}
}
}
ffmpeg 视频 ffprobe:
{
"streams": [
{
"index": 0,
"codec_name": "hevc",
"codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
"profile": "Main",
"codec_type": "video",
"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": "yuv420p",
"level": 120,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"field_order": "progressive",
"refs": 1,
"r_frame_rate": "30/1",
"avg_frame_rate": "30/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": {
"HANDLER_NAME": "ISO Media file produced by Google Inc.",
"VENDOR_ID": "[0][0][0][0]",
"ENCODER": "Lavc58.134.100 libx265",
"DURATION": "00:01:49.806000000"
}
},
{
"index": 1,
"codec_name": "eac3",
"codec_long_name": "ATSC A/52B (AC-3, E-AC-3)",
"codec_type": "audio",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"sample_fmt": "fltp",
"sample_rate": "44100",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"dmix_mode": "-1",
"ltrt_cmixlev": "-1.000000",
"ltrt_surmixlev": "-1.000000",
"loro_cmixlev": "-1.000000",
"loro_surmixlev": "-1.000000",
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/1000",
"start_pts": 0,
"start_time": "0.000000",
"bit_rate": "223715",
"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": {
"HANDLER_NAME": "ISO Media file produced by Google Inc.",
"VENDOR_ID": "[0][0][0][0]",
"ENCODER": "Lavc58.134.100 eac3",
"DURATION": "00:01:49.854000000"
}
}
],
"format": {
"filename": "out.mkv",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "matroska,webm",
"format_long_name": "Matroska / WebM",
"start_time": "0.000000",
"duration": "109.854000",
"size": "25218291",
"bit_rate": "1836495",
"probe_score": 100,
"tags": {
"COMPATIBLE_BRANDS": "isomiso2avc1mp41",
"MAJOR_BRAND": "isom",
"MINOR_VERSION": "512",
"ENCODER": "Lavf58.76.100"
}
}
}
我也尝试了 ffmpeg-python 包,但是在使用 H265 时出现错误:
(
ffmpeg
.input('0.mp4')
.filter('fps', fps=25, round='up')
.output('out.mkv', format='h265')
.run()
)
我收到的错误:
Requested output format 'h265' is not a suitable output format
out.mkv: Invalid argument