Disagreement in documentation
Hi I've been playing around with vlcpp. I want to add some options so I can stream a video.
On the command line, I would do something like:
vlc /home/matt/videos/TheRobe.mkv --sout '#duplicate{dst=display,dst=std{access=http,mux=mkv,dst=:8090/stream}}'
How to do it in libvlcpp? Because in Media::addOption()
it says:
* \warning Not all options affects libvlc_media_t objects: Specifically,
* due to architectural issues most audio and video options, such as text
* renderer options, have no effects on an individual media. These
* options must be set through Instance::Instance() instead.
so I go over to look at Instance::Instance()
, and see:
* \warning There is absolutely no warranty or promise of forward,
* backward and cross-platform compatibility with regards to
* Instance::Instance() arguments. We recommend that you do not use them,
* other than when debugging.
which tells me NOT to use Instance::Instance()
. Now I'm confused!
At the moment I'm trying:
auto instance = VLC::Instance(0, nullptr);
auto media = VLC::Media(instance, "/home/matt/videos/TheRobe.mkv", VLC::Media::FromPath);
media.addOption("--sout '#duplicate{dst=display,dst=std{access=http,mux=mkv,dst=:8090/stream}}");
auto mp = VLC::MediaPlayer(media);
mp.play();
std::this_thread::sleep_for( std::chrono::seconds( 60 ) );
but I don't seem to be able to view the network stream (on the same Linux machine, using a vlc player instance started from the command line)
The output on the command-line of the consuming player is:
matt@Sam:~$ VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[000055a7622795b0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
qt5ct: D-Bus system tray: no
[000055a7623178a0] main playlist: playlist is empty
[00007fa85c0015d0] access stream error: HTTP connection failure
[00007fa85c0015d0] main stream error: connection failed: Connection refused
[00007fa85c0015d0] http stream error: cannot connect to 10.0.0.194:8090
^C
Am I doing things correctly here?
I'd be grateful for some clarification!
EDIT: I understand the vlc command-line player starts a web server. Do I need to explicitly do this when using libvlcpp in code?
Thank you
Matthew