VlcMediaPlayer: making audio callback (amplitude monitor)
-
I'm using
VlcMediaPlayer
to play video with audio, and I'm having trouble figuring out how one might hook the audio and process it with code (I'd like to monitor audio as the video plays programmatically).Low-level, I believe the main way to do this in raw libvlc is using sout, i.e.
--sout #transcode{acodec=s16l}:smem{audio-postrender-callback=<callback_addr>,audio-prerender-callback=<callback_addr>}
I can initialize my
VlcInstance
using this option but unfortunately while the callback works, that then breaks my media player, it's just a black screen.
My assumption became that this "consumes" the streams. I can find some examples of splitting video as to record it to a file while processing, for instance, as hereSo I thought maybe I can redirect one copy to
display
i.e.--sout #duplicate{dst=display,dst=\"transcode{acodec=s16l}:smem{audio-postrender-callback=<callback_addr>,audio-prerender-callback=<callback_addr>\"}
Unfortunately this too breaks the media player.I see a distantly relevant github issue here for a C# VLC lib that says using sout breaks vout, but it seems
VlcMediaPlayer
does not rely on vout since the flag is 0 even when it works. So I am not sure why this isn't working.I hoped there was some class such as
QAudioProbe
but it doesn't seem to connect with vlc, so at this point I'm not sure what to try.So I guess my question is: is there a way to get this to work with vlc-qt that's easier than synchronizing some other audio lib with my VlcMediaPlayer, and if so how?
-
Hi and welcome to devnet,
That's a pretty interesting question. However, you should bring it to the VLC-Qt maintainers. They will likely be more knowledgeable about that issue.