ffmpeg: adding blankspace to end of video I'm trying to add blankspace to the end of a video (1 audio stream, 1 video stream) using ffmpeg. I'm curious what the best way of doing this is. I'm not very keen on using filter_complex so if there's another simple/viable method, that would be good. I've been trying to use the color filter using the command below, it's making a video with bad timestamps though. On playback it freezes in various parts of the blankspaced segment, my command is missing something.

ffmpeg -i input.mkv -filter_complex "color=black:s=1280x720:d=15[b0];[0:v][b0]concat=n=2:v=1:a=0" output.mkv


I receive the green/yellow message below at the point where it starts to render the black frames.

[Parsed_color_0 @ 0000000922e0fd900] EOF timestamp not reliable


This method is effectively making another video and concatenating it to the first one. I'm wondering if in general: Can you create frames in an existing video...? Or is that outside of how ffmpeg works?
Method 1: concat demuxer


Pros: Avoids re-encoding the main video and therefore preserves quality since it is stream copied. Fast.
Cons: Requires several steps. Harder to get right, because the blank video needs to have the same attributes as the main video.


Make the black video using same attributes and same number and type of streams as the main input. This example makes a 15 second black video, frame rate of 24, size is 1280x720:

 ffmpeg -f lavfi -i color=c=black:s=1280x720:r=24:d=15 black.mkv


Make input.txt. The order in this text file determines the order that they will appear when concatenating.

file 'main.mkv'
file 'black.mkv'


Concatenate:

ffmpeg -f concat -i input.txt -c copy output.mkv




Method 2: concat filter


Pro: Can all be done in one command.
Con: Filtering requires encoding, so no stream copying of the main video as in the concat demuxer. Some attributes must still be matched.


Use the color source filter to make the 15 second, 24 fps, 1280x720 black video and append it to the end of the main video with the concat filter:

ffmpeg -i main.mkv -filter_complex "color=c=black:s=1280x720:r=24:d=15[black];[0:v][black]concat=n=2:v=1:a=0[v]" -map "[v]" output.mkv


If you prefer the black to be at the beginning instead then switch the order for the concat filter inputs, such as [black][0:v]concat….



Method 3: tpad and apad filters


Pro: Easy. No need to match any attributes.
Cons: Filtering requires encoding, so no stream copying of the main video as in the concat demuxer. Relatively new filters: use FFmpeg 4.2 or newer, or even better use a build from the current git master branch.


Append 15 seconds of black video to the end of the main video:

ffmpeg -i main.mkv -filter_complex "tpad=stop_duration=15" output.mkv


If you want it at the beginning instead use start_duration instead of stop_duration. If you want to clone the frames instead, or want a different color than black then refer to the tpad filter documentation.