问题描述
我在使用FFmpeg进行acc编码时遇到问题.我有带有AAC音频的au mp4文件.我试图用ffmpeg复制音频.在源mp4文件中,第一个音频噪声出现在0.30秒处.使用ffmpeg -i inputfile.mp4 -c:a copy outputfile.aac
进行转换后,生成的文件错误,第一个音频噪声出现在0.32秒处.文件的持续时间也不一样.
I have a problem with encoding in acc with FFmpeg.I have au mp4 file with aac audio. I tried to copy the audio with ffmpeg.In the source mp4 file, the first audio noise appears at 0.30 seconds.After conversion using ffmpeg -i inputfile.mp4 -c:a copy outputfile.aac
, the resulting file is wrong, the first audio noise appears at 0.32 seconds.The duration of the file is not the same too.
当我强制将编码器设置为libfaac时,它可以工作,但是文件太大.
When i force the encoder to libfaac, it works but the file is too big.
那么,为什么在使用默认编码器(aac,libfdk_aac)时它不起作用?请注意,当我从audacity转换时,也会出现相同的情况.
So why it doesn't work when the default encoder is used (aac, libfdk_aac) ?Note that the same thing appears when i convert from audacity.
非常感谢
推荐答案
音频流中有一个填充帧,解码器需要此填充帧才能解码第一帧.这是MDCT音频编解码器(如AAC)的技术要求.在定时采样容器(如MP4/MKV)中,该第一帧的显示时间戳为负.在原始AAC比特流中,该第一帧被天真的解码.每个帧有1024个样本,因此持续时间为21-23毫秒.您时间上的差异是由于该偏移量造成的.重新包装到M4A之类的容器中,以免发生这种情况.
There is a padding frame in the audio stream which is needed by the decoder in order to decode the first frame. This is technical requirement of MDCT audio codecs like AAC. In a timed sample container like MP4/MKV, that first frame has a negative presentation timestamp. In a raw AAC bitstream, that first frame is naively decoded. Each frame has 1024 samples and so has a duration of 21-23 ms. Your difference in timing is due to that offset. Rewrap to a container like M4A to avoid this.
从 Apple :
和
这篇关于在AAC中转换后ffmpeg音频文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!