合并后的Mp4里解析出音频的Duration问题

网友投稿 825 2022-05-30

网上有很多的流视频,可以获取到批量的ts文件后,使用ffmpeg用concat的格式用copy编码方式进行合并为Mp4文件。

这里有个问题就碰到我了,

将mp4文件用copy编码的方式,分离出aac音频文件。

问题是:mp4文件,和aac文件,用ffprobe显示的duration咋就不一样了呢?

MP4,时长显示34分57秒

AAC文件,时长显示14小时28分,不过它说了,这个是从bitrate估算的,不准确。我可以负责任的说,这个duration就是错误的。

bitrate也变了,我感觉这个不多。

合并后的Mp4里解析出音频的Duration问题

播放这个aac文件时,从播放器里看,时长也是14个小时。

那么,我们怎么看它的正确时长呢?先看下官方文档

From ffmpeg documention:

Get duration by decoding

You can also use ffmpeg to get the duration by fully decoding the file. The null muxer is used so no output file is created. Refer to time= in the last line of the console output. In this example the input has a duration of 00:57:28.87.

$ ffmpeg -i input.webm -f null - ... frame=206723 fps=1390 q=-0.0 Lsize=N/A time=00:57:28.87 bitrate=N/A speed=23.2x

This method will report the correct duration in case the methods using ffprobe are incorrect or missing due to corrupt, truncated, or damaged files.

The command may take some time depending on the input file duration and decoding complexity.

我们用这个命令试一下:34分52秒,比较正确了。

加上-c copy会更快得到结果,结果也很接近准确值。

AAC只是猜测,他不包含准确的duration信息。这个问题呢,可以感到疑惑,但是到此为止可以不再纠结,

转换为m4a就好啦!duration准准的!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:【Android 逆向】Android 逆向工具 ( Apktool | IDA | Python )
下一篇:Python Module — WSME
相关文章