Original timestamps available?

Hi,

When playing a video from filesrc (.mp4, h264 encoded), is there a possibility to get the original timestamps of when the frame was actually recorded?

If the file was recorded with the information, it will be available on each buffer in the form of GstVideoTimecodeMeta.

So in Rust, given a valid buffer_ref I should be able to get the VideoTimeCode like so?

        let video_meta_iter = buffer_ref.iter_meta::<VideoTimeCodeMeta>();
          for m in video_meta_iter {
              info!("-- Video Time Code: {:?}", m.tc());
          }

I’ve tried with a .mp4 file, recorded by ffmpeg:

ffmpeg -hide_banner -f v4l2 -video_size 3840x2160 -t 5 -i /dev/video6 -codec:v h264 output_video.mp4

I do receive the buffer, but there seems to be no VideoTimeCodeMeta attached to it, as I don’t see it in the logs. However, PTS and Duration are there.

          let timestamp: u64 = *buffer_ref.pts().unwrap();
          if prev_timestamp > 0 {
              info!("-- PTS: {}, dt: {}", buffer_ref.pts().unwrap(), timestamp - prev_timestamp);
          } else {
              info!("-- first PTS: {}", buffer_ref.pts().unwrap());
          }
  
          if let Some(dts) = buffer_ref.dts() {
              info!("-- DTS: {}", dts);
          }
          if let Some(duration) = buffer_ref.duration() {
              info!("-- duration: {}", duration);
          }

I am actually interested in getting the original dt in between frames. It seems like PTS is the only thing I can currently work with.

Thanks for your input.