AW: playback H264 encoded file too fast

Thornton, Keith keith.thornton at
Thu Jul 11 12:26:08 UTC 2019

H264 normal doesn't store timestamps. The Buffers going into your Encoder are in PTS order (Presentation Time). The buffers coming out of the Encoder are in DTS order (Decode Time). If you add a Muxer to your pipeline This information will be stored in the mp4 Header blocks. When it is played, the demuxer takes this information and passes it to the decoder so that your recording will be played at the proper speed.

-----Urspr√ľngliche Nachricht-----
Von: gstreamer-devel <gstreamer-devel-bounces at> Im Auftrag von jles
Gesendet: Donnerstag, 11. Juli 2019 12:50
An: gstreamer-devel at
Betreff: Re: playback H264 encoded file too fast

Hi Vinod, 

Thanks for your answer. I see what's the issue but I'd like to understand this a bit better.... 

I'm already adding timestamps here: 
        g_object_set(G_OBJECT(appsrc), "do-timestamp", TRUE, NULL); 
        GST_BUFFER_PTS (buffer) = timestamp; 
        GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND,
(guint8) fps); 
        timestamp += GST_BUFFER_DURATION (buffer); 

That timestamps look like are added to the GST buffer right? so can I assume that they are only use in the gstreamer flow and they are not added to the frames during H264 encoding? 

So a solutions seems to be to add the H264 stream into a mp4 container right?

Would it possible to do that with the generated H264 file, without the time stamp info? or what would it be the "best way" to do it?

Sent from:
gstreamer-devel mailing list
gstreamer-devel at

More information about the gstreamer-devel mailing list