Menu

#860 VideoTests.smil doesn't work properly

developer_version
closed
None
8
2014-12-02
2014-11-20
Kees Blom
No

When playing the URL http://ambulantplayer.org/Demos/VideoTests/VideoTests.smil
the first (.mpg) video starts with 1 or to frames, then pauses for about a minute,
and completes normally.

For some reason I don't understand video::renderer::data_avail() thinks that the duration of the first frame is about 40 sec., and uses that value to schedule the next callback

Discussion

  • Kees Blom

    Kees Blom - 2014-11-21

    This was introduced in rev.8829 dd. sept.18 2014 with the checkin message: Better frame duration calculation, may still not be perfect

     
  • Kees Blom

    Kees Blom - 2014-11-24

    Jack and Kees looked at this and concluded that it is a mess.

    The computation of 'm_fmt.frameduration' in ffmpeg_video_decoder_datasource::_need_fmt_uptodate() is wrong (in case of .mpg it is 40 sec., should be 40 millisec; for mp4 it is 11.11 millisec, should also be 40 millisec, as the framerate is 25 fps.).

    This wrong value is subsequently used in a number of places, a.o.:
    - when to schedule the next callback in video_renderer::data_avail()
    - drop frames in video_renderer::data_avail()
    - drop frames in ffmpeg_video_decoder_datasource::data_avail()
    - maintaining 'm_video_clock' in ffmpeg_video_decoder_datasource::data_avail()

    It is questionable whether it is a good idea to work with the notion "frame duration" at all, because as it is now, you don't have proper information
    for its correct computation (may be you have in AV_FormatContext, but not in
    AV_CodecContext).

    Note that this code is supposed to work properly for all (supported) codecs in all situations (file, net, live stream etc.).
    Also, there are codecs around supporting variable frame rates.

     
  • Kees Blom

    Kees Blom - 2014-11-24
     
  • Jack Jansen

    Jack Jansen - 2014-12-02

    Fixed in 8953 (which is a merge from the branch exp-jack-ffmpeg-timebases).

    The clocks used by ffmpeg_command (and communicated to ffmpeg_video::data_avail in the AVPacket) are using the stream timebase, which is no longer available in the decoder.

    Now, ffmpeg_common converts timestamps and durations to the AMBULANT_TIMEBASE (microseconds). This means we can use avpkt.frame_duration.

    In addition we use av_frame_get_best_effort_timestamp(), which means we don't have to re-invent the video clock in case of missing timestamps.

     
  • Jack Jansen

    Jack Jansen - 2014-12-02
    • status: open --> closed
     

Log in to post a comment.