code: def test_read_timestamps_from_packet(self):
      with temp_video(10, 300, 300, 5, video_codec="mpeg4") as (
          f_name,
          data,
      ):
          pts, _ = io.read_video_timestamps(f_name)
          # note: not all formats/codecs provide accurate information for computing the
          # timestamps. For the format that we use here, this information is available,
          # so we use it as a baseline
          with av.open(f_name) as container:
              stream = container.streams[0]
              # make sure we went through the optimized codepath
              assert b"Lavc" in stream.codec_context.extradata
              pts_step = int(
                  round(
                      float(
                          1 / (stream.average_rate * stream.time_base)
                      )
                  )
              )
              num_frames = int(
                  round(
                      float(
                          stream.average_rate
                          * stream.time_base
                          * stream.duration
                      )
                  )
              )
              expected_pts = [i * pts_step for i in range(num_frames)]
  
          assert pts == expected_pts
  
imports: import contextlib
  import os
  import sys
  import tempfile
  import pytest
  import torch
  import torchvision.io
  from common_utils import assert_equal
  from torchvision import get_video_backend
label_desc: Use image node_id 8 for calling the TestVideo obj's underlying member method code with example usage: obj.test_read_timestamps_from_packet() without return types