分割音频后拼接音频中的FFmpeg间隙 [英] FFmpeg gap in concatenated audio after splitting audio

查看:141
本文介绍了分割音频后拼接音频中的FFmpeg间隙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道如果它是一个差距或者是对齐音频样本,但是当我将一个音频文件分成两个,如下所示:

Not sure if it's a gap or just misaligned audio samples, but when i split an audio file in two, like this:

ffmpeg -ss 0 -t 00:00:15.00 -i song.mp3 seg1.mp3

ffmpeg -ss 00:00:15.00 -t 15 -i song.mp3 seg2.mp3

然后再次使用concat过滤器:

and then combine them again with concat filter:

ffmpeg -i 'concat:seg1.mp3|seg2.mp3' out.mp3

段之间有一个独特的pop。我如何使这个无缝?

There is a distinct "pop" between the segments. How can i make this seamless?

我在seg2.mp3上看到这个:

I see this on seg2.mp3:

Duration: 00:00:15.05, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s

为什么开始不是0?这可能是差距。

Why is "start" not 0? That could be the gap.

推荐答案

如果你想消除差距,我建议使用 atrim concat 过滤器:

If you want to eliminate the gap I recommend using the atrim and concat filters:

ffmpeg -i input -filter_complex \
"[0:a]atrim=end=15[a0]; \
 [0:a]atrim=start=15:end=30[a1]; \
 [a0][a1]concat=n=2:v=0:a=1" \
output.mp3

请注意 MP3文件可能在开始和结束时有静音/延迟,因此使用单独编码的段是不理想。

Note that MP3 files may have silence/delay at the beginning and end, so using individually encoded segments is not ideal.

这篇关于分割音频后拼接音频中的FFmpeg间隙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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