H264 and SEI messages
ccrisler at mutualink.net
Tue Feb 4 08:31:43 PST 2014
Angel, Thank for the post. SEI messages are indeed tough.
What I actually found was 2 problems. The first was a GStreamer error
(could still be in the 1.2 code, I haven't checked) and one introduced by
The first problem was that the RTP timestamp assigned to the SEI messages
was the same as the previous RTP packet. That is absolutely wrong because
it signals that the SEI is associated with the wrong frame. It must be
assigned a timestamp of the proper (probably next) RTP packet. I added code
the to h264parse code to temporarily hold SEI messages until a NAL type of
1 or 5, assign the same timestamp to both and send the SEI first. Due to my
pipeline, I think that I have lost the original association so that is
about all that I could do. If I got a stream with a complicated decoding
order, my code would simply fall apart.
The second problem was that my buffer accumulation code in h264parse was
keeping the GstBuffer timestamp at the very first value ever assigned,
which was also wrong. I have added code that accumulates buffers in the
adapter until a start code prefix has been found following a NAL because
the h264 RTP payloader wasn't working well without that. I was confused by
the buffer timestamps in the adapter and did that wrong. A single buffer
that is received by h264parse (at least in my situation) can have data
bytes from 2 or more NALUs. Which timestamp do you use??? Now I assign the
timestamp of the last buffer fragment that is added. That allows GstBuffer
timestamps to increase through the session and all timestamps work
properly, as does video. Hurrah!
I wimped out and only addressed the problem of time progressing forward.
Finding the 'right' SEI message and generating the proper timestamp would
be 'interesting' for the rewind case! I'll leave that as an exercise to the
On Tue, Feb 4, 2014 at 11:07 AM, Angel Martin <amartin at vicomtech.org> wrote:
> This post could be interesting for you.
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gstreamer-devel