docstr: Can change the frame rate and image size on-the-fly
docstr_tok: ["Can","change","the","frame","rate","and","image","size","on-the-fly"]
code: def test_change_video_encoder_spec(
      self, ext, encoder, src_rate, enc_rate, src_size, enc_size
  ):
      """Can change the frame rate and image size on-the-fly"""
      width, height = src_size
      enc_width, enc_height = enc_size
      ext = "mp4"
      filename = f"test.{ext}"
      num_frames = 256
  
      original = torch.zeros(
          (num_frames, 3, height, width), dtype=torch.uint8
      )
  
      dst = self.get_temp_path(filename)
      w = StreamWriter(dst, format=ext)
      w.add_video_stream(
          frame_rate=src_rate,
          format="rgb24",
          height=height,
          width=width,
          encoder_format="yuv420p",
          encoder_frame_rate=enc_rate,
          encoder_width=enc_width,
          encoder_height=enc_height,
      )
  
      with w.open():
          w.write_video_chunk(0, original)
  
      # check
      reader = torchaudio.io.StreamReader(
          src=self.get_temp_path(filename)
      )
      i = reader.get_src_stream_info(0)
      self.assertEqual(i.frame_rate, enc_rate)
      self.assertEqual(i.width, enc_width)
      self.assertEqual(i.height, enc_height)
  
imports: import io
  import math
  import torch
  import torchaudio
  from parameterized import parameterized, parameterized_class
  from torchaudio.io import CodecConfig, StreamReader, StreamWriter
  from torchaudio_unittest.common_utils import get_asset_path, get_sinusoid, nested_params, rgb_to_yuv_ccir, skipIfNoFFmpeg, skipIfNoModule, TempDirMixin, TorchaudioTestCase
  from .common import lt42
label_desc: Use image node_id 18 for calling the StreamWriterCorrectnessTest obj's underlying member method code with example usage: obj.test_change_video_encoder_spec(ext, encoder, src_rate, enc_rate, src_size, enc_size) without return types