Skip to content

Conversation

Copy link

Copilot AI commented Dec 10, 2025

When recording video through SyncQueue and ImageConcat, audio timestamps were lost during synchronization, resulting in no audio in final output files (MP4/AVI/MKV).

Root Cause

SyncQueue extracted only raw audio data, discarding timestamps:

# Before: timestamp lost
synced_data = valid_items[0]['data']
output_data[data_type][slot_idx] = synced_data

# After: timestamp preserved
synced_item = valid_items[0]
synced_data = synced_item['data']
synced_timestamp = synced_item['timestamp']

if data_type == 'audio' and isinstance(synced_data, dict):
    synced_data = synced_data.copy()
    synced_data['timestamp'] = synced_timestamp
elif data_type == 'audio':
    synced_data = {'data': synced_data, 'timestamp': synced_timestamp}

Changes

SyncQueue (node_sync_queue.py)

  • Wraps audio data with timestamp when synchronizing
  • Preserves complete dict structure (data + sample_rate + timestamp)

ImageConcat (node_image_concat.py)

  • Checks for existing timestamps before queue lookup
  • Handles both raw numpy arrays and dict-wrapped audio

VideoWriter (node_video_writer.py)

  • Supports SyncQueue-wrapped audio format ({'data': array, 'timestamp': float})
  • Sorts multi-slot audio chunks by timestamp for temporal ordering
  • Adds debug output for audio collection and merge diagnostics

Tests

  • test_video_audio_sync_pipeline.py: End-to-end validation of timestamp preservation through entire pipeline
Original prompt

je prends le node video, je recupére les flux images et chunk audio, avec leurs timestamp, ensuite, quand je les synchronise avec syncQueue, que je les envoies au node imageconcat puis videowriter pour la fusion du flux input image et des flux chunk audio , quand je stop pour avoir ma video en AVI, mpeg4 ou mkv, le process prends beaucoup de temps, freeze, et au final pas de son sur la video finale, pourquoi ? explique et corrige. Merci.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits December 10, 2025 09:56
…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>
Copilot AI changed the title [WIP] Fix audio synchronization issues in video processing Fix audio timestamp loss in Video→SyncQueue→ImageConcat→VideoWriter pipeline Dec 10, 2025
Copilot AI requested a review from hackolite December 10, 2025 10:09
@hackolite hackolite marked this pull request as ready for review December 10, 2025 10:10
@hackolite hackolite merged commit b64ebc4 into main Dec 10, 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.

2 participants