-
1Step 1
Server Controls:
The real tricky part here is starting VLC from the web, as a user, that will allow outside connections.
My solution was to configure Apache to have user pages. I then placed the server controls in /home/username/public_html/cgi-bin
http://httpd.apache.org/docs/2.2/howto/public_html.html
-
2Step 2
VLC:
Live transcoding is resource intensive, making it nice to be able to turn it on and off. Also switching the VLC configurations allows for many variations of size and quality, useful in tailor the stream to different devices and scenarios. Below are the commands I use.
Mobile:
nohup cvlc v4l2:///dev/video0 :input-slave=alsa://hw:1,0 --sout '#transcode{vcodec=FLV1,scale=.5,fps=15,vb=400,acodec=mp3,ab=64,channels=1,samplerate=44100}:std{access=http,dst=:8080/stream.flv}' > /dev/null 2>&1 &
This stream is around 30kbs per second so it usually works on 3g, and it works very well on small screens over wifi. You can see it running in the first and second pictures. Works well with Wondershare player on Android.
DIVX:
nohup cvlc v4l2:///dev/video0 :input-slave=alsa://hw:1,0 --sout '#transcode{vcodec=divx,vb=2000,acodec=mp3,ab=64,channels=1,samplerate=44100}:http{mux=asf,dst=:8080/stream.avi}'
This is what I use if I want to watch a game on my Netbook while I'm on the PlayStation. Picture 6.
WMV:
nohup cvlc v4l2:///dev/video0 :input-slave=alsa://hw:1,0 --sout '#transcode{vcodec=WMV2,vb=2000,scale=.7,acodec=wma2,ab=64,channels=1,samplerate=44100}:http{mux=asf,dst=:8080/stream.wmv}' > /dev/null 2>&1 &
HQ Flash:
nohup cvlc v4l2:///dev/video0 :input-slave=alsa://hw:1,0 --sout '#transcode{vcodec=FLV1,vb=2300,acodec=mp3,ab=64,channels=1,samplerate=44100}:std{access=http,dst=:8080/stream.flv}' > /dev/null 2>&1 &
-
3Step 3
LIRC Web Interface
http://home.comcast.net/~tomhorsley/wisdom/lirc/lirc.html
I re-purposed Tom's code to run my VLC server commands as well.
-
4Step 4
This is the code I used for the right frame in the first picture.
#!/usr/bin/perl
#
use CGI qw/:standard/;
use URI::Escape;
my $cols = 3;
my %button_codes;
$button_codes{'1'}='BTN_1';
$button_codes{'2'}='BTN_2';
$button_codes{'3'}='BTN_3';
$button_codes{'4'}='BTN_4';
$button_codes{'5'}='BTN_5';
$button_codes{'6'}='BTN_6';
$button_codes{'7'}='BTN_7';
$button_codes{'8'}='BTN_8';
$button_codes{'9'}='BTN_9';
$button_codes{'0'}='BTN_0';
$button_codes{'Ch-'}='KEY_CHANNELDOWN';
$button_codes{'Ch+'}='KEY_CHANNELUP';
if (param()) {
my $button_name = param('button_name');
my $button_code = $button_codes{$button_name};
system("irsend SEND_ONCE --count=2 radioshack '$button_code'");
}
my @button_names = sort(keys(%button_codes));
my $i;
print header,
start_html(-title=>'IRMON_RSC Buttons',
-style=>{'src'=>'/styles/bigbuttons.css'},),
start_form,
"<table border=\"0\" cellpadding=\"5\">\n";
while (scalar(@button_names) > 0) {
print "<tr>\n";
for ($i = 0; $i < $cols; ++$i) {
print "<td>";
if (scalar(@button_names) > 0) {
my $b = shift(@button_names);
print submit(-name=>'button_name',-value=>$b);
} else {
print ' ';
}
print "</td>";
}
print "</tr>\n";
}
print "</table>\n",
end_form,
'<br>',
'<br>',
'<br>',
'<a href="http://xxx.xxxxxx.org/xxxxx/index.html" target="_top">Back</a>',
end_html;
-
5Step 5
And this is the left frame.
<html><head>
<base TARGET="_top">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- A minimal Flowplayer setup to get you started -->
<!--
include flowplayer JavaScript file that does
Flash embedding and provides the Flowplayer API.
-->
<script type="text/javascript" src="flowplayer-3.2.10.min.js"></script>
<!-- page title -->
<title>flowplayer</title>
</head><body>
<!-- this A tag is where your Flowplayer will be placed. it can be anywhere -->
<a
href="http://xxx.xxxxxx.org:8080/stream.flv"
style="display:block;width:320px;height:240px"
id="player">
</a>
<!-- this will install flowplayer inside previous A- tag. -->
<script>
flowplayer("player", "flowplayer-3.2.11.swf");
</script>
</body></html>
-
6Step 6
Check Server Status:
#!/bin/sh
##echo "Content-type: text/plain"
echo "Content-type: text/html\n"
echo "<html>"
echo "<head><title>Check Server</title></head>"
echo "<body>"
if ps -C vlc > /dev/null
then
echo "<h1>VLC is running</h1>"
else
echo "<h1>No server found</h1>"
fi
echo "<br>"
echo "<a href="http://xxx.xxxxxx.org/xxxxx/index.html" target="_top">Back</a>"
echo "</body>"
echo "</html>"
-
7Step 7
#!/bin/bash
##recording1.sh
irsend SEND_ONCE --count=2 radioshack BTN_4
irsend SEND_ONCE --count=2 radioshack BTN_6
mencoder tv:// -tv driver=v4l2:norm=NTSC_M:width=720:height=480:outfmt=uyvy:device=/dev/video0:input=0:fps=25:buffersize=16:alsa:amode=1:forcechan=2:audiorate=48000:adevice=plughw.1,0:forceaudio:immediatemode=0 -msglevel all=9 -ffourcc DX50 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:turbo:vbitrate=1200:keyint=15 -vf pp=lb,scale=640:480 -oac mp3lame -endpos 01:00:00 -o thecloser.avi
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.