How to concatenate flv file into one? [closed]

2020-06-29 01:13发布

问题:

There is a file named input.txt

file '/home/1.flv'
file '/home/2.flv'

I can use the command to Concatenate 1.flv and 2.flv into a mp4 file.

# there are two files in output.mp4
ffmpeg -f concat -i input.txt -c copy output.mp4

When i use the following command

ffmpeg -i "concat:1.flv|2.flv" -c copy output.mp4

I found the there is only one file 1.flv in the output.mp4, why?

回答1:

I found the there is only one file 1.flv in the output.mp4. Why?

Your first command uses the concat demuxer. This can be used if you want to avoid re-encoding and when your inputs do not support file level concatenation. Using the demuxer requires that all files must have the same streams (same formats, same time base, etc.), but is a relatively recent addition so older ffmpeg builds will not have this feature.

Your second command uses the concat protocol which requires your inputs to support file level concatenation (such as MPEG-1 video, MPEG-2 video, and DV). These are two different methods of concatenating (or "joining" as it is often called by users).

Also see How to concatenate (join, merge) media files on the FFmpeg Wiki. I see you also asked this on ffmpeg-user where someone else also provided an answer: [FFmpeg-user] can't concatenate the flv file.