[FFmpeg-trac] #7083(avcodec:new): Decoder playing out frames at double speed

FFmpeg trac at avcodec.org
Tue Mar 13 10:23:05 EET 2018


#7083: Decoder playing out frames at double speed
-------------------------------------+-------------------------------------
             Reporter:  baudouin0    |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avcodec      |                  Version:  git-
             Keywords:  double       |  master
  playout rate                       |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 sps->time_scale is being doubled on h264_slice_header_init().
 After second frame h->x264_build is set to zero rather than -1 causing
 frame rate to be doubled.

 How to reproduce:

 ffmpeg -i test.264 out%d.bmp


 // Added printf to check:
 static int h264_slice_header_init(H264Context *h)
 {
     const SPS *sps = h->ps.sps;
     int i, ret;

     ff_set_sar(h->avctx, sps->sar);
     av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt,
                                      &h->chroma_x_shift,
 &h->chroma_y_shift);

     if (sps->timing_info_present_flag) {
         int64_t den = sps->time_scale;
         printf("h264_slice_header_init() build=%d time_scale=%d
 ticks_per_frame=%d num_units_in_tick=%d\n", h->x264_build,
 sps->time_scale, h->avctx->ticks_per_frame, sps->num_units_in_tick);
         if (h->x264_build < 44U)
             den *= 2;
         av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num,
                   sps->num_units_in_tick * h->avctx->ticks_per_frame, den,
 1 << 30);
     }

 Output from decoder is:ffmpeg version N-90264-g80798e3 Copyright (c)
 2000-2018 the FFmpeg developers
   built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
   configuration:
   libavutil      56.  8.100 / 56.  8.100
   libavcodec     58. 14.100 / 58. 14.100
   libavformat    58. 10.100 / 58. 10.100
   libavdevice    58.  2.100 / 58.  2.100
   libavfilter     7. 12.100 /  7. 12.100
   libswscale      5.  0.102 /  5.  0.102
   libswresample   3.  0.101 /  3.  0.101
 h264_slice_header_init() build=-1 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 Input #0, h264, from 'test.264':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: h264 (High), yuv420p(progressive), 704x576 [SAR
 12:11 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 50 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> bmp (native))
 Press [q] to stop, [?] for help
 h264_slice_header_init() build=-1 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 h264_slice_header_init() build=0 time_scale=50000 ticks_per_frame=2
 num_units_in_tick=1000
 Output #0, image2, to 'xxx%d.bmp':
   Metadata:
     encoder         : Lavf58.10.100
     Stream #0:0: Video: bmp, bgr24, 704x576 [SAR 12:11 DAR 4:3], q=2-31,
 200 kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.14.100 bmp

 Note x264_build becomes zero.
 Built ob x64 linux with gcc 4.8.4

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7083>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list