-
Notifications
You must be signed in to change notification settings - Fork 1
Improve frame metadata handling in video converter #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the video conversion logic to improve metadata handling by removing global frame data loading and adding proper error handling. The changes move frame metadata loading into the main function after CLI parsing and add validation for file presence and completeness.
- Moved frame metadata loading from global scope to main function with proper error handling
- Added dependency injection for cv2 module to improve testability
- Implemented comprehensive validation for metadata structure and frame file existence
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| "Error: First frame not found at" | ||
| f" {first_frame_path}. Please ensure frames are generated." |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message spans two lines with incorrect string concatenation. The space should be included in the f-string to avoid 'Error: First frame not found at{path}' output.
| "Error: First frame not found at" | |
| f" {first_frame_path}. Please ensure frames are generated." | |
| f"Error: First frame not found at {first_frame_path}. Please ensure frames are generated." |
| print("Error: Metadata does not contain a first frame entry.") | ||
| return False | ||
|
|
||
| first_frame_path = pathIn + first_frame_key + ".png" |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using string concatenation for file paths can cause issues on different operating systems. Use os.path.join(pathIn, first_frame_key + '.png') instead for cross-platform compatibility.
| ) | ||
| continue | ||
|
|
||
| filename = pathIn + frame_key + ".png" |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using string concatenation for file paths can cause issues on different operating systems. Use os.path.join(pathIn, frame_key + '.png') instead for cross-platform compatibility.
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68ecc92365b0832fb52fb039ec66ea78