Question

I am trying to record a live stream in vlc. It is easy if I use the GUI, just clicking on Convert/Save in the Media option, and after that choosing the stream address in the Network tab. I wanted to do the same thing in a C/C++/Python program. In case of a C program, I used Visual Studio but on writing #include<vlc/vlc.h> it says the file cannot be included. Then I downloaded the source from git but still it is not working. What to do?

Was it helpful?

Solution

You can save a stream using commandline arguments:

vlc scheme://host/stream.xyz --sout file/muxer:stream.xyz

and thus, call it using some kind of exec() (or its windows equivalent).

Then, the following answer: https://stackoverflow.com/a/19484168/1290438 shows how to open a stream in VLC in python:

import vlc
i = vlc.Instance('--verbose 2'.split())
p = i.media_player_new()
p.set_mrl('rtp://@224.1.1.1')
p.play()

So I guess, at worst, you can give the --sout argument to vlc.Instance, or at best there's a method on the instance to set up stream output.

In my humble opinion, using C/C++ for such a simple task is like killing a fly using a bazooka…

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top