Se os vídeos forem codificados usando os mesmos codecs, você poderá utilizar o operador concat
.
If you have media files with exactly the same codec and codec parameters you can concatenate them as described in "Concatenation of files with same codecs". If you have media with different codecs you can concatenate them as described in "Concatenation of files with different codecs" below.
$ cat build_ffmpegs.bash
#!/bin/bash
intro=/home/intro/play.mp4
outro=/home/intro/play.mp4
cd /home/vid
for i in vid*; do
ffmpeg -f concat -safe 0 \
-i < <(printf "file '%s'\n" $intro $(readlink -f $i) $outro) \
-c copy /home/vid2/output_${i}
done
Executar isso gerará ffmpeg
comandos assim:
ffmpeg -f concat -safe 0 -i < <(printf "file '%s'\n" /home/intro/play.mp4 /home/vid/vid1.mp4 /home/intro/play.mp4) -c copy /home/vid2/output_vid1.mp4
ffmpeg -f concat -safe 0 -i < <(printf "file '%s'\n" /home/intro/play.mp4 /home/vid/vid2.mp4 /home/intro/play.mp4) -c copy /home/vid2/output_vid2.mp4
ffmpeg -f concat -safe 0 -i < <(printf "file '%s'\n" /home/intro/play.mp4 /home/vid/vid3.mp4 /home/intro/play.mp4) -c copy /home/vid2/output_vid3.mp4
ffmpeg -f concat -safe 0 -i < <(printf "file '%s'\n" /home/intro/play.mp4 /home/vid/vid4.mp4 /home/intro/play.mp4) -c copy /home/vid2/output_vid4.mp4
ffmpeg -f concat -safe 0 -i < <(printf "file '%s'\n" /home/intro/play.mp4 /home/vid/vid5.mp4 /home/intro/play.mp4) -c copy /home/vid2/output_vid5.mp4
Você deve ser capaz de adaptar os comandos ffmpeg
para qualquer outro detalhe que você precisar daqui.