Skip to content

Conversation

Copy link

Copilot AI commented Dec 17, 2025

VideoWriter could silently fail during initialization (invalid codec, disk space, permissions) but continue execution, causing recordings to appear started while actually stopped immediately.

Changes

Core Fix (node_video_writer.py)

  • Added isOpened() validation after cv2.VideoWriter creation
  • Wrapped legacy mode initialization in try-except with crash logging
  • Early return on failure preserves "Start" button state for retry
  • Progress bar displays specific error messages

Before:

self._video_writer_dict[tag_node_name] = cv2.VideoWriter(...)
# Continues silently if VideoWriter failed to open

After:

video_writer = cv2.VideoWriter(...)
if not video_writer.isOpened():
    create_crash_log("recording_start_videowriter_failed", RuntimeError(...))
    dpg.configure_item(progress_bar, overlay="Error: Failed to start")
    return  # Button stays "Start" for retry

Testing (test_videowriter_initialization_validation.py)

  • 7 test cases: invalid codec, path, FPS, dimensions, success case, error flow
  • Platform-independent test constants

Error Scenarios Now Handled:

  • Unavailable codecs (MJPEG, H.264, FFV1)
  • Insufficient disk space
  • Permission denied on output directory
  • Invalid video parameters (zero FPS, zero dimensions)

Impact

Users now receive immediate feedback on initialization failures with crash logs containing diagnostic information. No breaking changes—only adds validation layer.

Original prompt

pourquoi quand je clique sur start (le record), sur le noeud videowriter, ça peut s"arréter brutalement ? corrige stp


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 30 commits December 9, 2025 12:29
- Add timestamp preservation in ImageConcat when collecting audio from multiple slots
- Update VideoWriter to synchronize multi-slot audio by timestamp instead of slot order
- Add comprehensive tests validating synchronized audio merging
- Maintain backward compatibility for audio without timestamps

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
- Move traceback import to top of file
- Add detailed comment for float('inf') usage in timestamp sorting
- Remove specific line numbers from documentation to prevent staleness

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
[WIP] Verify synchronized merging of audio chunks
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…Writer

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
… review

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…ssues

Fix audio timestamp loss in Video→SyncQueue→ImageConcat→VideoWriter pipeline
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…ssing

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…orker

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
[WIP] Implement background video creation to avoid UI freezes
…ssue

Fix audio synchronization in VideoWriter multi-slot merging
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…worker

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…ing defaults

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Copilot AI and others added 16 commits December 17, 2025 12:05
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Fix YouTube node display failure with playlist URLs
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…nts, and clean up imports

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…ideo-processing

Eliminate cascading deepcopy operations causing memory leak in detection→concat→writer pipeline
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
…sues

Extend H.264 re-encoding fix from AVI to MKV format
- Changed queue size calculation from fps*chunk_duration*audio_queue_size to fps*chunk_duration
- Reduced MAX_FRAME_QUEUE_SIZE from 300 to 100 frames
- Reduced MIN_FRAME_QUEUE_SIZE from 50 to 30 frames
- This prevents excessive memory allocation on start (from ~2.2 GB to ~534 MB at 1080p)
- Added comprehensive test suite to verify memory limits

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
[WIP] Fix lag issues when starting videowriter
Copilot AI and others added 6 commits December 17, 2025 14:46
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix abrupt stop issue on video writer start Fix VideoWriter silent initialization failures causing abrupt recording stops Dec 17, 2025
Copilot AI requested a review from hackolite December 17, 2025 14:55
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