This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Frame Rate Control Using H.264 Encoder.

Hello There:

I'm using the TMS320DM648DVDP evaluation board to encode video using H.264 (I'm using the TI's H.264 Baseline Profile Encoder Version 1.14 that is provided with the evaluation kit). The output data from the encoder is being grabbed by a computer (Using the PCI bus) everytime a frame is encoded and then it is saved into a file. If the frame rate is 30 fps then I can playback the video using several standar H.264 decoders in normal motion (30 fps), however if I change the frame rate say at 15 fps then the playback is in fast motion.

My question is, how can I make the decoder knows the frame rate used?

I have tried to play around with the VIDENC_DynamicParams with the input frame rate and the target frame rate parameters and seems to have no effect on this. Any help would be greately appreciated.

Thanks;

Gabriel

 

  • According to my understanding it seems like you are trying to decode an elementary stream (.h264).

    If that is the case, there is no way a decoder will know the frame rate as the H264 ITU-T spec doesnt mention about the timing information. 

    Usually the frame rate controllers are related to the container files using Time Stamps (PTS).

    Although to display at the required rate in your case, you can have extra buffer to store the decoder output and then give the appropriate delay before sending it to the display.

  • Hi Vallabha:

    Thank you very much for your response, it seems that that is what I'm trying to do.

    1.- I was wondering what information is present in an elementary .h264 stream (Like size, NTSC\PAL format, etc.) and how is broken down in the stream. I would appreciate this information if you know it.

    2.- Also I was doing some research on the frame rate and according to the ITU H.64 there is some timing information stored in the VUI (Visual usability Information), since this is optional I was wondering if the encoder that I'm using from TI can support this feature.

    3.- One of the application that I need to implement is basically store compressed video (Using H.264) in a computer file for a later review. How would you recomend to implement the frame rate controller? Could you please explain a little bit more about the time stamps in the container files?

    Thank you very much for your help;

    Gabriel

  • I was wondering what information is present in an elementary .h264 stream (Like size, NTSC\PAL format, etc.) and how is broken down in the stream. I would appreciate this information if you know it.

    Through parsing SPS & PPS the height & width of the frame can be extracted. As VUI & SEI are optional there is no guarantee that every H264 encoder would support that. More info on VUI can be found on page 312 of the ITU-T doc. But same information are required(compulsary) for container files. 

    Also I was doing some research on the frame rate and according to the ITU H.64 there is some timing information stored in the VUI (Visual usability Information), since this is optional I was wondering if the encoder that I'm using from TI can support this feature.

    You may have to contact the local TI support to get that info or it might be present in the release notes related to that encoder.

    One of the application that I need to implement is basically store compressed video (Using H.264) in a computer file for a later review. How would you recomend to implement the frame rate controller? Could you please explain a little bit more about the time stamps in the container files?

    One way to do that would be, instead of storing the encoded content in elementary stream format you could encapsulate it into a container file. Some of the popular container formats known to store H264 are MP4, AVI, MPEG2-TS etc. More information can be found in ISO/IEC 14496-14:2003, a multimedia container format standard specified as a part of MPEG-4.

    http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38538

     

     

     

  • Thank you very much for the information, I really appreciate it.

    Gabriel.

  • I am also trying to do same with DM357. I have an MPEG4 video file recorded at 30 fps rate. I want to play this video at variable rate adjustable to 0.8X to 1.2X of original recoridng meaning 24 fps to 36 fps. I was thinking to add variable delay in decoder between frames. How can I add this delay. Does TI provide source code for codec?

     

    Thanks

  • The H.264 Decoders provided by TI (or any other decoder) will not do frame rate control for you - they are fixed entities that do not have a scope or awareness of time - their sole purpose is just to decode video frames for you.

    In order to implement variable frame rate playback, you'll need to implement a playback synchronization controller. This is equivalent to an AV Sync. engine, without the audio.

    Knowing the supposed playback timestamp on the current video frame (also known as PTS), the controller matches that with the wall-time on your processor and deduces when to 'present' this frame to the output. It will adjust for variable decoding times and 'track' the wall-time on your processor to ensure the frame rate you want to playback at is maintained. There is some feedback aspect to this, which is what makes this controller different from just putting in a delay between frames. This delay method will not compensate for system loading or jitter in your decoding times.

     

     

  • Jerry is completely right, normally Program Time Stamp (PTS) information is included in transport streams and our codec simply deal with elementary streams (the decoding of raw video data); there are open source projects such a gstreamer that can parse transport streams including time information (include AV sync support) and pass the raw video data on to our decoders at the appropriate rate.

  • My point was different. Say If I have 40 fps D1 video encoded with restricted profile MPEG4 encoder and I want to decode it at variable speed. Is there any way to insert variable delay between frame decode? Start and stop of decode control through software or variable clock to decoder?

  • You mean like the trick modes (forward, rewind, fast-foward, pause, fast-rewind....) available on a DVR?  This would have to be done is software as well, the codecs encode or decode video data, they do not keep temporal information relative to other frames.

  • I understand. One more question. No body mention beyond 30 fps, but I think the codec is capable for atleast 50 fps.

     

     

  • In general, you are correct, depending on the size of the frame you are encoding, you may be able to do 50fps or higher or if you are doing really large frames, you may not be abke to reach 30  fps.  To get more specific, I would refer to the codec data-sheet included in the DVSDK; it should contain information on the load on ARM and MJCP used to get those numbers (if there is more processing power left, it can probrably do more) as well as any restrictions.