Skip to content

Fix(examples): Ensure correct video resolution in record-video.py#245

Open
Optimized-Brain wants to merge 1 commit intodamiafuentes:masterfrom
Optimized-Brain:fix-video-recorder
Open

Fix(examples): Ensure correct video resolution in record-video.py#245
Optimized-Brain wants to merge 1 commit intodamiafuentes:masterfrom
Optimized-Brain:fix-video-recorder

Conversation

@Optimized-Brain
Copy link
Copy Markdown

@Optimized-Brain Optimized-Brain commented Sep 15, 2025

Addresses issue #232

Problem:

On certain operating systems, particularly Windows, the record-video.py example script fails to save the video correctly. This is due to a race condition where the videoRecorder thread initialises the cv2.VideoWriter uses the dimensions of an initial, low-resolution placeholder frame (400x300) before the actual video stream from the drone has started.

When the high-resolution frames (e.g., 960x720) arrive, cv2.VideoWriter fails to write them because their dimensions do not match the dimensions it was configured with, preventing the video from being saved.

Solution:

This pull request resolves the race condition by explicitly waiting for the first real video frame to be received from the drone before initialising the cv2.VideoWriter.

A while loop has been added to pause the script until the frame's shape no longer matches the placeholder dimensions. This guarantees that the VideoWriter is always created with the correct, final resolution of the video stream, making the example script robust and reliable across all platforms.

@Optimized-Brain Optimized-Brain changed the title Fix(examples): Ensure correct video resolution in record record-video.py Fix(examples): Ensure correct video resolution in record-video.py Sep 15, 2025
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.

1 participant