Acerca de Productos Asistencia FAQ Blog

How to get frames durations for HEVC, AV1, AVC streams with Zond 265

image

 

  By Olga Krovyakova - created April 16, 2025

 

TRY ZOND FREE

 

One of the important parameters of any video file is a frame duration - is the time it takes to show one frame during playback. The frame duration is inversely related to the framerate of the video. For example: when a video framerate is 30 FPS, its frame duration is 1/30 ​seconds (33.33 ms per frame). 

When encoding video streams, ensuring constant frame durations is critical to maintain a constant frame rate. For this, the coding problem is investigated, where a frame in the AVC data stream with a too short frame duration leads to an undesirable variable frame rate.

Also variable frame rate (VFR) in the output causes deviations in GOP structure, unsmooth playback and synchronization issues.

To calculate the frame duration from an H.264 elementary stream SPS (Sequence Parameter Set), you should use the timing information found in the VUI (Video Usability Information) parameters, specifically time_scale and num_units_in_tick. These parameters describe the frame timing of the stream. Ensure the SPS contains a VUI section with timing information with the following fields:

time_scale: Defines the number of time units per second.

num_units_in_tick: Defines the number of time units per frame or field.

fixed_frame_rate_flag: Indicates whether the stream has a fixed frame rate.

frame_rate = time_scale / (2 * num_units_in_tick)

For an MP4 container, the frame duration is determined by the PTS values ​​obtained from the container data.The difference between consecutive PTS values determines how long the frame is displayed. PTS values are typically stored in units based on the container's time scale (e.g., 1/90000 seconds in MP4) and data from CTTS and STTS atoms.

The time scale is defined in the Movie Header atom (MVHD) of the MP4 container. It represents the number of ticks per second for the container. This time scale is used to interpret timestamps. 

The STTS atom contains sample count and sample duration in ticks. Initially, DTS starts from 0 (or a specified base) and increments by the sample durations from the STTS table. The cumulative DTS is calculated as: DTS[n]=DTS[n−1] + Sample Duration, where: DTS [n−1] is the DTS of the previous sample. Sample Duration comes from the STTS table. The first sample usually starts with DTS[0]=0.

The CTTS atom provides information for B-frames or other frames that need reordering before presentation. It specifies composition offsets for each sample. These offsets adjust the decoding order (DTS) to match the desired presentation order (PTS). Each entry in the CTTS table contains sample count and composition offset in ticks. 

The PTS for a frame can be calculated as: PTS = DTS + Composition Offset 

Use the time scale to convert the computed PTS to seconds: Time (seconds)=PTS×Time Base, where Time Base = 1/time_scale

Version 5.6.2412.18 introduces a new feature - displaying frame durations on timeline bars tooltips and an ability to export frame durations in a text report. This feature currently works for HEVC, AV1, AVC codecs in elementary streams and in MP4 files.

 

Viewing frame duration in the timeline

 

To check the duration of individual frames in the timeline window, hover the cursor over any frame bar, and the tooltip will display the duration.

How to get frames durations - Picture 1

Generating reports with frame durations 

If you need to get all frames durations for further analysis you can generate a report in CSV format.Please, follow the steps below:

 

1. Open the report generation window:

How to get frames durations - Picture 2

 

2. Check the “Prediction Unit Info”. Then set the “Export file path” (Button 1) and push “Export” (Button 2) to start generating a report.

How to get frames durations - Picture 3

 

3. Below is an example of how the report will look like in Excel:

How to get frames durations - Picture 4

 

TRY ZOND FREE

 

  • https://www.solveigmm.com/en/howto/zond-265-tutorial/
  • https://www.solveigmm.com/en/howto/how-to-open-a-specification-in-zond-265/

 

 About the author

imageOlga Krovyakova is the Technical Support Manager in Solveig Multimedia.

She is the author of many text and video guidelines of company's products: Video Splitter, HyperCam, WMP Trimmer Plugin, AVI Trimmer+ and TriMP4. 

Her deep understanding comes from hands-on experience, using the software daily.

Сontact Olga via support@solveigmm.com if you have any questions. She will gladly assist you!