avconv: How to concatenate a bunch of flv files (h264 encoded video, adpcm_swf encoded audio)?

StackOverflow https://stackoverflow.com/questions/15977861

  •  03-04-2022
  •  | 
  •  

I want to concatenate some .flv files (each is h264/adpcm_swf encoded with the same settings). Ideally, I'd like to add something like a cut in between the files - a black screen for 1 or 2 seconds would suffice.

I've tried using avconv's "concat"-protocol, like this:

avconv -i concat:1.flv\|2.flv\|3.flv result.flv

That gives me a result, which contains only the contents of 1.flv and seems to be reencoded with the default flv-settings. That would be handable by giving appropriate output options, but in theory it should be possible to concatenate the files without much reencoding?

My avconv version:

avconv version 0.8.6-6:0.8.6-0ubuntu0.12.10.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:02:16 with gcc 4.7.2
avconv 0.8.6-6:0.8.6-0ubuntu0.12.10.1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 0
libpostproc  52.  0. 0 / 52.  0. 0
有帮助吗?

解决方案

You can use ffmpeg for this concatenating movies. First check if you have ffmpeg installed by running ffmpeg. If the first line ends with "the FFmpeg developers", you're fine. If it is "the Libav developers", then ffmpeg is secretly an alias to avconv (this is the case on Ubuntu). If you don't have ffmpeg and the real ffmpeg is not in your repository, you have to compile ffmpeg yourself.

Now that you have the real ffmpeg, create the file inputs.txt with the following text:

file 1.flv
file 2.flv
file 3.flv

and run:

ffmpeg -f concat -i inputs.txt -c copy result.flv

其他提示

Another way to concatenate files with ffmpeg without the need of store all the filenames in txt file is the following:

ffmpeg -f concat -i <(for f in *.flv; do echo "file '$f'"; done) -c copy result.flv

You could replace *.flv with whatever filetype you want. In that case do not forget to change the extension of the result file too.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top