Page 1 of 1
AudioBarGraph in VLCKit
Posted: 15 Mar 2019 07:51
by StreaminVid
Hello,
I'm using VLCKit in MacOS to play some audio streams and now I'm looking for a way to meter the audio. Is it possible to add the AudioBarGraph filter? This is what I'm trying in Swift:
Code: Select all
var outputPlayer: VLCMediaPlayer = VLCMediaPlayer()
let videoURL = URL(string: theURL)
let media = VLCMedia(url: videoURL!)
media.addOptions([AnyHashable("--audio-filter=audiobargraph_a") : NSNull()])
media.addOptions([AnyHashable("--audiobargraph_a-bargraph=1") : NSNull()])
media.addOptions([AnyHashable("--sub-source=audiobargraph_v") : NSNull()])
outputPlayer.media = media
outputPlayer.delegate = self
outputPlayer.drawable = self.OutputPlayerView
outputPlayer.play()
The player plays the stream from the URL, but I don't see an audiobargraph showing. Am I adding the options incorrectly or is this a feature that is not implemented in VLCkit?
Thanks,
Streamin'
Re: AudioBarGraph in VLCKit
Posted: 16 Mar 2019 19:09
by Jean-Baptiste Kempf
Look at the logs. But I don't think you should pas the Options with --
Re: AudioBarGraph in VLCKit
Posted: 17 Mar 2019 00:09
by StreaminVid
Thanks for getting back to me on this. I don't see anything in the logs about these options. I've gotten rid of the "--" with the same result. I had high hopes for doing it this way:
Code: Select all
var outputPlayer: VLCMediaPlayer = VLCMediaPlayer()
let videoURL = URL(string: theURL)
let media = VLCMedia(url: videoURL!)
media.addOptions([AnyHashable("audio-filter") : "audiobargraph_a"])
media.addOptions([AnyHashable("audiobargraph_a-bargraph") : 1])
media.addOptions([AnyHashable("sub-source") : "audiobargraph_v"])
outputPlayer.media = media
outputPlayer.delegate = self
outputPlayer.drawable = self.OutputPlayerView
outputPlayer.play()
but I still get the video with no audio bar graph showing up. Any ideas?
Re: AudioBarGraph in VLCKit
Posted: 17 Mar 2019 11:55
by mfkl
Re: AudioBarGraph in VLCKit
Posted: 17 Mar 2019 21:11
by StreaminVid
You mean like this:
Code: Select all
media.addOptions([AnyHashable(":audio-filter=audiobargraph_a") : NSNull()])
media.addOptions([AnyHashable(":audiobargraph_a-bargraph=1") : NSNull()])
media.addOptions([AnyHashable(":sub-source=audiobargraph_v") : NSNull()])
or like this:
Code: Select all
media.addOptions([AnyHashable(":audio-filter") : "audiobargraph_a"])
media.addOptions([AnyHashable(":audiobargraph_a-bargraph") : 1])
media.addOptions([AnyHashable(":sub-source") : "audiobargraph_v"])
Just tried both ways. Still no bar graph.
Re: AudioBarGraph in VLCKit
Posted: 17 Mar 2019 22:45
by StreaminVid
Just tried doing it this way:
Code: Select all
let myPlayerOptions = ["audio-filter=audiobargraph_a","audiobargraph_a-bargraph=1","sub-source=audiobargraph_v"]
outputPlayer = VLCMediaPlayer.init(options: myPlayerOptions)
Still no bar graph. Interestingly... if I do it this way:
Code: Select all
let myPlayerOptions = ["--audio-filter=audiobargraph_a","--audiobargraph_a-bargraph=1","--sub-source=audiobargraph_v"]
outputPlayer = VLCMediaPlayer.init(options: myPlayerOptions)
I end up getting a crash with this in the logs:
Code: Select all
vlc: unknown option or missing mandatory argument `--audiobargraph_a-bargraph=1'
While all other methods of supplying those options that I've tried go seemingly unnoticed, this method has gotten some attention and made a crash. Even more interesting is that it is the second parameter that is causing grief. Does that mean that the first parameter was accepted? Strange.
Re: AudioBarGraph in VLCKit
Posted: 18 Mar 2019 19:55
by Jean-Baptiste Kempf
Did you recompile VLCKit?
Re: AudioBarGraph in VLCKit
Posted: 18 Mar 2019 21:21
by StreaminVid
Hmm... I'm not sure, actually. I added the framework to my Xcode project using a POD file. When I built my app for the first time, I'm not sure if it compiled VLCKit or just used a pre-compiled framework. I suspect that it was pre-compiled and I've never recompiled it. Are there changes that I need to make to the framework itself?
Re: AudioBarGraph in VLCKit
Posted: 20 Mar 2019 08:17
by Jean-Baptiste Kempf
Maybe, and that is hard.
Re: AudioBarGraph in VLCKit
Posted: 20 Mar 2019 10:06
by sherington
I don't know VLCKit, but for your "unknown or missing mandatory argument --audiobargraph_a-bargraph=1" error, you could try passing "--audiobargraph_a-bargraph" and "1" as separate options.
However...
I was just testing this In my own bindings and I can get an empty audio bar-graph to appear, but it does not receive data to render the levels.
I think I remember reading somewhere on these forums or in the Trac, that things like audio filters don't (can't?) work this way through LibVLC. IIRC someone wanted to use the audio compressor module and it was stated that it wouldn't work.
And then there's the usual caveat of using these options/arguments/switches via libvlc_new is not supported anyway.
I just found the related post here
https://forum.videolan.org/viewtopic.php?t=143056.
So maybe you're stuck.
Re: AudioBarGraph in VLCKit
Posted: 20 Mar 2019 17:39
by StreaminVid
Ok, thank guys. I'm going to pull this feature from my app requirements for the time being. I went into this thinking that it might be an easy, supported option to just turn on and this does not appear to be the case. I'll keep checking in on VLCKit development from time to time and if things change, I'll add this feature into my app.
Thanks again for the help and guidance.
Re: AudioBarGraph in VLCKit
Posted: 21 Mar 2019 19:40
by Jean-Baptiste Kempf
You should open a bug, though, on VLCKit repo.