{"record":{"id":"47838042c372f338","repo":"Comfy-Org/ComfyUI","slug":"failed-to-resize-video-str-e","errorCode":null,"errorMessage":"Failed to resize video: {str(e)}","messagePattern":"Failed to resize video: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/util/conversions.py","lineNumber":557,"sourceCode":"                        break\n                # Carry odd audio time bases the mp4 muxer rejects; reset pts, encoder assigns clean ones (MP3-in-AVI)\n                audio_frame.pts = None\n                for packet in audio_stream.encode(audio_frame):\n                    output_container.mux(packet)\n            for packet in audio_stream.encode():\n                output_container.mux(packet)\n\n        output_container.close()\n        input_container.close()\n        output_buffer.seek(0)\n        return InputImpl.VideoFromFile(output_buffer)\n\n    except Exception as e:\n        if input_container is not None:\n            input_container.close()\n        if output_container is not None:\n            output_container.close()\n        raise RuntimeError(f\"Failed to resize video: {str(e)}\") from e\n\n\ndef _f32_pcm(wav: torch.Tensor) -> torch.Tensor:\n    \"\"\"Convert audio to float 32 bits PCM format. Copy-paste from nodes_audio.py file.\"\"\"\n    if wav.dtype.is_floating_point:\n        return wav\n    elif wav.dtype == torch.int16:\n        return wav.float() / (2**15)\n    elif wav.dtype == torch.int32:\n        return wav.float() / (2**31)\n    raise ValueError(f\"Unsupported wav dtype: {wav.dtype}\")\n\n\ndef audio_bytes_to_audio_input(audio_bytes: bytes) -> dict:\n    \"\"\"\n    Decode any common audio container from bytes using PyAV and return\n    a Comfy AUDIO dict: {\"waveform\": [1, C, T] float32, \"sample_rate\": int}.\n    \"\"\"","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/conversions.py#L539-L575","documentation":"Generic wrapper around any failure inside resize_video (PyAV). The except block closes containers and re-raises as RuntimeError('Failed to resize video: ...'). The inner text is the actual PyAV error — commonly a decode failure, unsupported pixel format, or the explicit 'resize produced no frames' ValueError from the same function.","triggerScenarios":"resize_video_to_max_pixels / resize_video on corrupted input, a container with no decodable video stream, an encoder rejecting the target dimensions (odd width/height with yuv420p), or the empty-selection ValueError from error 764.","commonSituations":"Feeding a broken download or a file with a mismatched extension; target resolution with odd dimensions (yuv420p requires even w/h); a very short clip combined with trimming parameters that select no frames.","solutions":["Read the suffix after 'Failed to resize video:' to identify the root PyAV error.","If it is 'resize produced no frames', fix start_time/duration (error 764).","Ensure target dimensions are even (yuv420p constraint).","Re-encode the source as standard H.264 MP4 and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"out_w, out_h = target_dims\nif out_w % 2 or out_h % 2:\n    raise ValueError('yuv420p requires even width and height')","typeGuard":null,"tryCatchPattern":"try:\n    out = resize_video(video, out_w, out_h, start_time, duration)\nexcept RuntimeError as e:\n    if 'resize produced no frames' in str(e):\n        out = resize_video(video, out_w, out_h, 0.0, video.get_duration())  # full clip fallback\n    else:\n        raise","preventionTips":["Use even target dimensions for yuv420p encodes.","Validate the decode-ability of the source with ffprobe first.","Validate trim windows (see error 764) before resizing."],"tags":["video","pyav","wrapper-exception","resize"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}