

I generated two MP4 files - a five-second intro file, which is created by the script below, and the main video (about one minute long) is created by screen-cast-omatic, both in MP4 format. It does not matter how your two sections input are produced.

ffmpeg -i title -i main -y -filter_complex ' setsar=1/1 concat=n=2:v=1:a=0 ' -map '' -pass 1 -strict -2 -an -vcodec libx264 -pix_fmt yuv420p -aspect 16:9 -threads 4 -b:v 2400k -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 1 -trellis 0 -refs 1 -bf 3 -b_strategy 2 -coder 1 -me_range 16 -g 250 -keyint_min 75 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 output.mp4įfmpeg -i title -i main -y -filter_complex ' setsar=1/1 concat=n=2:v=1:a=1 ' -map '' -map '' -strict -2 -acodec aac -b:a 128k -pass 2 -vcodec libx264 -pix_fmt yuv420p -aspect 16:9 -threads 4 -b:v 2400k -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -mixed-refs 1 -subq 6 -trellis 1 -refs 5 -bf 3 -b_strategy 2 -coder 1 -me_range 16 -g 250 -keyint_min 75 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 output.mp4 That will re-encode all, but will produce stable results. Do not use the concat demuxer or concat protocol when the source files may have different codecs or other differences.
