Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From the <a href="http://ffmpeg.org/faq.html#How-can-I-join-video-files_003f" rel="nofollow">ffmpeg FAQ</a>:</p> <blockquote> <p>3.13 How can I join video files?</p> <p>A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by merely concatenating them.</p> <p>Hence you may concatenate your multimedia files by first transcoding them to these privileged formats, then using the humble cat command (or the equally humble copy under Windows), and finally transcoding back to your format of choice.</p> <p>ffmpeg -i input1.avi -same_quant intermediate1.mpg ffmpeg -i input2.avi -same_quant intermediate2.mpg cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg ffmpeg -i intermediate_all.mpg -same_quant output.avi Notice that you should either use -same_quant or set a reasonably high bitrate for your intermediate and output files, if you want to preserve video quality.</p> <p>Also notice that you may avoid the huge intermediate files by taking advantage of named pipes, should your platform support it:</p> <p>mkfifo intermediate1.mpg mkfifo intermediate2.mpg ffmpeg -i input1.avi -same_quant -y intermediate1.mpg &lt; /dev/null &amp; ffmpeg -i input2.avi -same_quant -y intermediate2.mpg &lt; /dev/null &amp; cat intermediate1.mpg intermediate2.mpg |\ ffmpeg -f mpeg -i - -same_quant -c:v mpeg4 -acodec libmp3lame output.avi Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also allow concatenation, and the transcoding step is almost lossless. When using multiple yuv4mpegpipe(s), the first line needs to be discarded from all but the first stream. This can be accomplished by piping through tail as seen below. Note that when piping through tail you must use command grouping, { ;}, to background properly.</p> <p>For example, let’s say we want to join two FLV files into an output.flv file:</p> <p>mkfifo temp1.a mkfifo temp1.v mkfifo temp2.a mkfifo temp2.v mkfifo all.a mkfifo all.v ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a &lt; /dev/null &amp; ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a &lt; /dev/null &amp; ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v &lt; /dev/null &amp; { ffmpeg -i input2.flv -an -f yuv4mpegpipe - &lt; /dev/null | tail -n +2 > temp2.v ; } &amp; cat temp1.a temp2.a > all.a &amp; cat temp1.v temp2.v > all.v &amp; ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \ -f yuv4mpegpipe -i all.v \ -same_quant -y output.flv rm temp[12].[av] all.[av]</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload