Opened 2 months ago
Last modified 2 months ago
#11211 new defect
"select" filter behavior regression (4.4.2 ~)
Reported by: | John | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | 7.0 | Keywords: | select regression |
Cc: | MasterQuestionable | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
On ffmpeg 4.4.2-0ubuntu0.22.04.1 the following command executes correctly and generates a thumbnail atlas matching the given video
On ffmpeg 7.0 the exact same command misses the first 40 seconds of the video entirely
ffmpeg -y -i http://xxx.xxx.xxx.xxx/mega/95026a66a4bc129643911e37d4c9e485.mp4 -vf select='eq(n\,0)+not(mod(t\,10))',scale=160:-1,tile=5x88 -frames:v 1 -q:v 2 ./thumbnails_test/95026a66a4bc129643911e37d4c9e485_atlas.jpg
How to reproduce:
Run the command on different versions of ffmpeg
% ffmpeg -y -i http:/xxx.xxx.xxx.xxx/mega/95026a66a4bc129643911e37d4c9e485.mp4 -vf select='eq(n\,0)+not(mod(t\,10))',scale=160:-1,tile=5x88 -frames:v 1 -q:v 2 ./thumbnails_test/95026a66a4bc129643911e37d4c9e485_atlas.jpg ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11 (Ubuntu 11.2.0-19ubuntu1) ffmpeg version 7.0 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
Attachments (7)
Change History (16)
by , 2 months ago
Attachment: | 95026a66a4bc129643911e37d4c9e485_atlas.jpg added |
---|
comment:1 by , 2 months ago
Cc: | added |
---|---|
Component: | ffmpeg → avfilter |
Keywords: | select regression added; ffmpeg thumbnail Version removed |
Summary: | Select incorrect in newer ffmpeg version → "select" filter behavior regression (4.4.2 ~) |
͏ Effective:
͏ "select='eq( n, 0 ) + not( mod( t, 10 ) )'"
͏ See also:
͏ https://ffmpeg.org/ffmpeg-filters.html#select
͏ Documentation too vague: unable to tell exact meaning.
͏ But likely the example is misuse: "expr" seems to expect something like boolean, mostly.
͏ (but with strange implementation to handle sort of eerie stream mapping...)
comment:2 by , 2 months ago
͏ Try input with ͏"testsrc2":
͏ ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "testsrc2=r=1:d=30" -vf "select='eq( n, 0 ) + not( mod( t, 10 ) )'" -compression_level 1 -pred none -pix_fmt rgb24 "%d.png"
͏ The "eq( n, 0 ) +
" part appears unnecessary.
͏ Removing only caused the difference for Frame #1:
-[Parsed_select_0] n:0.000000 pts:0.000000 t:0.000000 key:1 interlace_type:P pict_type:I scene:nan -> select:1.000000 select_out:0
+[Parsed_select_0] n:0.000000 pts:0.000000 t:0.000000 key:1 interlace_type:P pict_type:I scene:nan -> select:2.000000 select_out:0
͏ .
͏ And such difference doesn't seem to matter.
comment:3 by , 2 months ago
͏ I guess it's the PTS somehow disappeared.
͏ As observed in my debugging of various medias:
͏ "best_effort_timestamp" variant should be used as "pts".
͏ "pts" maybe absent for certain medias. (or "dts", vice versa)
by , 2 months ago
Attachment: | testsrc_atlas.jpg added |
---|
output of testsrc=d=100:s=hd1080:r=25 seems correct
follow-up: 7 comment:4 by , 2 months ago
Apologies, but I do not understand how to proceed from here.
I know it's an issue as well with the media file but as it worked on the old ffmpeg version, what is the workaround to make it work on 7.0 as well?
comment:5 by , 2 months ago
Priority: | critical → normal |
---|
I'd start with checking the frame pts values in the old and the new version. You can use the showinfo filter to do that.
by , 2 months ago
Attachment: | speech2.txt added |
---|
older ffmpeg version result of : ffmpeg -i 95026a66a4bc129643911e37d4c9e485.mp4 -vf showinfo -f null - 2> frame_info.txt
by , 2 months ago
Attachment: | speech3.txt added |
---|
newer ffmpeg version result of : ffmpeg -i 95026a66a4bc129643911e37d4c9e485.mp4 -vf showinfo -f null - 2> frame_info.txt
comment:6 by , 2 months ago
͏ Try the description here:
͏ https://trac.ffmpeg.org/attachment/ticket/11052/sample.mp4.xml
͏ Name the output:
͏ "4.4.2.xml"
͏ "7.0.xml"
͏ Supposedly the first 60 s of each shall be of interest.
͏ ----
͏ Using "-v debug" may also cause the command to output debug information of "select".
͏ (displayed in comment:2)
comment:7 by , 2 months ago
͏ "What is the workaround to make it work on 7.0 as well?"
͏ Afraid... no. Besides fixing the filter.
͏ ("select" seems to use undesirable interpretation of "pts", "t" alike)
by , 2 months ago
by , 2 months ago
comment:8 by , 2 months ago
I have attached the two xml files from running the following command:
ffprobe -v warning -hide_banner -threads 0 -show_entries frame -select_streams v:0 -of xml -read_intervals 0%+60 "95026a66a4bc129643911e37d4c9e485.mp4" > "output.xml"
comment:9 by , 2 months ago
͏ The diff indicated nothing interesting.
͏ Which means the decoding shall be much similar between the versions.
͏ Try "-v debug" on your original command and see what "select" reports.
͏ Also try removing the "eq( n, 0 ) +
" part.
This is from the older ffmpeg version and it's correct