Page 1 of 1

VLC PHP Issues

Posted: 12 Dec 2007 15:59
by Andre
Hey,

I am trying to create an "on-demand streaming server"
For each client that logs on, I want to start a new vlc

Code: Select all

$cmd = "vlc --sout udp:" . $ip . ":1234 -I rc --rc-host 0.0.0.0:9568"; echo (shell_exec ($cmd));
I cannot launch vlc with the remote control interface listening on a socket
when launching it from something else then a bash shell.

I've also tried a python script but that doesn't work either, while
starting vlc with the same parameters from a bash shell does work.

Can anyone well me what is going wrong here?

Re: VLC PHP Issues

Posted: 12 Dec 2007 16:56
by revolunet
you should use VLM system to start only one instance of VLC and then control each 'channel' via php

its better for performance

Re: VLC PHP Issues

Posted: 13 Jan 2008 02:56
by dynamitemedia
revolunet,


can you show an example of how to set that up?

Re: VLC PHP Issues

Posted: 13 Jan 2008 09:19
by Andre
Status Update: The problem was solved by adding the --fake-tty option to the command line.

Re: VLC PHP Issues

Posted: 13 Jan 2008 20:54
by revolunet
please look at http://wiki.videolan.org/VLM for details

Re: VLC PHP Issues

Posted: 29 Jan 2008 07:38
by dynamitemedia
i have but if you could give us a working example on how to do this it would be helpful as the docs are confusing

Re: VLC PHP Issues

Posted: 29 Jan 2008 10:41
by revolunet
ok

i wont write a step by step tuto but some ways to do that :

in this example we'll use HTTP to control our VLC process and VLM instances. you can use telnet too

First, launch a VLC process with http admin interface :

Code: Select all

vlc --intf=http --http-host=127.0.0.1:8080
check on the machine if on http://localhost:8080 you have the vlc admin interface running

then, from PHP, you can do something like :

Code: Select all

<?php $http_admin_uri = "http://127.0.0.1:8080"; $url = $http_admin_uri.'/requests/vlm_cmd.xml?command=new test1 broadcast enabled input "D:\strip.mpeg" output #transcode{vcodec=mp1v,vb=512,scale=1,acodec=mpga,ab=128}:std{access=http,mux=ps,dst=0.0.0.0:9000}'; echo file_get_contents($url); $url2 = $http_admin_uri."/requests/vlm_cmd.xml?command=control test1 play"; echo file_get_contents($url2); ?>
this will first prepare the VLM broadcast (file=d:\strip.mpeg, dst=http on port 9000)
and then launch this stream

a little bonus : with apache, mod_rewrite and mod_proxy, you can proxify the resulting stream, this way, no need to open port 9000

in VLC, do dst=127.0.0.1:9000
in Apache, do the transparent proxy in a .htaccess :

RewriteRule vlcproxy/(.*) http://127.0.0.1:$1 [P]

last step is to affect one port by user ;)

to know other VLM commands, checks the Wiki or sniff http with FireBug when you play with the http "VLM admin interface"

let us know and... ENJOY ;)

Re: VLC PHP Issues

Posted: 01 Feb 2008 20:18
by dynamitemedia
revolunet


i posted another PHP question and was wondering if you could shed some light if that was possible?

also was wondering if you had an example of your mozilla plugin with out controls?

also how do i add a local file or a webcam to view?

i have videos located like this:

Code: Select all

C:\Documents and Settings\oem\Escritorio\videos\rambo.avi
i tried that but was wondering if the spaces caused a issue or maybe cause i'm using version 0.8.6d

what about a webcam ? can that be viewed?

Re: VLC PHP Issues

Posted: 01 Feb 2008 20:25
by revolunet
post me the link to your question, i'll try

for the demo, see : http://vlc.revolunet.com

if your question is about WITHOUT controls, see http://code.revolunet.com/VLCobject/EN

To experiment with VLM, use standard VLM HTTP admin interface and sniff with Firebug. You need to send the same commands, but from php.

Webcam can be share as any stream

Re: VLC PHP Issues

Posted: 01 Feb 2008 20:33
by dynamitemedia
viewtopic.php?f=16&t=44009

can you tell me why i cant show a local file?

what about a webcam how would i put that into the MRL?

is it possible to add a browse for video files and check for video and audio in the case of webcam , so visitors can do without know the location and change video and audio sources?

Re: VLC PHP Issues

Posted: 02 Feb 2008 18:11
by dynamitemedia
revolunet

i also added this post, hopefully to help people when searching

viewtopic.php?f=16&t=44011

thanks so much for you help, its tough getting responses on this board. i have a list of pver 20 posts that haven't been responded too on my questions So i really appreciate all your help

Re: VLC PHP Issues

Posted: 04 Feb 2008 15:51
by revolunet
can you tell me why i cant show a local file?
where ? in the VLC plugin ? you can, why not ?
what about a webcam how would i put that into the MRL?
it depends of the webcam and how you can access it; is it standalone or connected to your pc ? which OS ?

