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

前端 未结 10 876
逝去的感伤
逝去的感伤 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:19

    Concat demuxer

    The concat demuxer was added to ffmpeg 1.1. If your version of ffmpeg is to old, get the newest static binary from here: http://www.ffmpeg.org/download.html

    Instructions

    Create a file mylist.txt with all the files you want to have concatenated in the following form (Lines starting with a dash are ignored):

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

    Note that these can be either relative or absolute paths. Then you can encode your files with:

    ffmpeg -f concat -i mylist.txt -c copy output
    

    It is possible to generate this list file with a bash for loop, or using printf. Either one of the following would generate a list file containing every *.wav in the working directory:

    for f in ./*.wav; do echo "file '$f'" >> mylist.txt; done
    printf "file '%s'\n" ./*.wav > mylist.txt
    

    Source: ffmpeg wiki

提交回复
热议问题