使用ffmpeg与-itsoffset合并的mp3音频:无效果 [英] mp3 audio merging with -itsoffset using ffmpeg: no effect

查看:321
本文介绍了使用ffmpeg与-itsoffset合并的mp3音频:无效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ffmpeg合并节点服务器中的mp3.它有效,但是偏移量没有任何作用. 我看不出有什么问题,然后想得到您的帮助:)

I use ffmpeg to merge mp3's in my node server. It works but the offset doesn't have any effect.. I can't see what is wrong then i'd like to get your help :)

var command = "ffmpeg -i "+ input1+ " -itsoffset 40 -i " + input2 +" -filter_complex amerge -c:a libmp3lame -q:a 4 "+ output;

        exec(command, function (error, stdout, stderr) {
            if (stdout) console.log(stdout);
            if (stderr) console.log(stderr);

            if (error) {
                console.log('exec error: ' + error);
                response.statusCode = 404;
                response.end();

            } else {
                // Do something
            }

        });

我也在终端上的计算机上尝试了它,并且它也可以解决相同的问题.

I tried it also on my computer just in the terminal and it also works with the same problem..

谢谢, 伊扎克

推荐答案

可以使用无声音频添加到音频的开头,而不必使用itsoffset.假设我们要合并三个音频,每个音频的时长为10秒.因此,您可以按以下方式添加无声音频.

Instead of using itsoffset you can append a silent audio to the beginning of the audio. Assume we have three audios to be merged each of 10 sec long. So you can append silent audio as follows.

  • 第一个音频:没有无声音频
  • 第二音频:将10秒钟的静音音频添加到开头
  • 第三音频:在开始时附加(10秒)x 2静音音频

在那里,您可以将所有这些音频混合在一起.要创建无声音频,可以使用 aevalsrc 过滤器和filter_complex.以下将适用于上面的示例.

There after you can mix all these audios together. To create a silent audio you can use aevalsrc filter with filter_complex. Following will work for the above example.

ffmpeg -i 0.mp3 -i 1.mp3 -i 2.mp3 -filter_complex 
"aevalsrc=0:d=10[s1];
aevalsrc=0:d=20[s2];
[s1][1:a]concat=n=2:v=0:a=1[ac1];
[s2][2:a]concat=n=2:v=0:a=1[ac2];
[0:a][ac1][ac2]amix=3[aout]" -map [aout] out.mp3

此处[s1][s2]是第二和第三输入音频流的相应静音音频源.然后,将使用 concat 过滤器将每个无声源与相应的音频流串联在一起.最后,所有串联的音频将使用 amix 过滤器进行混合.

Here [s1] and [s2] are the corresponding silent audio source for second and third input audio streams. Then each silent source will be concatenated with there corresponding audio streams using concat filter. Finally all concatenated audios will be mixed using amix filter.

否则,您可以尝试 amerge

Else you can try amerge and adelay where doc itself has a clear explanation.

希望这会有所帮助!

这篇关于使用ffmpeg与-itsoffset合并的mp3音频:无效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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