Skip to content

Read remote audio segments with ffmpeg#257

Open
GaganNarula wants to merge 4 commits into
mainfrom
gagan/read-audio-stream
Open

Read remote audio segments with ffmpeg#257
GaganNarula wants to merge 4 commits into
mainfrom
gagan/read-audio-stream

Conversation

@GaganNarula
Copy link
Copy Markdown
Collaborator

@GaganNarula GaganNarula commented Mar 27, 2026

We currently allow reading audio by time with start_time and end_time in read_audio. However, this results in actually downloading the entire file first. This utility uses ffmpeg's http range request to only read segments from a large file on a google cloud bucket. Currently only supports gcs, but in principle the approach will also work with s3 buckets.

Why do we need it ? This is relation to PR #255 . The problem we're facing is that some datasets like the spanish-carrion-crows dataset contain very large audio files (> 10 hrs). We actually don't need the entire file just segments from it defined by a selection table.

In general, we need to be able to read very long audio from buckets quickly without memory overhead and long download times. It'll be useful for PAM data as an example.. There is a way to do this using filesystem byte range reads without using ffmpeg but that approach works only for uncompressed audio like WAV format.

@GaganNarula GaganNarula requested a review from mil-ad March 27, 2026 23:20
@GaganNarula GaganNarula changed the title Read an audio file's segments with ffmpeg Read remote audio segments with ffmpeg Mar 28, 2026
@GaganNarula GaganNarula marked this pull request as ready for review March 28, 2026 01:41
@GaganNarula GaganNarula requested a review from a team as a code owner March 28, 2026 01:41
Copy link
Copy Markdown
Contributor

@Paulchen-git Paulchen-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

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