[FFmpeg-trac] #7972(undetermined:new): Gif output not preserving source duration for last frame

FFmpeg trac at avcodec.org
Tue Jun 25 20:34:42 EEST 2019

#7972: Gif output not preserving source duration for last frame
             Reporter:  bjorn        |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |

Comment (by jagraff):

 One fix for this in fftools/ffmpeg.c  is to copy the duration from the
 frame to the packet during do_video_out calls, eg:

 while (1) {
     ret = avcodec_receive_packet(enc, &pkt);
     if (pkt.duration <= 0)
         pkt.duration = av_rescale_q(in_picture->pkt_duration,
 ost->mux_timebase, enc->time_base);

 And then use the packet duration, rather than the pts, during the gif
 encode step. However, this fix is probably not general enough, since other
 which attempts to write out gif packets could still face this issue.
 Ideally, packet duration should always be copied (and not zeroed out)
 during filtering, however it appears that at some point between reading
 packets in and writing them out, the duration gets dropped.

Ticket URL: <https://trac.ffmpeg.org/ticket/7972#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list