我有一个用 ffmpeg 生成的 .mp4 文件,如下所示。
ffmpeg -y -i video_extended.mp4 -itsoffset 00:00:04.00 -i output5-1.wav -map 0:0 -map 1:0 -c:v copy -c:a aac -ac 6 -ar 48000 -b:a 128k -async 1 combined.mp4
使用 ffplay播放mixed.mp4
文件没有问题,并且不会影响音质。以下是我使用命令时从 ffplay 获得的输出ffplay -i mixed.mp4
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
> 'mixed_h264_aac_512k_async_qp0_all_I.mp4': Metadata:
> major_brand : isom
> minor_version : 512
> compatible_brands: isomiso2avc1mp41
> encoder : Lavf58.76.100 Duration: 00:00:16.02, start: 0.000000, bitrate: 49136 kb/s Stream #0:0[0x1](und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv422p10le(progressive),
> 1920x1080, 65409 kb/s, 59.94 fps, 59.94 tbr, 11988 tbn (default)
> Metadata:
> handler_name : VideoHandler
> vendor_id : [0][0][0][0] Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 71 kb/s (default)
> Metadata:
> handler_name : SoundHandler
> vendor_id : [0][0][0][0] Switch subtitle stream from #-1 to #-1 vq= 1606KB sq= 0B f=0/0
然后,我mixed.mp4
使用以下命令将文件解码回原始 PCM。
ffmpeg -i 混合.mp4 -vn -acodec pcm_s16le -f s16le -ar 48000 -ac 6 raw_audio.pcm
然而,这raw_audio.pcm
包含了很多噪音,ffplay 输出显示以下输出
[s16le @ 0x7f7490000c80] Estimating duration from bitrate, this may be inaccurate
Input #0, s16le, from 'separated_audio_s16.pcm':
Duration: 00:00:16.02, bitrate: 4607 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 6 channels, s16, 4608 kb/s
[pcm_s16le @ 0x7f749002b940] Multiple frames in a packet.
[pcm_s16le @ 0x7f749002b940] Invalid PCM packet, data has size 8 but at least a size of 12 was expected
Last message repeated 32 times
[pcm_s16le @ 0x7f749002b940] Invalid PCM packet, data has size 8 but at least a size of 12 was expected
Last message repeated 11 times
Switch subtitle stream from #-1 to #-1 vq= 0KB sq= 0B f=0/0
[pcm_s16le @ 0x7f749002b940] Invalid PCM packet, data has size 8 but at least a size of 12 was expected
Last message repeated 11 times
[pcm_s16le @ 0x7f749002b940] Invalid PCM packet, data has size 8 but at least a size of 12 was expected
Last message repeated 11 times
[pcm_s16le @ 0x7f749002b940] Invalid PCM packet, data has size 8 but at least a size of 12 was expected
有人能解释一下这个问题吗?请注意,正确运行的 ffplay 命令mixed.mp4
显示 fltp
为音频格式,而播放文件时raw_audio.pcm
,它被视为 s16。
此外,我尝试了同样的方法处理包含立体声音频的文件,效果很好。您可以通过下载 .mp4 文件来重现此问题这里。
这是 ffmpeg 在处理多通道音频时出现的重采样问题吗?我该如何纠正它?
我在 Fedora 36 系统中使用 ffmpeg 和 ffplay 版本 5.0.1。
谢谢。