Page 1 of 1

Transcode and stream over http with python

Posted: 22 Jan 2016 00:59
by postelrich
I'm new to VLC and trying to use it transcode and stream video over http. I figured out how to do this from the command line but having trouble figuring how to do this with the python lib.

Here's the command:

Code: Select all

C:\Program Files\VideoLAN\VLC\vlc.exe" hannibal.mkv --sout="#transcode{vcodec=theo,vb=1024,channels=2,samplerate=44100,ab=128,acodec=vorb}:http{mux=ogg,dst=:8080/hannibal.ogg}" :sout-all :sout-keep -I dummy
Here's what I have in python:

Code: Select all

import vlc inst = vlc.Instance() med = inst.media_new("D:\\Rich\\Videos\\hannibal.mkv", "sout=#transcode(vcodec=theo,vb=1024,channels=2,samplerate=44100,ab=128,acodec=vorb):http(mux=ogg,dst=:8080/hannibal.ogg)", "sout-all", "sout-keep", "I=dummy") p = med.player_new_from_media() p.play()
That's as best as I've been able to figure out from the docs and examples. This just causes a window to open to play the video. What's the proper way to do this?

Re: Transcode and stream over http with python

Posted: 23 Jan 2016 01:54
by RĂ©mi Denis-Courmont
Not familiar with the Python bindings but missing colons, maybe?

Re: Transcode and stream over http with python

Posted: 24 Jan 2016 05:56
by postelrich
I figured out what I believe is the correct way:

Just need to start instance with the params:

Code: Select all

inst = vlc.Instance("""--sout=#transcode{vcodec=theo,vb=1024,channels=2,samplerate=44100,ab=128,acodec=vorb}:http{mux=ogg,dst=:8080/stream} :sout-all :sout-keep -I dummy""")