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

[Request] Filtering Mid-Stream #6

Open
JoshuaDoes opened this issue Aug 2, 2018 · 7 comments
Open

[Request] Filtering Mid-Stream #6

JoshuaDoes opened this issue Aug 2, 2018 · 7 comments

Comments

@JoshuaDoes
Copy link

JoshuaDoes commented Aug 2, 2018

Studying the source of dca and its current setup, I've been doing my best to try and research if there's any possible way to filter audio output mid-stream using FFMPEG and some message with an STDIN pipe. My reason for trying to figure this out is I absolutely love the simplistic library dca provides (and I even plan on adding a few things of my own in the near future with a pull request), however it seems almost impossible to change the volume mid-stream or apply equalizer effects mid-stream unless FFMPEG specifically allows it.

If you have the knowledge on how to do this, it'd be an amazing feature for dca to have. Even if you don't feel like doing it yourself, I'd be happy to help add it for things like changing the volume mid-stream should you or anyone else know how to go about it.

Thanks in advance for anything pertaining this,
JoshuaDoes

@jogramming
Copy link
Owner

To my knowledge it's not possible without restarting ffmpeg, which could be done, you could stop ffmpeg and start it at the timestamp it stopped, but im not planning on adding anything like that myself.

@alexwh
Copy link

alexwh commented Jan 21, 2019

It's possible, but you need to use an obscure sparsely documented option: https://ffmpeg.org/ffmpeg-filters.html#zmq_002c-azmq

Outside of this document and a few mailing list conversations, I can't find much more information about doing this on the fly without restarting ffmpeg (not ideal).

@JoshuaDoes
Copy link
Author

@alexwh I've already looked into that, and given its dependency on another framework it doesn't seem like something nice to play with. I'm considering forking this library anyway, so maybe I'll consider a pass-through ffmpeg process to get the raw PCM data, change the volume programmatically, and then pass it back through another ffmpeg process for shipping off to Discord.

@alexwh
Copy link

alexwh commented Jan 21, 2019

I've also been wanting for a little more control over the audio stream data and ffmpeg options. Personally, I think restarting a new ffmpeg process with filters applied is a better solution than running two in tandem (you could keep the old one running until the new one is ready to send data, and sync their playing time, then make the switch).

Without doing that though, zmq seems to be the only supported way of doing this within ffmpeg, next is just figuring out the arcane filter syntax ffmpeg uses. I believe if the process is initialized with all the filters you will ever want to use, but with their parameters set to a default value, it is then possible to tweak their numbers with zmq messages.

@JoshuaDoes
Copy link
Author

If you can figure out a way to do this purely in Go, please let me know!

@jogramming
Copy link
Owner

Ah i didn't know ffmpeg had that kinda feature, the documentation on this seems really shit tough (which is probably why i didn't know about it)

@JoshuaDoes
Copy link
Author

Yeah I've looked into it myself and it's not fun to work with due to the lack of proper documentation.

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

3 participants