使用FFMPEG导出具有空白的音频 [英] Use FFMPEG to export audios with gaps filled

查看:155
本文介绍了使用FFMPEG导出具有空白的音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MKV文件,音频中有间隙.也就是说,MKV音频轨道时间戳中存在间隙.根据"ffmpeg",AC3音频长度为802秒,但是将音频导出到WAV时,结果文件长度为801'53秒.也就是说,导出"的音频更短.

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.

通过

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

我的问题是:如何指示FFMPEG保留原始音频中的间隙(零(静音)填充)?WAV文件的持续时间应与原始AC3音频相同.

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.

鉴于我当前的工作流程,我宁愿不要将原始时间戳记保留在输出文件中,而是生成带有(微小)静默的WAV.如果没有其他选择,我可以考虑保留时间戳,但这在我的工作流程中可能会很痛苦.

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.

建议?帮助吗?

非常感谢!

推荐答案

使用

ffmpeg -i INPUT.mkv -map 0:1 -af aresample=async=1 -ac 2 OUTPUT.wav

aresample过滤器将在间隔内插入无声样本.

The aresample filter will insert silent samples within the gaps.

这篇关于使用FFMPEG导出具有空白的音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