(I have full access to the web server, Ubuntu 12.04, Apache, Php, MySQL.) (I'm using VLC media player 2.0.8 TwoFlowers)
There are 2 different problems.
1st. (Most important)
I need to start the VLC player from the web interface (even if working directly on the server machine).
The aim is to generate a vlc video stream from a server machine, send it using UDP through a network which then returns it to the server.
Cutting off the network role, the server can stream the video to its own IP, to the port it is listening on.
I put these commands in a shell script:
video_flow.sh:
Code: Select all
#!/bin/sh
# Start vlc server listening on udp port 8000 (trying to pass the the x11 display to use)
/usr/bin/cvlc --x11-display :0 udp://@192.168.1.5:8000/0 &
sleep 1
# Start vlc client streaming to the server's ip and udp port 8000
/usr/bin/cvlc -I dummy /full/path/to/video.mpg --sout '#transcode{vcodec=h264,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:std{access=udp,mux=ts,dst=192.168.1.5:8000}' &
The trouble is that I need the script to be executed from the web interface.
video_flow.php:
Code: Select all
shell_exec("sh /full/path/to/video_flow.sh > /full/path/to/video_debug.log 2>&1 & echo $!;");
Code: Select all
> inhibit interface error: Failed to connect to the D-Bus session daemon: //bin/dbus-launch terminated abnormally with the following error: No protocol specified
Autolaunch error: X11 initialization failed.
...
> main interface error: no suitable interface module
...
> xcb_xv vout display error: parent window not available
...
I tried to export the display...
Code: Select all
export DISPLAY=:0
Code: Select all
/usr/bin/cvlc --x11-display :0 udp://USER_NAME:USER_PASSWORD@192.168.1.5:8000/0 &
Code: Select all
shell_exec('echo USER_PASSWORD | sudo –u USER_NAME –S "sh /full/path/to/video_flow.sh" > /full/path/to/video_debug.log 2>&1 & echo $!;');
If I grant connections to the X server to the network user www-data
Code: Select all
xhost +local:www-data
Code: Select all
> pulse audio output error: PulseAudio server connection failure: Connection refused
...
> alsa audio output error: cannot open ALSA device "default": No such file or directory
...
> main audio output error: no suitable audio output module
After that problem number 1 will be solved, it would be nice to have the video embedded into a web page, instead of having it playing in its original player window.
I've set VLC to use the http interface from the VLC GUI, preferences.
I've created an asx file on the apache server:
stream1.asx
Code: Select all
<ASX version ="3.0">
<TITLE>Stream1</TITLE>
<ENTRY>
<REF HREF="http://192.168.1.5:8000" />
</ENTRY>
</ASX>
flow.php
Code: Select all
<embed src="/full/path/to/stream1.asx" height="370" width="400">
Select file and stream http on defined port transcode to WMV/ASF with enough ttl
Code: Select all
:sout=#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:duplicate{dst=http{mux=asf,dst=:8000/},dst=display} :ttl=5 :sout-keep
Any help would be really appreciated.