合并(视频和声音)与(背景音乐)

时间:2016-11-27 07:51:37

标签: ffmpeg

我有视频文件vid.mpg,其中包含视频和音频(口语)以及包含背景音乐的音频文件aud.wav。

现在,我想将它们合并在一起。

这是我使用的命令:

public ConceptIntersection(List<Concept> l) throws Exception {
    if(l.size()>1) {
        this.list = new ArrayList<>(l);
    } else {
        throw new Exception("Intersection needs at least two concepts!");
    }
}

这是我得到的错误:

ffmpeg -i vid.mpg -i aud.mp3 -c:v copy  -filter_complex "[0:a]aformat = fltp:44100:stereo,apad[0a];[1]aformat=fltp:44100:stereo,volume=0.1[1a];[0a][1a]amerge[a]" -map 0:v -map "[a]" -ac 2 -t 0 out.mpg

另外我添加了完整的日志:

[Parsed_amerge_4 @ 00000000003a36e0] No channel layout for input 1
[Parsed_amerge_4 @ 00000000003a36e0] Input channel layouts overlap: output layou
t will be determined by the number of distinct input channels
[mpeg @ 000000000289a4e0] VBV buffer size not set, using default size of 130KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
我在做错了什么?我该如何解决呢?

请帮忙。

1 个答案:

答案 0 :(得分:0)

使用

ffmpeg -i vid.mpg -i aud.mp3 -c:v copy 
       -filter_complex
        "[0:a]aformat=fltp:44100:stereo,apad[0a];
         [1]aformat=fltp:44100:stereo,volume=0.1[1a];
         [0a][1a]amerge[a]" -map 0:v -map "[a]" -ac 2 -f dvd out.mpg

ffmpeg中的标准MPEG PS复用器是MPEG-1系统。对于MPEG-2,您需要指定-f dvd

在您发布的控制台输出中,该命令将aformat两次应用于同一输入,而不是全部应用于另一输入。这应该解释布局警告。