@@ -141,7 +141,7 @@ def test_encoding_with_pts(self) -> None:
141141
142142 with av .open (path , "w" ) as output :
143143 stream = output .add_stream ("h264" , 24 )
144- assert stream in output . streams . video
144+ print ( 11111111111 , dir ( stream ))
145145 stream .width = WIDTH
146146 stream .height = HEIGHT
147147 stream .pix_fmt = "yuv420p"
@@ -171,24 +171,26 @@ def test_libsvtav1(self) -> None:
171171 if not "libsvtav1" in av .codecs_available :
172172 pytest .skip ()
173173
174- output = av .open ("output.mp4" , "w" )
175- stream = output .add_stream ("libsvtav1" )
174+ with av .open (self .sandboxed ("output.mp4" ), "w" ) as output :
175+ stream = output .add_stream ("libsvtav1" , 24 )
176+ assert isinstance (stream , VideoStream )
176177
177- for i in range (24 ):
178- frame = av .VideoFrame (200 , 100 , "rgb24" )
179- frame .pts = i * 2000
180- frame .time_base = Fraction (1 , 48000 )
181- for packet in stream .encode (frame ):
178+ for i in range (24 ):
179+ frame = av .VideoFrame (200 , 100 , "rgb24" )
180+ frame .pts = i * 2000
181+ frame .time_base = Fraction (1 , 48000 )
182+ for packet in stream .encode (frame ):
183+ assert packet .time_base == Fraction (1 , 24 )
184+ output .mux (packet )
185+
186+ for packet in stream .encode (None ):
182187 assert packet .time_base == Fraction (1 , 24 )
183188 output .mux (packet )
184189
185- for packet in stream . encode ( None ):
186- assert packet . time_base == Fraction ( 1 , 24 )
187- output .mux ( packet )
190+ assert output . streams [ 0 ]. codec . name == "libsvtav1"
191+ assert output . streams [ 0 ]. codec . is_encoder is True
192+ assert output .streams [ 0 ]. frames == 24
188193
189- assert output .streams [0 ].codec .name == "libsvtav1"
190- assert output .streams [0 ].codec .is_encoder is True
191- assert output .streams [0 ].frames == 24
192194
193195class TestBasicAudioEncoding (TestCase ):
194196 def test_default_options (self ) -> None :
0 commit comments