Skip to content

Audio output bug in LoadVideoDirectory V2 #13

@Jonseed

Description

@Jonseed

When using LoadVideoDirectoryV2 to extract audio, the node fails with this ffmpeg error:

[out#0/f32le @ ...] Output with label 's0:a' does not exist in any defined filter graph
Error opening output files: Invalid argument
!!! Exception during processing !!! 'NoneType' object is not subscriptable

The problem occurs because the node’s load_audio() function chains .audio onto an ffmpeg input stream after applying ss (seek) and/or an atrim filter.
When trimming is applied, the ffmpeg-python graph loses its reference to the labeled audio stream (s0:a), which causes ffmpeg to throw this error and return None.
That None value later triggers a crash in the downstream save_audio node.


How to Reproduce

  1. Use LoadVideoDirectoryV2 on any MP4 with an audio track.
  2. Enable skip_frames or use a short clip (so trimming occurs).
  3. Connect the node’s audio output to a Save Audio node.
  4. Observe the s0:a error and NoneType traceback.

Fix

Remove the .audio chain from the load_audio() function so that the audio stream remains correctly linked to the trimmed input.
Replace:

process = (stream.audio
          .output('pipe:', format='f32le', acodec='pcm_f32le', ac=2, ar=44100)
          .overwrite_output()
          .run_async(pipe_stdout=True, pipe_stderr=True))

with:

process = (
    stream
    .output('pipe:', format='f32le', acodec='pcm_f32le', ac=2, ar=44100, vn=None)
    .overwrite_output()
    .run_async(pipe_stdout=True, pipe_stderr=True)
)

This keeps trimming (ss / atrim) intact, avoids the missing stream label issue, and works across all tested MP4s.


Result

After this change:

  • Audio extraction works correctly, including trimmed segments.
  • No more s0:a or NoneType errors.
  • Downstream Save Audio node functions normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions