Opened 17 months ago
Closed 10 months ago
#11366 closed defect (fixed)
Regression when prepending/concatenating still image to video
| Reported by: | mahozad | Owned by: | |
|---|---|---|---|
| Priority: | important | Component: | avfilter |
| Version: | 7.1 | Keywords: | concat concatenate filter_complex regression |
| Cc: | mahozad, MasterQuestionable | Blocked By: | |
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
Summary of the bug:
I'm using FFmpeg to create clips with ability to concat an image to be shown at the start of the clip for the specified duration: https://github.com/mahozad/cutcon
It uses FFmpeg CLI.
FFmpeg version 6.1.1 (and I think also version 5.1.2) worked as expected. When upgrading to FFmpeg 7.1, the result video just contains the intro image and then just ends.
I'm not sure if this is a regression. Maybe my FFmpeg command is "wrong" and it should have failed in previous versions as well?
How to reproduce:
FFmpeg 7.1 and also FFmpeg-full 2024-12-19-git-494c961379 downloaded from https://www.gyan.dev/ffmpeg/builds/
both tested on Windows 11.
Here is an example FFmpeg invocation (formatted, each option in a new line) to reproduce the problem.
It tries to create a clip from an input MP4 file and show an image at the start for 8 seconds. The image size is coerced to be at maximum the size of video and is padded with black color if its aspect ratio is different than the video. There is some other filters too.
path/to/ffmpeg.exe
-y
-nostdin
-loglevel
info
-stats_period
0.1s
-accurate_seek
-ss
356500ms
-to
378500ms
-i
path/to/a/video.mp4
-loop
1
-framerate
25
-t
8s
-i
path/to/a/picture.jpg
-t
8s
-f
lavfi
-i
aevalsrc=0
-filter_complex
[0] yadif=1 [media-de-interlaced];
[media-de-interlaced] scale=iw*sar:ih [media-anamorphic-fixed];
[media-anamorphic-fixed] pad=ceil(iw/2)*2:ceil(ih/2)*2 [media-odd-pixel-number-fixed];
[media-odd-pixel-number-fixed] setsar=1/1 [media-source-aspect-ratio-normalized];
[media-source-aspect-ratio-normalized] null [media];
[1][media] scale2ref='if(gt(main_a,a),min(main_w,iw),min(main_h,ih)*main_a)':'if(gt(main_a,a),min(main_w,iw)/main_a,min(main_h,ih))' [intro-image-max-size-coerced][media];
[1][media] scale2ref=iw:ih [size-template][media];
[size-template] drawbox=w=iw:h=ih:t=fill:color=#000000 [intro-background];
[intro-background][intro-image-max-size-coerced] overlay=x='(W-w)/2':y='(H-h)/2' [intro-with-background];
[intro-with-background] setsar=1/1 [intro-source-aspect-ratio-normalized];
[intro-source-aspect-ratio-normalized] null [intro];
[intro][2][media] concat=n=2:v=1:a=1
-c:v
libx264
-c:a
aac
-crf
23
-r
25
-metadata
encoding_tool=Cutcon v1.2.3
path/to/output.mp4
Change History (4)
comment:1 by , 17 months ago
| Cc: | added |
|---|---|
| Component: | undetermined → avfilter |
comment:2 by , 17 months ago
OK. So simplifying only the filter to the below still does not work:
-filter_complex
[0] null [media];
[1][media] scale2ref='if(gt(main_a,a),min(main_w,iw),min(main_h,ih)*main_a)':'if(gt(main_a,a),min(main_w,iw)/main_a,min(main_h,ih))' [intro-image-max-size-coerced][media];
[intro-image-max-size-coerced] null [intro];
[intro][2][media] concat=n=2:v=1:a=1
But simplyfing it even more does work:
-filter_complex
[0] null [media];
[1] null [intro];
[intro][2][media] concat=n=2:v=1:a=1
comment:4 by , 10 months ago
| Keywords: | regression added |
|---|---|
| Priority: | normal → important |
| Resolution: | → fixed |
| Status: | new → closed |
Fixed in a736ac72bb2e457484724f0589fd11a2b2b5f852.



͏ Probably relevant:
͏ https://trac.ffmpeg.org/ticket/11257#comment:3
͏ ("scale2ref" removed..?)
͏ Try removing various options to ascertain the minimal reproducible.