audio - Use FFMPEG to export audios with gaps filled
问题描述
I have a MKV file with gaps in the audio. That is, there are gaps in the MKV audio track timestamps. According to "ffmpeg", the AC3 audio length is 802 seconds, but when exporting the audio to WAV, the resulting file length is 801'53 seconds. That is, the "exported" audio is shorter.
Triaging the issue with
ffmpeg -i INPUT.mkv -af ashowinfo -map 0:2 -y -frames:a XXXX -f alaw /dev/null
I can confirm that the length difference is consistent with gaps in the timestamps of the original audio frames. There are a handful of missing audio frames. I guess those are replaced by silence in the player.
The command I use to export the audio is:
ffmpeg -i INPUT.mkv -map 0:1 -ac 2 OUTPUT.wav
My question is: How can I instruct FFMPEG to preserve the gaps in the original audio, zero (silence) filled?. The WAV file duration should be the same than the original AC3 audio.
Given my current workflow, I would rather prefer to not keep the original timestamps in the output file but generate a WAV with (tiny) silences instead. I could consider keeping timestamps if there is no other choice, but this could be quite a pain in my workflow.
Advice? Help?
Thanks a lot in advance!
解决方案
利用
ffmpeg -i INPUT.mkv -map 0:1 -af aresample=async=1 -ac 2 OUTPUT.wav
aresample 过滤器将在间隙内插入无声样本。
推荐阅读
- r - 为什么我在 R 中的预测函数没有考虑到数据的上升趋势
- mysql - 如何通过查询从组中获取基于最新日期的最高价格
- php - imap_fetchbody 函数不获取所有电子邮件
- powershell - Powershell脚本创建运行干净的mgr而不删除压缩文件
- regex - 正则表达式只是字符串中的最后一个数字
- java - 带有原始数组的列表与带有对象数组的列表
- java - 如何在 Mockito 和 JUint 中模拟具有复杂请求的服务?
- sparql - 在时间范围内改进 SPARQL
- azure - 每个租户的 Azure 存储 Blob/文件
- java - 我们可以有一个工厂类作为spring bean,并有一个工厂方法根据条件返回多个spring bean吗?