[FFmpeg-devel] [PATCH 23/24] ffmpeg: simplify the use of OutputStream.frame_number

Anton Khirnov anton at khirnov.net
Wed Dec 15 21:36:25 EET 2021


Quoting Michael Niedermayer (2021-12-14 22:13:43)
> On Mon, Dec 13, 2021 at 04:20:41PM +0100, Anton Khirnov wrote:
> > It features in limiting the number of output frames (-frames option) and
> > currently can be incremented from two places:
> > - for video encoding (not streamcopy), in do_video_out() after each
> >   successful avcodec_send_frame() call
> > - for all other cases, in of_submit_packet()
> > 
> > Not only is this inconsistent and confusing, but also the special
> > treatment for video encoding is redundant, since
> > AVCodecContext.frame_count stores the exact same value (number of
> > successful avcodec_send_frame()) calls.
> > 
> > Replace the use of OutputStream.frame_count in do_video_out() with
> > AVCodecContext.frame_count. Modify OutputStream.frame_count in the same
> > way for all streams.
> > ---
> >  fftools/ffmpeg.c     |  9 ++++-----
> >  fftools/ffmpeg_mux.c | 19 +++++++------------
> >  2 files changed, 11 insertions(+), 17 deletions(-)
> 
> This results in differences
> one is:
> ./ffmpeg -i ~/tickets/4072/CoP\ 1\ 1\ 3\ -M.avi -vframes 2 -bitexact -vcodec huffyuv /tmp/4072-fic-old.avi
> 
> -rw-r----- 1 michael michael 3572792 Dez 14 22:09 /tmp/4072-fic-new.avi
> -rw-r----- 1 michael michael 1908172 Dez 14 22:10 /tmp/4072-fic-old.avi
> 
> I see other differences caused by patches today i still need to investigate
> what causes what

Fixing this will require larger restructuring first, so I am dropping
this patch for now.

Please let me know if the rest of the set breaks anything else.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list