Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add map option to io.StreamWriter audio track #3895

Open
AngeloGiacco opened this issue Mar 25, 2025 · 0 comments
Open

add map option to io.StreamWriter audio track #3895

AngeloGiacco opened this issue Mar 25, 2025 · 0 comments

Comments

@AngeloGiacco
Copy link

AngeloGiacco commented Mar 25, 2025

🚀 The feature

FFmpeg makes it easy to write raw audio data without any headers. For example for opus encoding, it looks something like this:

input_stream = ffmpeg.input(
                "pipe:0",
                format="s16le",
                ar=self.original_sample_rate,
                ac=self.n_channels,
            )
            map = "0:a" if self.raw else ""
            format = "data" if self.raw else "opus"
            output_stream = ffmpeg.output(
                input_stream,
                "pipe:1",
                format=format,
                acodec="libopus",
                audio_bitrate=audio_bitrate_str,
                ar=self.out_sample_rate,
                application="audio",
                map=map,
            )

torchaudio.io.StreamWriter makes it easy to supply the format dynamically, but it is not possible to supply the map parameter.
This would be very useful so that we can define our encoders in torchaudio and add options for raw or complete audio encoding

Motivation, pitch

This is very useful for conversational AI and audio streaming.

Alternatives

No response

Additional context

No response

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

No branches or pull requests

1 participant