ffmpeg: Combine/merge multiple mp4 videos not working, output only contains the first video

前端 未结 10 871
逝去的感伤
逝去的感伤 2020-12-22 22:48

Here is the command I am using to combine multiple videos:

ffmpeg -i 75_540_38HQ2.mp4 -i 76_70_20.mp4 -i 76_173_80.mp4 -i 81_186_35.mp4 -vcodec copy -acodec copy M         


        
10条回答
  •  独厮守ぢ
    2020-12-22 23:26

    As found here, you have a few options:

    1. concat protocol:

    ffmpeg -i "concat:input1.ts|input2.ts|input3.ts" -c copy output.ts
    

    2. concat filter:

    this one I don't fully understand, you probably need to look at all the diagrams and filter graphs, but it lets you deal with multiple formats and differing codec properties

        ffmpeg -i input1.mp4 -i input2.webm -i input3.mov \
    -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]" \
    -map "[outv]" -map "[outa]" output.mkv
    

    3. concat demuxer:

    First, you need to generate a list file of some sort, eg. "mylist.txt"

        # this is a comment
        file '/path/to/file1.wav'
        file '/path/to/file2.wav'
        file '/path/to/file3.wav'
    

    Second, you need to run a command to use the list

    ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.wav
    

提交回复
热议问题