[Libav-user] SEI picture timing message and timestamp in decoded frame, h264 es

Michal Rybinski michal.rybinski+ffmpeg at gmail.com
Wed Feb 13 19:53:17 EET 2019

śr., 13 lut 2019, 16:28: Carl Eugen Hoyos <ceffmpeg at gmail.com> napisał(a):

> 2019-02-13 16:15 GMT+01:00, Michal Rybinski <
> michal.rybinski+ffmpeg at gmail.com>:
> > Is FFMPEG taking into account SEI picture timing message
> > contents when establishing timestamp (pts or best effort
> > timestamp) when my app reads decoded AVFrame (basically
> > looking into pts and best_effort_timestamp fields)?
> I don't know the answer but I can confirm that there are known
> (and apparently difficult to fix) issues with timestamps in raw
> h.264 streams.
> Carl Eugen

Hi Carl,

Thanks for prompt reply.

If it does any difference, I might check things also with GPL version of
ffmpeg that includes x264 decoder.

I get timestamping in raw  h264 is troublesome. If it wasn't, ffmpeg
wouldn't be employed in the proces :-) Synchronization is a case I'm
looking at currently.

Nevertheless (sorry, being persistent because I want to understand) I
noticed various kinds of SEI are parsed in ffmpeg:


So given raw h264 elementary stream, it seems that info should be sitting
(processed or not) and maybe used somewhere in ffmpeg structures (or my
understanding what happens where in ffmpeg is totally wrong). Would you
care to show me the right direction in ffmpeg sources to do my own digging?
I am getting a little trouble trying to understand how this sei may (or may
not) impact timestamps in frames and the flow of getting

Basically, if my understanding is correct, sei picture timing message was
defined to aid synchronization/sequencing frames on timeline (Im
simplifying the whole subject a lot, I know). I might as well tap into
ffmpeg if it's worth adding contribution candidate and some piece of
handling such topic.

 The other option might be doing own calculations for sync. Can I access
this sei data (or user unregistered sei, type 5, which is also an option
for me) directly from avframe? Or maybe earlier, from avpacket? If yes -

And while at it - is there or how I can find out which key I should use in
AVDictionary to set via av_dict_set an fps value for the h264 es stream
while decoding and playing it back? Or it is very bad idea, because...? Or
shall this question be a separate thread?

It seems I need some help on identifying which parts of ffmpeg are employed
in the demuxing and decoding of h264 es frame and when and which source
code files could help me understand it better and look for answers.

Hope it helps to clarify my questions.

Best Regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190213/ac608c38/attachment.html>

More information about the Libav-user mailing list