File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed
Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -392,7 +392,10 @@ async def _snapshot_via_api(
392392 # Step 1: Get raw data from local extension (always happens locally)
393393 raw_options : dict [str , Any ] = {}
394394 if options .screenshot is not False :
395- raw_options ["screenshot" ] = options .screenshot
395+ if hasattr (options .screenshot , "model_dump" ):
396+ raw_options ["screenshot" ] = options .screenshot .model_dump ()
397+ else :
398+ raw_options ["screenshot" ] = options .screenshot
396399
397400 # Call extension to get raw elements
398401 raw_result = await _eval_with_navigation_retry (
Original file line number Diff line number Diff line change @@ -186,11 +186,41 @@ def _generate_clip_from_frames(
186186 )
187187
188188 if result .returncode != 0 :
189+ stderr = result .stderr .decode ("utf-8" , errors = "replace" )[:500 ]
189190 logger .warning (
190- f"ffmpeg failed with return code { result .returncode } : "
191- f"{ result .stderr .decode ('utf-8' , errors = 'replace' )[:500 ]} "
191+ f"ffmpeg failed with return code { result .returncode } : { stderr } "
192192 )
193- return False
193+ # Fallback: use glob input (handles non-uniform filenames)
194+ fallback_cmd = [
195+ "ffmpeg" ,
196+ "-y" ,
197+ "-pattern_type" ,
198+ "glob" ,
199+ "-i" ,
200+ frame_pattern ,
201+ "-r" ,
202+ str (fps ),
203+ "-pix_fmt" ,
204+ "yuv420p" ,
205+ "-c:v" ,
206+ "libx264" ,
207+ "-crf" ,
208+ "23" ,
209+ str (output_path ),
210+ ]
211+ fallback = subprocess .run (
212+ fallback_cmd ,
213+ capture_output = True ,
214+ timeout = 60 ,
215+ cwd = str (frames_dir ),
216+ )
217+ if fallback .returncode != 0 :
218+ fb_stderr = fallback .stderr .decode ("utf-8" , errors = "replace" )[:500 ]
219+ logger .warning (
220+ f"ffmpeg fallback failed with return code { fallback .returncode } : { fb_stderr } "
221+ )
222+ return False
223+ return output_path .exists ()
194224
195225 return output_path .exists ()
196226
You can’t perform that action at this time.
0 commit comments