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)

95026a66a4bc129643911e37d4c9e485_atlas.jpg (2.0 MB ) - added by John 2 months ago.
This is from the older ffmpeg version and it's correct
new.jpg (2.0 MB ) - added by John 2 months ago.
This is from the newer version and it's wrong
testsrc_atlas.jpg (61.5 KB ) - added by John 2 months ago.
output of testsrc=d=100:s=hd1080:r=25 seems correct
speech2.txt (2.1 MB ) - added by John 2 months ago.
older ffmpeg version result of : ffmpeg -i 95026a66a4bc129643911e37d4c9e485.mp4 -vf showinfo -f null - 2> frame_info.txt
speech3.txt (1.9 MB ) - added by John 2 months ago.
newer ffmpeg version result of : ffmpeg -i 95026a66a4bc129643911e37d4c9e485.mp4 -vf showinfo -f null - 2> frame_info.txt
4.4.2.xml (819.9 KB ) - added by John 2 months ago.
7.0.xml (802.4 KB ) - added by John 2 months ago.

Change History (16)

by John, 2 months ago

This is from the older ffmpeg version and it's correct

by John, 2 months ago

Attachment: new.jpg added

This is from the newer version and it's wrong

comment:1 by MasterQuestionable, 2 months ago

Cc: MasterQuestionable added
Component: ffmpegavfilter
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 MasterQuestionable, 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 MasterQuestionable, 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 John, 2 months ago

Attachment: testsrc_atlas.jpg added

output of testsrc=d=100:s=hd1080:r=25 seems correct

comment:4 by John, 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 Marton Balint, 2 months ago

Priority: criticalnormal

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 John, 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 John, 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 MasterQuestionable, 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)

Last edited 2 months ago by MasterQuestionable (previous) (diff)

in reply to:  4 comment:7 by MasterQuestionable, 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 John, 2 months ago

Attachment: 4.4.2.xml added

by John, 2 months ago

Attachment: 7.0.xml added

comment:8 by John, 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 MasterQuestionable, 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.

Note: See TracTickets for help on using tickets.