Skip to content

Conversation

mehran66
Copy link

This PR addresses two main issues in the video_detect function:

Slow-Motion Output: The output video sometimes played in slow motion due to variable frame rate handling inconsistencies.

Reduced Output Size: Output videos experienced a significant size reduction, which impacted video quality in some cases.

Key Changes:

Frame Rate Consistency: Integrated OpenCV for reading the video, which ensures a consistent frame rate (fps) throughout the processing, eliminating slow-motion playback. Added a fallback to 30 fps in case of an invalid frame rate, improving compatibility across diverse input videos.

Enhanced Metadata and Quality Preservation: Included the -map_metadata 0 option in FFmpeg configuration to retain metadata from the input file, which helps preserve original color profiles and other settings. Dynamically set the pixel format based on the input video to ensure compatibility and consistency with the input format, which also helped maintain quality. Improved bitrate management by setting the output bitrate to match the input bitrate, if available, and established a default if extraction fails. This adjustment helps maintain video quality and reduces drastic size changes. Added support for audio codec copying and transcoding as needed, providing flexibility in retaining or converting audio to match various requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants