I have three videos that I am concatenating with ffmpeg. I would like to add a few black frames in between them. Although I've found a few hints on the web it has not worked for me yet. I have tried to generate an 'empty' video with just black frames with:

ffmpeg -t 20 -s 1920x1080 -f rawvideo -pix_fmt rgb24 -r 25 -i c:\nul E:\empty.avi 

and then concatenate with another one but doesn't work. I have tried a few other things without success. Any help would be greatly appreciated

EDIT: also tried to add black frames before and after video with the following code, but no success:

ffmpeg -f lavfi -i color=c=black:s=1920x1080:r=25:d=100 -i middle_video.avi -filter_complex "[0:v]trim=start_frame=1:end_frame=21[blackstart]; [0:v] trim=start_frame=1:end_frame=21 [blackend]; [blackstart] [1:v] [blackend] concat=n=3:v=1:a=0[out]" -map "[out]" -c:v qtrle -c:a -copy output.avi 

EDIT2: Output from ffprobe

Metadata: encoder: Lavf57.3.100 Duration: 00:00:10.05, start: 0.000000, bitrate: 43302 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 192 0x1080 [SAR 1:1 DAR 16:9], 43333 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 10k tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 k b/s 

EDIT 3 Link to the report of the ffmpeg console output: FFMPEG session report

4

1 Answer

#1 Generate your blank video

ffmpeg -f lavfi -i color=black:s=1920x1080:r=24000/1001 -f lavfi -i anullsrc \ -ar 48000 -ac 2 -t 20 empty.avi 

#2 Prepare a text file with list of files

file '1.avi' file 'empty.avi' duration 1 file '2.avi' file 'empty.avi' duration 1 file '3.avi' 

#3 Concat

ffmpeg -f concat -i list.txt -c:v qtrle -c:a copy joined.avi 

The above assumes that all 3 videos have the same properties as shown in the ffprobe readout. You can control the duration of the blank segment using the duration argument in the textfile (currently 1 second). Only upto the duration of empty.avi, of course.

8

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy