View Full Version : Reuse timestamps in H.264 video stream
Dust Signs
6th April 2009, 11:18
I currently have to pass raw H.264 data to ffmpeg in order to decode it to raw, uncompressed data. I also have the presentation time stamps for each frame, but as the decoding order is different than the presentation order I need to "pass them through" somehow. Otherwise, I cannot tell which time stamp belongs to which frame. As the time stamps may "jump" without prior notice manual calculation is not an option (I tried it, but the gap recognition doesn't work out). I also took a look at the ffmpeg source code but it seems as if it processes input data per packet rather than per frame which makes it - in my opinion - impossible to manually add the time stamp to the stream itself and processing it within ffmpeg.
Is there another possibility you could think of because I'm running out of ideas?
Dust Signs
Guest
6th April 2009, 13:24
What exactly are you trying to do? What are you making?
Dust Signs
6th April 2009, 13:54
I'm afraid my NDA does not allow me to talk about that in detail but it is very important for me to not lose the association between time stamp and frame. Before passing the frames to ffmpeg the time stamps are known as I get them together with the frame data (as additional information in my function call). ffmpeg performs no encoding whatsoever, so all I get is raw data. I'm not looking for an elegant solution - it just needs to conserve my time stamps ;)
Dust Signs
Guest
6th April 2009, 14:31
I can't advise you without knowing what you are trying to accomplish. Good luck.
Mr VacBob
6th April 2009, 16:02
See AVCodecContext.reordered_opaque. What makes you think ffmpeg doesn't process frames?
And I don't think this is an H.264 question.
Dust Signs
7th April 2009, 06:28
See AVCodecContext.reordered_opaque.
Thanks, this seems useful, but I'll have to get my timestamps into that structure somehow. Currently, I'm calling ffmpeg by command line, piping data in and retrieving the output through pipes again. Is there a way to tell ffmpeg which time stamp belongs to which frame (through some sort of metadata stream or something) or do I have to use libavcodec/libavformat in my program? Anyway, how I get these time stamps back if I only get raw (YUV) output data?
What makes you think ffmpeg doesn't process frames?
Sorry, I must have been mistaken concerning this point. I just looked at the code again and recognized that I was looking at the wrong spot.
And I don't think this is an H.264 question.
As it's an H.264 stream I try to decode it maybe is but I got your point - unfortunately I cannot imagine a better section for this post.
Dust Signs
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.