FFMPEG overlay needs “repeatlast” argument…

August 17, 2016 | Video | By: Mark VandeWettering

I use ffmpeg to add some information overlays to the videos that I often upload to YouTube. I’ve documented these before, but I had a problem that arose from time to time that I never figured out: occasionally my encodes would seemingly just go on forever, and never terminate. I discovered today that this was because the use of the “overlay” filter. It apparently keeps generating frames even after the main stream has terminated, which seems odd to me, but… whatever. If you add the repeatlast argument, you’ll get what you want.

Stashed here for reference later.

ffmpeg -y -f concat -i files.txt -movflags +faststart -aspect 16:9 -crf 24 \
	-vf "scale=854:480, fade=in:0:30, hqdn3d [xxx] ; \
	     color=0x33669955:854x64 [yyy] ; \
	     [xxx] [yyy] overlay=0:416:repeatlast=0, \
	     drawtext=textfile=hdr:fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:x=10:y=432:fontsize=16:fontcolor=white" \