[FFmpeg-devel] [PATCH] lavf/utils: reset event_flags if extradata is not extracted correctly

Anton Khirnov anton at khirnov.net
Mon Jan 25 15:08:27 EET 2021


Quoting Linjie Fu (2021-01-25 04:49:21)
> On Mon, Jan 25, 2021 at 12:49 AM Anton Khirnov <anton at khirnov.net> wrote:
> >
> > Quoting Linjie Fu (2021-01-24 16:05:56)
> > > Regression since 87f0c8280.
> > >
> > > If the extradata of a stream could not be extracted correctly,
> > > codec_info_nb_frames would remain zero, while st->event_flag would still
> > > be marked as AVSTREAM_EVENT_FLAG_NEW_PACKETS.
> > >
> > > The two expressions could be different in this case, hence reset
> > > event_flags and calculate the correct score.
> > >
> > > Fix #9029.
> >
> > The ticket mentions ffplay, but ffplay does not access event_flags.
> >
> 
> You are right, this helps ffmpeg cmdline to copy and dump:
> $ ffmpeg -i sample_cut.flv -c copy -y dump.mp4
> 
> Before 87f0c8280 and after this patch:
> 
> audio streams could be dumped and playable, while video streams still not.
> 
> 87f0c8280..master:
> Error reporting and quits.
> 
> [mp4 @ 0x7fb276809a00] dimensions not set
> Could not write header for output file #0 (incorrect codec parameters
> ?): Invalid argument
> Error initializing output stream 0:1 --
> 
> I'd change the commit message to "#9029 related" for this, since the
> ffplay issue remains the same.

I am still not convinced this is really a regression. You can still
process the file by explicitly mapping only the audio stream.

This file is damaged and the video stream is not readable. IMO it is
better to report an error and let the user decide what to do with it
than silently skip the video stream while pretending everything is fine.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list