i use an AXIS webcam and can access it via http://webcam/..../live.swf
is it possible to add a browse for video files and check for video and audio in the case of webcam , so visitors can do without know the location and change video and audio sources?
i dont understand your sentence.... im french so please speak clear english

yes we can add a 'browse' button in the html page but it will show THEIR local files
yes you can make a webcam button that open the webcams when you click it

Re: VLC PHP Issues

Posted: 04 Feb 2008 19:41
by dynamitemedia
it depends of the web cam and how you can access it; is it standalone or connected to your pc ? which OS ?
would be connected to a persons PC and win xp

yes we can add a 'browse' button in the html page but it will show THEIR local files
do you have an example of this?

yes you can make a web cam button that open the web cams when you click it
and what about this? any working examples?

I have searched the forums and the Wiki for either of these things actually being used or have a working example. And have found nothing.

Thanks for your help

Re: VLC PHP Issues

Posted: 04 Feb 2008 19:59
by revolunet
would be connected to a persons PC and win xp
1) you should see http://wiki.videolan.org/Documentation: ... DirectShow
do you have an example of this?
2) i've just added this feature to my demo page : http://vlc.revolunet.com

3) On the demo page, there's also a link to a webcam (click icon webcam) that opens a webcam somehere on the net. But it uses an axis standalone webcam. You can do the same as any other source when you'll know the 1)

Re: VLC PHP Issues

Posted: 04 Feb 2008 22:16
by dynamitemedia
great, i got it to work with IE but not in Firefox...

your other files work just fine but not the local ones.

what i wanted to do with the directshow is click a button like browse and it will browse for webcams on your pc or switch between ones you have like you can in the flash player

hope that is easier to understand for you

Re: VLC PHP Issues

Posted: 05 Feb 2008 11:12
by revolunet
i think its not possible for the moment to list the local webcams from a web page

Re: VLC PHP Issues

Posted: 05 Feb 2008 13:11
by revolunet
for Firefox it seems its a little but with path encoding

D:\test_rambo.mpeg doesnt work but D:\\test_rambo.mpeg does

Re: VLC PHP Issues

Posted: 22 Mar 2008 06:46
by dynamitemedia
im having some huge issues with this in IE 6

it keeps crashing.

has something changed?

i had went back to check this over as i am interested in possibly adding this to my page.

also was wondering something, how easy is to customize the controls?

taking out the french for one as it is confusing to some people. what about colors etc? maybe a web 2.0 look

Re: VLC PHP Issues

Posted: 23 Mar 2008 11:59
by revolunet
Which VLC plugin version do you use ?

I use IE6 and i have no special problems in 'normal' use. The official uri is : http://code.revolunet.com/VLCcontrols/EN (check if the demos work)

If you know javascript you can easyly tweak the library, modify control and style, and the buttons are images so you can change what you want.

I plan an update soon so tell me you feature requests

Re: VLC PHP Issues

Posted: 01 Jul 2008 17:34
by dadedvd
Hi!
with this code

Code: Select all

<?php $http_admin_uri = "http://localhost:8080"; $url = $http_admin_uri.'/requests/vlm_cmd.xml?command=new test1 broadcast enabled input "C:\video\legione.avi" output #transcode{vcodec=mp1v,vb=512,scale=1,acodec=mpga,ab=128}:std{access=http,mux=ps,dst=0.0.0.0:9000}'; echo file_get_contents($url); $url2 = $http_admin_uri."/requests/vlm_cmd.xml?command=control test1 play"; echo file_get_contents($url2); ?>
the browser return me this error:

new : Wrong command syntax control : Wrong command syntax.

can anybody help me? Please!!! :roll:

Thanks.

Re: VLC PHP Issues

Posted: 01 Jul 2008 17:54
by revolunet
Hello

did you read http://wiki.videolan.org/VLM#Command_line_syntax ?

You have to first create the stream :

Code: Select all

new test1 broadcast enabled
then set options

Code: Select all

setup my_test1 input "C:\video\legione.avi" setup my_test1 output #transcode{vcodec=mp1v,vb=512,scale=1,acodec=mpga,ab=128}:std{access=http,mux=ps,dst=0.0.0.0:9000}
then start the stream

Code: Select all

control test1 play

hope this helps

Re: VLC PHP Issues

Posted: 01 Jul 2008 18:17
by dadedvd
Yes i had read the page...

and it doesn't work... :? I don't know why...

I would to create the stream through PHP...

and then the option.

Thanks

Re: VLC PHP Issues

Posted: 03 Jul 2008 14:54
by dadedvd
I have resolved... :D

The problem was in the space between "new test broadcast enabled" and it is replace " " with %20 "new%20test%20broadcast%20enabled"

Code: Select all

$http_admin_uri = "http://localhost:8080"; $url = $http_admin_uri.'/requests/vlm_cmd.xml?command=new%20test1%20broadcast%20enabled'; echo file_get_contents($url);