Hi Gavin this patch breaks decoding a video with a single image:
this works and creates our single image video
./ffmpeg -i lena.pnm /tmp/file.m2v
this fails after the patch:
./ffmpeg -i /tmp/file.m2v /tmp/file.jpg -y
[image2 @ 0x60dca024f140] Cannot write more than one file with the same name.
Are you missing the -update option or a sequence pattern?
[vost#0:0/mjpeg @ 0x60dca024f3c0] Error submitting a packet to the muxer:
Invalid argument
Last message repeated 1 times
[out#0/image2 @ 0x60dca024f040] Error muxing a packet
[out#0/image2 @ 0x60dca024f040] Task finished with error code: -22 (Invalid
argument)
[out#0/image2 @ 0x60dca024f040] Terminating thread with return code -22
(Invalid argument)
[out#0/image2 @ 0x60dca024f040] video:375KiB audio:0KiB subtitle:0KiB other
streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 2 fps=0.0 q=5.0 Lsize=N/A time=00:00:00.04 bitrate=N/A dup=1 drop=0
speed=0.455x elapsed=0:00:00.08
Conversion failed!
This also breaks:
./ffmpeg -i https://trac.ffmpeg.org/raw-attachment/ticket/3923/frame16.h264
test.jpg
rawdec has a user parameter called framerate which is set to 25 by default.
If your input is not 25, obviously then it should not be set to 25.
Your change does not achive a fallback of 25 if it cannot be determined,
as clearly shown in the example above where our single frame is turned into
2 frames, clearly showing there is a new inconsistancy.
I suggest to revert this patch (to avoid creating more bugs by a rushed attempt
to
fix this) and attempt to fix your file by setting the user framerate parameter
correctly
Independant of this, making it autodetect would be cool, yes, i agree
but i think we need more time, testing and no regressions
there where also suspicous changes in fate below:
On Fri, Nov 28, 2025 at 02:55:58AM +0200, ffmpeg-git--- via ffmpeg-cvslog wrote:
[...]
> avformat/rawdec: set framerate in codec parameters
>
> Commit ba4b73c9779c32580f8a3ba08602a5d94e0bcd7c caused a regression in
> the usage of avg_frame_rate to detect the frame rate of raw h264/hevc
> bitstreams: after the commit, avg_frame_rate is always the value of the
> -framerate option (which is set to 25 by default) instead of the actual
> frame rate derived from the bitstream SPS/VPS NALUs.
>
> This commit fixes the regression by setting the framerate codec
> parameter to the value of the framerate option instead. After this
> change, bitstreams without timing information will derive avg_frame_rate
> from the -framerate option, while bitstreams with timing information
> will derive avg_frame_rate from the bitstream itself.
>
> The h264-bsf-dts2pts test now returns the correct frame durations for a
> bitstream with a mix of single-field and double-field frames.
>
> Signed-off-by: Gavin Li <[email protected]>
> Signed-off-by: James Almer <[email protected]>
>
> diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
> index d0c829dc42..5cf2764a0d 100644
> --- a/libavformat/rawdec.c
> +++ b/libavformat/rawdec.c
> @@ -83,9 +83,9 @@ int ff_raw_video_read_header(AVFormatContext *s)
>
> st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
> st->codecpar->codec_id = ffifmt(s->iformat)->raw_codec_id;
> + st->codecpar->framerate = s1->framerate;
> sti->need_parsing = AVSTREAM_PARSE_FULL_RAW;
>
> - st->avg_frame_rate = s1->framerate;
> avpriv_set_pts_info(st, 64, 1, 1200000);
>
> fail:
> diff --git a/tests/ref/fate/cavs-demux b/tests/ref/fate/cavs-demux
> index c4847293ab..eb16eb1f9d 100644
> --- a/tests/ref/fate/cavs-demux
> +++ b/tests/ref/fate/cavs-demux
> @@ -58,5 +58,5 @@
> packet|codec_type=video|stream_index=0|pts=2240000|pts_time=1.866667|dts=2240000
>
> packet|codec_type=video|stream_index=0|pts=2280000|pts_time=1.900000|dts=2280000|dts_time=1.900000|duration=40000|duration_time=0.033333|size=67|pos=172185|flags=___|data_hash=CRC32:42484449
>
> packet|codec_type=video|stream_index=0|pts=2320000|pts_time=1.933333|dts=2320000|dts_time=1.933333|duration=40000|duration_time=0.033333|size=83|pos=172252|flags=___|data_hash=CRC32:a941bdf0
>
> packet|codec_type=video|stream_index=0|pts=2360000|pts_time=1.966667|dts=2360000|dts_time=1.966667|duration=40000|duration_time=0.033333|size=5417|pos=172335|flags=___|data_hash=CRC32:9d0d503b
> -stream|index=0|codec_name=cavs|profile=unknown|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=1280|height=720|coded_width=1280|coded_height=720|has_b_frames=0|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=30/1|avg_frame_rate=25/1|time_base=1/1200000|start_pts=N/A|start_time=N/A|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=60|extradata_size=18|extradata_hash=CRC32:1255d52e|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:non_diegetic=
>
> 0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0
> +stream|index=0|codec_name=cavs|profile=unknown|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=1280|height=720|coded_width=1280|coded_height=720|has_b_frames=0|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=30/1|avg_frame_rate=30/1|time_base=1/1200000|start_pts=N/A|start_time=N/A|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=60|extradata_size=18|extradata_hash=CRC32:1255d52e|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:non_diegetic=
>
> 0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0
>
> format|filename=bunny.mp4|nb_streams=1|nb_programs=0|nb_stream_groups=0|format_name=cavsvideo|start_time=N/A|duration=N/A|size=177752|bit_rate=N/A|probe_score=51
> diff --git a/tests/ref/fate/enhanced-flv-hevc-hdr10
> b/tests/ref/fate/enhanced-flv-hevc-hdr10
> index 525f056d66..bebcf84fab 100644
> --- a/tests/ref/fate/enhanced-flv-hevc-hdr10
> +++ b/tests/ref/fate/enhanced-flv-hevc-hdr10
> @@ -4,7 +4,7 @@
> #codec_id 0: hevc
> #dimensions 0: 1280x720
> #sar 0: 0/1
> -0, 0, 0, 40, 77718, 0xb59c83a5
> +0, 0, 0, 0, 77718, 0xb59c83a5
> [FRAME]
The frame duration disappears here
[...]
> diff --git a/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
> b/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
> index 0303bc24e6..0a0795df41 100644
> --- a/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
> +++ b/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
> @@ -1,7 +1,7 @@
> -#tb 0: 1/25
> +#tb 0: 1/50
> #media_type 0: video
> #codec_id 0: rawvideo
> #dimensions 0: 1280x720
> #sar 0: 0/1
> -0, 0, 0, 1, 1382400, 0xccbe6bf8
> -0, 1, 1, 1, 1382400, 0x49c0cfd7
> +0, 0, 0, 2, 1382400, 0xccbe6bf8
> +0, 2, 2, 2, 1382400, 0x49c0cfd7
why is this (25fps) data becoming 1/50 ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The smallest minority on earth is the individual. Those who deny
individual rights cannot claim to be defenders of minorities. - Ayn Rand
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
