Read audio and video at the same time in video loader node.#13591
Conversation
📝 WalkthroughWalkthroughThe changes consolidate video and audio processing into a single demux loop instead of separate decoding passes. Video frames are collected with one-time alpha-channel detection per file. Audio packets are decoded, resampled to 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@comfy_api/latest/_input_impl/video_types.py`:
- Around line 299-300: The except block catching av.error.InvalidDataError
currently only logs ("pyav decode error") which lets the function (e.g., the
video decoding routine handling av.error.InvalidDataError) return partially
decoded frames; change it to stop silent continuation by re-raising the caught
exception (or raise a new, descriptive exception that includes the original
error) instead of just logging—replace the logging.info("pyav decode error") in
the except av.error.InvalidDataError handler with raising the exception
(including the original exception message) so corrupted/incomplete video data
cannot be returned as valid output.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 24e9663d-19fd-4d69-9306-c91a2965d631
📒 Files selected for processing (1)
comfy_api/latest/_input_impl/video_types.py
| except av.error.InvalidDataError: | ||
| logging.info("pyav decode error") |
There was a problem hiding this comment.
��� Analysis chain
🏁 Script executed:
# First, let's see the full context around lines 299-300 in the file
cd comfy_api && git diff HEAD~1 HEAD -- latest/_input_impl/video_types.py | head -200Repository: Comfy-Org/ComfyUI
Length of output: 90
🏁 Script executed:
# If git diff isn't available, let's examine the file structure and context
wc -l comfy_api/latest/_input_impl/video_types.pyRepository: Comfy-Org/ComfyUI
Length of output: 109
🏁 Script executed:
# Get the full context around lines 299-300 with surrounding code
sed -n '280,320p' comfy_api/latest/_input_impl/video_types.pyRepository: Comfy-Org/ComfyUI
Length of output: 1982
🏁 Script executed:
# Check if this file has recent changes and understand the context
git log --oneline -20 comfy_api/latest/_input_impl/video_types.py 2>/dev/null || echo "Git history not available"Repository: Comfy-Org/ComfyUI
Length of output: 129
🏁 Script executed:
# Get broader context to see the function structure and what gets returned
sed -n '250,350p' comfy_api/latest/_input_impl/video_types.pyRepository: Comfy-Org/ComfyUI
Length of output: 4406
🏁 Script executed:
# Look for the function definition and return statement
grep -n "def get_components_internal\|return " comfy_api/latest/_input_impl/video_types.py | head -20Repository: Comfy-Org/ComfyUI
Length of output: 1191
🏁 Script executed:
# Get the full function to understand the control flow
sed -n '200,400p' comfy_api/latest/_input_impl/video_types.pyRepository: Comfy-Org/ComfyUI
Length of output: 8766
Silently continuing after decode corruption can return partial video as valid output.
On lines 299–300, catching av.error.InvalidDataError and only logging allows the function to return whatever frames were decoded before the error occurred. This makes corrupted or incomplete data indistinguishable from valid output. Consider raising an error instead to prevent returning partial components:
Suggested fix
- except av.error.InvalidDataError:
- logging.info("pyav decode error")
+ except av.error.InvalidDataError as e:
+ logging.warning("pyav decode error: %s", e)
+ raise ValueError("Video decode failed due to invalid/corrupt data") from e📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| except av.error.InvalidDataError: | |
| logging.info("pyav decode error") | |
| except av.error.InvalidDataError as e: | |
| logging.warning("pyav decode error: %s", e) | |
| raise ValueError("Video decode failed due to invalid/corrupt data") from e |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@comfy_api/latest/_input_impl/video_types.py` around lines 299 - 300, The
except block catching av.error.InvalidDataError currently only logs ("pyav
decode error") which lets the function (e.g., the video decoding routine
handling av.error.InvalidDataError) return partially decoded frames; change it
to stop silent continuation by re-raising the caught exception (or raise a new,
descriptive exception that includes the original error) instead of just
logging—replace the logging.info("pyav decode error") in the except
av.error.InvalidDataError handler with raising the exception (including the
original exception message) so corrupted/incomplete video data cannot be
returned as valid output.
No description provided.