0

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?

eckes
  • 56,506
  • 25
  • 151
  • 189
Prakhar Mohan Srivastava
  • 4,631
  • 21
  • 66
  • 113
  • Have you included the header file location in visual studio project settings? – Sumeet Jan 27 '14 at 10:17
  • @Sumeet No, can you give me the complete procedure? Write an answer, that will be easier. Plus does that mean I'll have to change the **Linker** properties too? And what about the environment variables? – Prakhar Mohan Srivastava Jan 27 '14 at 10:21
  • I'd advice you to use the same build environment as VLC originally does, which is GCC. Though I think you'd better go for python scripting for such a simple task… Or even did you try just using the commandline arguments? – zmo Jan 27 '14 at 12:10

1 Answers1

0

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…

Community
  • 1
  • 1
zmo
  • 22,917
  • 4
  • 48
  • 82
  • In python what do I need to do to import vlc? Because it says that there is no module named vlc, and please note that I am on windows. – Prakhar Mohan Srivastava Jan 27 '14 at 12:41
  • well, I'm not sure of how you do it on windows, but basically you need to do `pip install vlc` or `easy_install vlc`. So basically, look for `easy_install.exe` or `pip.exe` where `python.exe` is installed – zmo Jan 27 '14 at 12:43
  • I found the link but can't seem to run the script, says multiple errors. I am new to python so don't really know where I am going wrong. Posting the link below for your reference. https://pypi.python.org/pypi/setuptools#windows – Prakhar Mohan Srivastava Jan 27 '14 at 12:52
  • download get-pip.py from http://www.pip-installer.org/en/latest/installing.html and run it by dragging it over `python.exe`… Or double clicking it, if `.py` is assiociated with `python.exe` in your windows. – zmo Jan 27 '14 at 12:57
  • I did, and double clicked it and it installed pip, but then on running the same program it gave the same error, module not found. – Prakhar Mohan Srivastava Jan 27 '14 at 13:03
  • well, then that's a different question than the one you originally asked… And I don't have a windows, and I never installed python on windows, so here is the limits of my knowledge to be able to help you :-s Though you may want to read this SO question: http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows – zmo Jan 27 '14 at 13:09
  • So, I already have pip, I have python 3.3 (ha!), now what should I do? I mean for the error? – Prakhar Mohan Srivastava Jan 27 '14 at 13:12