如何使用 ffmpeg 将视频中具有 8 个音频通道的 2 个通道(5,6)静音?我已经使用过-filter_complex, -map_channel
但没有成功。
我尝试使用此命令仅传输一个流音频,但所有频道都被静音了:
ffmpeg -i original.mxf -filter_complex "[0:5]volume=enable='between(t,1,300)':volume=0[a1]" -map 0:v -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map "[a1]" -map 0:6 -map 0:7 -map 0:8 -c:v copy -c:a:1 pcm_s16le -b:a 320k convertido.mxf
参见以下输入文件:
ffprobe original.mxf -v error -show_format -show_streams -print_format json
{ “流”:[ { “索引”:0, “编解码器名称”:“mpeg2video”, "codec_long_name": "MPEG-2 视频", “个人资料”:“4:2:2”, "codec_type": "视频", "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “宽度”:1920, “高度”:1080, “编码宽度”:0, “编码高度”:0, “封闭式字幕”:0, “胶片颗粒”:0, “has_b_frames”:1, "sample_aspect_ratio": "1:1", "显示纵横比": "16:9", “pix_fmt”:“yuv422p”, “级别”:2, “颜色范围”:“电视”, “chroma_location”:“左上”, "field_order": "tt", “参考”:1, “r_frame_rate”:“30000/1001”, “平均帧率”:“30000/1001”, “时间基准”:“1001/30000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:630, “持续时间”:“21.021000”, “比特率”:“50000000”, “额外数据大小”:22, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” }, “side_data_list”:[ { "side_data_type": "CPB 属性", “最大比特率”:50000000, “最小比特率”:0, “平均比特率”:0, “缓冲区大小”:6111232, “vbv_delay”:-1 } ] }, { “索引”:1, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:2, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:3, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:4, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:5, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:6, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:7, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } }, { “索引”:8, “编解码器名称”:“pcm_s24le”, "codec_long_name": "PCM 签名 24 位小端", “编解码器类型”:“音频”, "codec_tag_string": [0][0][0][0]", “编解码器标签”:“0x0000”, “sample_fmt”:“s32”, “采样率”:“48000”, “渠道”:1, “每样本位数”:24, “初始填充”:0, “r_frame_rate”:“0/0”, “平均帧速率”:“0/0”, “时间基准”:“1/48000”, “起始点”:0, "开始时间": "0.000000", “duration_ts”:1009008, “持续时间”:“21.021000”, “比特率”:“1152000”, “每原始样本位数”:“24”, “处置”:{ “默认”:0, “配音”:0, “原始”:0, “评论”:0, “歌词”:0, “卡拉 OK”:0, “强制”:0, “听力受损”:0, “视觉障碍”:0, “清洁效果”:0, “附件图片”:0, “timed_thumbnails”:0, “标题”:0, “描述”:0, “元数据”:0, “依赖”:0, “静止图像”:0 }, “标签”:{ “文件包标识”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B701” } } ], “格式”: { “文件名”:“original.mxf”, “nb_streams”:9, “nb_programs”:0, “格式名称”:“mxf”, "format_long_name": "MXF(材料交换格式)", "开始时间": "0.000000", “持续时间”:“21.021000”, “尺寸”:“155863121”, “比特率”:“59317109”, “探测分数”:100, “标签”:{ “operational_pattern_ul”:“060e2b34.04010101.0d010201.01010900”, “uid”:“adab4424-2f25-4dc7-92ff-29bd000c0000”, “generation_uid”:“adab4424-2f25-4dc7-92ff-29bd000c0001”, “公司名称”:“FFmpeg”, “product_name”:“OP1a 多路复用器”, "产品版本号": "58.45.100.0.0", "产品版本": "58.45.100", “product_uid”:“adab4424-2f25-4dc7-92ff-29bd000c0002”, "工具包版本号": "58.45.100.0.0", “material_package_umid”:“0x060A2B340101010501010D0013B7F2A652947134A9B7F2A60052947134A9B700”, “时间码”:“00:00:00:00” } } }
这是ffmpeg处理文件时的输出:
Stream #0:5 (pcm_s24le) -> volume:default (graph 0)
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (pcm_s24le (native) -> pcm_s16le (native))
Stream #0:2 -> #0:2 (pcm_s24le (native) -> pcm_s16le (native))
Stream #0:3 -> #0:3 (pcm_s24le (native) -> pcm_s16le (native))
Stream #0:4 -> #0:4 (pcm_s24le (native) -> pcm_s16le (native))
volume:default (graph 0) -> Stream #0:5 (pcm_s16le)
Stream #0:6 -> #0:6 (pcm_s24le (native) -> pcm_s16le (native))
Stream #0:7 -> #0:7 (pcm_s24le (native) -> pcm_s16le (native))
Stream #0:8 -> #0:8 (pcm_s24le (native) -> pcm_s16le (native))
答案1
您可以使用
ffmpeg -v error -y -i original.mxf -map 0:v -filter_complex "[0:3]volume=enable='between(t,1,60)':volume=0[a5];[0:4]volume=enable='between(t,1,60)':volume=0[a6]" -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map [a5] -map [a6] -map 0:7 -map 0:8 convertido.mxf