concat

FFmpeg has three concat methods.

concat protocol

ffmpeg -i 'concat:input1|input2' -codec copy output

concat video filter

ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv \
  -filter_complex '[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v] [a]' \
  -map '[v]' -map '[a]' output.mkv

concat demuxer

$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

$ ffmpeg -f concat -i mylist.txt -c copy output

Which one to use

  • concat protocol: use with formats that support file level concatenation (MPEG-1, MPEG-2 PS, DV).
  • concat filter: use if you need to re-encode such as when applying filters.
  • concat demuxer: use when you want to avoid a re-encode and your format does not support file level concatenation.

If in doubt try the concat demuxer.

Source: https://stackoverflow.com/questions/7333232/concatenate-two-mp4-files-using-ffmpeg

screenrecording

HandBrake presets

ffmpeg -f x11grab -video_size 1920x1080 -framerate 25 -i :0.0 \
	-f pulse -ac 2 -i default \
	-codec:v libx265 -crf 22 -x265-params strong-intra-smoothing=0:rect=0 \
	-codec:a libfdk_aac -b:a 160k \
	output.mkv
ffmpeg -f x11grab -video_size 1920x1080 -framerate 25 -i :0.0 \
	-f pulse -ac 2 -i default \
	-codec:v libx264 -crf 22 \
	-codec:a libfdk_aac -b:a 160k \
	output.mkv

from https://unix.stackexchange.com/questions/73622/how-to-get-near-perfect-screen-recording-quality

ffmpeg -f x11grab -video_size 1920x1080 -framerate 25 -i :0.0 \
	-f pulse -ac 2 -i default \
	-codec:v libx264 -preset ultrafast -crf 0 -pix_fmt yuv444p \
	-codec:a libfdk_aac -b:a 160k \
	output.mkv

nvenc

ffmpeg -f x11grab -video_size 1920x1080 -framerate 25 -i :0.0 
	-f pulse -ac 2 -i default \
	-codec:v h264_nvenc -preset hq -level 4.1 -profile high -rc constqp -qp 17 \
	-codec:a libfdk_aac -b:a 160k \
	output.mkv