Videolan TV-Streaming and remote channel changing SUCCESSFUL

About encoding, codec settings, muxers and filter usage
scoutice

Videolan TV-Streaming and remote channel changing SUCCESSFUL

Postby scoutice » 31 Jan 2005 11:55

hi there! i just made it to use videolan as streaming server with remote channel changing without remote desktop, vnc or other remote desktop software:

what i did:
i've taken the latest nightly build (why: it supports the channel settings using the commandline, it's not implemented in 0.8.1 yet).

i've installed a webserver (e.g. http://www.jana-server.de (freeware)) and a scripting engine ([url]www.php.net[url]).
the webserver now can start the videolan client remotely using the commandline parameters for streaming and channel selection.
the webserver can stop the vlc using kill.exe (included in nt-resource kitt, search for kill.exe in google).

what it supports:
enable localplay / only streaming
set audio/video coded and bitrate
file streaming
udp streaming

what you have to do:
install server (web+php)
edit pages (use your path settings, set channels, directshow device (tv-card))
download nighly build or 0.8.?? (where the commandline options --dshow-tuner-channel and --dshow-tuner-country are supported

a sample commandline-call:

Code: Select all

start c:\Programme\VideoStream\VLC\vlc.exe --intf=http --http-host=127.0.0.1:9001 dshow:// --dshow-vdev="TV Capture Card Capture" --dshow-adev="SB Live! Wave Device" --dshow-tuner-channel=44 --dshow-tuner-country=43 --dshow-tuner-input=1 --dshow-chroma=I420 :sout=#transcode{vcodec=DIV3,vb=192,acodec=mp4a,ab=16,channels=2,scale=1}:duplicate{dst=std{access=udp,mux=ts,url="192.168.1.247:1234"}}
i hope to give all of your hungry people for remote channel changing a clue how to do this. if you have any additionaly questions, feel free to ask. i'll answer here in the forum. my mailadress is: thomas _at _ familie _hyphen_ hofer _dot_ net
but please dont ask me questions about installing and running a webserver and/or php or accessing it from out of your lan. just see the other threads or newsgroups for this or ask your sysadmin

have fun, yours, thomas

i will attach the source codes in the following:

control.php
this is the main html page. it's in php for enabling the script to sniff the client's ip adress, so it can already fill it in the input field for udp-streaming

Code: Select all

<html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <base target="status"> </head> <body> <p> <form name="start" action="start.php" method="post"> </p> <img src="televisiontuner.gif" align="left" height="50" width="52"><H1>Steuerung</H1> <p> <select name="vdevice" size="1"> <option value="TV Capture Card Capture">TV Capture Card Capture</option> </select> <select name="adevice" size="1"> <option value="SB Live! Wave Device">SB Live! Wave Device</option> </select> <input type="checkbox" name="localplay" value="yes" checked="checked">lokal <hr> </p> <img src="channels.gif" align="left" height="50" width="54"><H1>Kanal</H1> <p> <select name="channel" size="1"> <option value="41">ORF 1</option> <option value="44">ORF 2</option> <option value="51">ATV+</option> <option value="85">ARD</option> <option value="76">ZDF</option> <option value="72">RTL</option> <option value="63">RTL2</option> <option value="131">Super-Rtl</option> <option value="80">Sat1</option> <option value="94">Pro7</option> <option value="112">VOX</option> <option value="122">Kabel1</option> <option value="0"></option> <option value="38">3Sat</option> <option value="89">SF1</option> <option value="0"></option> <option value="57">LT 1</option> <option value="54">Liwest Info</option> <option value="0"></option> <option value="119">MTV</option> <option value="133">GO!</option> <option value="0"></option> <option value="102">DSF</option> <option value="106">Eurosport</option> <option value="0"></option> <option value="127">CNBC</option> <option value="60">CNN</option> <option value="98">BBC</option> <option value="0"></option> <option value="91">BR3</option> <option value="117">BW</option> <option value="129">n-tv</option> <option value="141">NDR</option> <option value="143">MDR</option> <option value="109">Kinderkanal</option> <option value="0"></option> <option value="145">AstroTV????</option> <option value="0"></option> <option value="135">9-live</option> <option value="124">Home Shopping</option> <option value="137">TV5</option> <option value="139">Rai-Uno</option> </select> <hr> </p> <img src="streaming.jpg" align="left" width="59" height="50"><H1>Streaming</H1> <p> <table border="0"> <tr><td><input type="radio" name="streaming" value="none" onClick="document.start.filename.disabled=true;document.start.udptargethost.disabled=true;document.start.udptargetport.disabled=true;"> kein</td><td></td></tr> <tr><td><input type="radio" name="streaming" value="file" onClick="document.start.filename.disabled=false;document.start.udptargethost.disabled=true;document.start.udptargetport.disabled=true;"> in Datei</td><td>Dateiname <input type="text" name="filename" size="20" value="default.temp" disabled="disabled"> (Freigabe: \\zwettl\streaming\)</td></tr> <tr><td><input type="radio" name="streaming" value="udp" checked="checked" onClick="document.start.filename.disabled=true;document.start.udptargethost.disabled=false;document.start.udptargetport.disabled=false;"> zu Computer</td><td>IP-Adresse <input type="text" name="udptargethost" size="20" value="<?php echo (getenv ("REMOTE_ADDR"));?>"> Port <input type="text" name="udptargetport" size="5" value="1234"></td></tr> </table> <hr> </p> <img src="icon_configure.jpg" align="left" height="50" width="45"><H1>Quality Settings</H1> <p> <table border="1"> <tr> <td> Video: Bitrate </td><td> <select name="vbr" size="1"> <option>64</option> <option>128</option> <option selected="selected">192</option> <option>256</option> <option>384</option> <option>512</option> <option>768</option> <option>1024</option> <option>1536</option> <option>2048</option> <option>4096</option> <option>8192</option> <option>16384</option> </select> </td><td> Codec </td><td> <select name="vcodec" size="1"> <option>mp3v</option> <option>DIV2</option> <option selected="selected">DIV3</option> </select> </td></tr> <tr><td> Audio: Bitrate </td><td> <select name="abr" size="1"> <option>4</option> <option>8</option> <option selected="selected">16</option> <option>32</option> <option>64</option> <option>128</option> <option>192</option> <option>256</option> </select> </td><td> Codec </td><td> <select name="acodec" size="1"> <option selected="selected">mp4a</option> <option>a52</option> </select> </td></tr> <tr><td> Skalierung </td><td> <select name="scale" size="1"> <option value="1" selected="selected">100%</option> <option value="0.75">75%</option> <option value="0.5">50%</option> <option value="0.25">25%</option> </select> </td><td> </td><td> </td></tr> </table> <hr> </p> <table border="0" align="center"> <tr> <td> <button type="submit" style="width:120px;height:50px"> <p align="center" style="font-size:8pt"><img src="play.gif" width="20" height="20"><br>start</p> </button> </form> </td> <td> <form action="stop.php" method="post"> <button type="submit" style="width:120px;height:50px"> <p align="center" style="font-size:8pt"><img src="stop.gif" width="20" height="20"><br>stop</p> </button> </form> </td> </tr> </table> <hr> </p> </body> </html>
stop.php
it stops the vlc by killing it's task:

Code: Select all

<html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <?php //first kill running vnc process exec("kill.exe vlc.exe"); ?> <p class="status">gestoppt...</p> </body> </html>
start.php
it starts the vlc using the parameters in passed from control.php

Code: Select all

<html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <p class="status">Parameter: <?php $streamdir = "c:\\Programme\\VideoStream\\Streaming\\"; $dir = "c:\\Programme\\VideoStream\\VLC\\"; $command = "vlc.exe"; $httpserver = ""; $directshow = ""; $stream = ""; //first kill running vnc process exec("kill.exe vlc.exe"); if (isset($_POST['localplay'])) { echo ("lokal:ja "); // $httpserver = "--extraintf=http --http-host=127.0.0.1:9001"; $httpserver = ""; } else { echo ("lokal: nein "); $httpserver = "--intf=http --http-host=127.0.0.1:9001"; } $directshow = "dshow:// --dshow-vdev=\"" . $_POST['vdevice'] ."\" --dshow-adev=\"". $_POST['adevice'] . "\" --dshow-tuner-channel=" . $_POST['channel'] . " --dshow-tuner-country=43 --dshow-tuner-input=1 --dshow-chroma=I420"; if ($_POST['streaming'] == "none") { echo ("stream: kein"); } else { //:sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mp3,ab=192,channels=2}:duplicate{dst=std{access=file,mux=ts,url="c:\temp\file.txt"}} //:sout=#transcode{vcodec=DIV3,vb=1024,scale=1,acodec=mp3,ab=192,channels=2}:duplicate{dst=std{access=file,mux=ts,url="c:\temp\file.txt"}} //:sout=#transcode{vcodec=DIV3,vb=1024,scale=1,acodec=mp4a,ab=192,channels=2}:duplicate{dst=std{access=file,mux=ts,url="c:\temp\file.txt"}} //:sout=#transcode{vcodec=DIV3,vb=256,scale=1,acodec=mp4a,ab=64,channels=2}:duplicate{dst=std{access=file,mux=ts,url="c:\temp\file.txt"}} //:sout=#transcode{vcodec=DIV3,vb=256,scale=1,acodec=mp4a,ab=64,channels=2}:duplicate{dst=std{access=file,mux=raw,url="c:\temp\file.txt"}} //:sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=display,dst=std{access=file,mux=ts,url="c:\temp\aa.avi"}} //:sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=udp,mux=ts,url=192.168.1.1:1234}} $stream = ":sout=#transcode{vcodec=" . $_POST['vcodec'] .",vb=" . $_POST['vbr'] . ",acodec=" . $_POST['acodec'] .",ab=" . $_POST['abr'] . ",channels=2,scale=". $_POST['scale'] ."}"; $stream = $stream . ":duplicate{"; if (isset($_POST['localplay'])) { $stream = $stream . "dst=display,"; } if ($_POST['streaming'] == "file") { echo ("file " . $_POST['filename'] . " "); $stream = $stream . "dst=std{access=file,mux=ts,url=\""; $stream = $stream . $streamdir; $stream = $stream . $_POST['filename']; $stream = $stream . "\"}}"; } else if ($_POST['streaming'] == "udp") { echo ("udp (".$_POST['udptargethost'] . ":" .$_POST['udptargetport'].") "); $stream = $stream . "dst=std{access=udp,mux=ts,url=\""; $stream = $stream . $_POST['udptargethost'] . ":" .$_POST['udptargetport']; $stream = $stream . "\"}}"; } } $commandline = "start " . $dir . $command . " " . $httpserver . " " . $directshow . " " . $stream; echo ("<br><b>" . $commandline . "</b>"); pclose(popen($commandline, "r")); ?> </p> </body> </html>

[/code]

scoutice

files

Postby scoutice » 31 Jan 2005 14:04

i put the necessary files on the web:
http://thomas.familie-hofer.net/vlcinterface.rar

you can download it and use it for whatever you want.

scoutice

Any Comments?

Postby scoutice » 04 Feb 2005 10:20

Has anyone already tried to copy my ideas and sourcecode? has anybody comments? was anybody able to run the scripts? or were there any big isses, which you were not able to deal with?

ps: soon there will be a extendes version, which checks, if vlc is already running and writes a log-file.

many greetings, thomas

sunwyl
New Cone
New Cone
Posts: 3
Joined: 26 Jan 2005 02:23

Help!

Postby sunwyl » 05 Feb 2005 01:46

But I can't download those files that you provided. It showed I have no right .I hope you can help me !
Thank you very much!

lolkiller

Postby lolkiller » 06 Feb 2005 22:33

Hey, this sounds good !

But, even if installing a php server is easy for me, some things remain obsur for me.

For example : how do you know the name of your directshow device ?

lolki

Postby lolki » 06 Feb 2005 22:49

But this is for linux, right ?

Any idea on how to do that under Windows ?

markfm
Big Cone-huna
Big Cone-huna
Posts: 1536
Joined: 22 Feb 2004 17:42

Postby markfm » 06 Feb 2005 23:15

That's windows -- dshow is a windows thing.

As to the proper device names, for audio device and video device:
Launch VLC, normal wxwindows GUI.
Do a File -- Open Capture Device
Select Refresh next to Video device, then use the dropdown list to select the device.
Select Refresh next to Audio device,....
Left click once in the area at the top of the screen so that it does a Select (turns the background blue) -- it contains the proper "call" to select your desired audio and video devices -- and press Ctrl-C to copy it into your Clipboard.

Open whatever text editor you use (Notepad, Crimson Editor,...) and do a CTRL-V to paste the info in.

(If you wish to selct the device's directshow video size, enter a value like 320x240 in the space provided, the command at the top of the screen will also contain that info.)

scoutice

Postby scoutice » 07 Feb 2005 16:01

it's for windows.
alternative download link: http://members.liwest.at/scoutice/thoma ... erface.rar

>For example : how do you know the name of your directshow device ?
all you need is provided by the VLC-Gui. Just open the VLC in the GUI-mode and run your tv-card. There you find the exact name of the direct show device.

BTW: i am just writing an extension for managing a videorecorder with vlc, windows has all the stuff you need, a command line interface for the scheduler for example ("schtasks"). i am currently testing, but it seems to work already relatively fine.
I will update the source after a short testing periode, i think end of this week will be fine.

Actually the scripts I provided are not well documented and for setting up you will need some knowledge in HTML and PHP as well. After it really has all features I need, I will concentrate on a setup-tutorial and one or more .ini files as central position where to set all the values needed, so also people with no PHP and HTML knowledge can use this scripts.

Guest

Postby Guest » 07 Feb 2005 21:17

what about adding a transition between channel switching...

scenerio :
1-) you have a vlc process streaming
2-) you have another vlc process streaming something else from a different port
3-) user switches the channel
4-) the transition process switches (does not kill) process 1 and switches to next channel with a dissolve

I think, in this case, there should be streamA (channel 1), streamB (channel 2) and a special stream process, who decides how to switch....

fun hu` ?

2K

Guest

Channel Transition

Postby Guest » 08 Feb 2005 10:07

hi! channel transition is a t the moment not possible (i think). either you need two tv-cards. but how do you know, which channel the user will select before he actually does ist? at the moment VLC is not able to change the channel during runtime, so the only possibilty is to kill its taks and to restart it.

Unfortunately it is mandatory that the first task really stopped using the tv card before the new task starts, otherwise the new taks (new channel) does not get access to the tv card.

But one idea would be to start a streaming vlc which streams a nice video indicating a channel switch, but this also would increase the (already not so fast) channel switching time.

btw: yesterday my videorecorder made its first recording (not a test anymore) and i am hoping to watch this recording today evening.

And i updated the sources to download. If the direct download does not work, just visit my homepage and follow the link to vlc streaming there.
http://thomas.familie-hofer.net

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

download-urls

Postby scoutice » 08 Feb 2005 17:26

v0.1
initial version (uncommented scripts, only streaming functionality
http://members.liwest.at/scoutice/thoma ... ming01.rar

v0.2
a little bit documented, only one configuration file (configuration.ini), contains videorecording functionality.
http://members.liwest.at/scoutice/thoma ... ming02.rar

Installation Guide:
1. Install a webserver, install PHP and configure both
2. Install a VLC (latest nightly build), of, when available, version 0.8.2 (once more: IT WILL NOT WORK WITH VERSION 0.8.1!)
3. Unpack vlc_streaming02.rar somewhere to your local hard disk
4. Set the webserver's home directory to the "webinterface" directory.
5. Edit "configuration.ini"; edit the path settings, edit the settings for tv-card and audio-input, edit the local username (mandatory for videorecorder) and finally edit your country and the channels. don't forget to update the channel_count!
6. Copy taskkill, tasklist and schtasks from windows\system32 to the "webinterface" directory. if you do not find these files, get it from a Windows XP Professional edition or somewhere else.
7. Start a webbrowser (i recommend firefox *gg*) and use it to control your VLC. (if standard installation of the webserver, normally this should be "http://localhost").

Following steps are optional to improve the look and feel (They will be obsolete in further versions, when the rights of the images are checked)
8. Copy channel thumbnails to webinterface\channellogos. (you get channel logos within the channel selection box (firefox only) name it xxx.gif, where xxx is the channel number (e.g. if you have BBC on channel 45, name the graphic "45.gif")
9. Copy images thumbnails to webinterface\images


License
VLC_Streaming_Recording is free and released under the GNU General Public License.

Runtime Environment
Runs under Windows XP Professional, Windows 2000 Professional (on home edition you have to download only 3 files to make it working, see installation notes).
Scripts would be easily adapted to run under linux (see configuration.ini)

mattgoody

Postby mattgoody » 11 Feb 2005 01:59

what is the streaming directory?

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

directories

Postby scoutice » 11 Feb 2005 09:44

sorry for the bad documentation.

the streaming directory is the directory, where files will be streamed to, when you select "stream to file" or where files are stored, when the videorecorder runs.
also the meta-files for the videorecording will be temporarily stored. i moved the streaming directory to the root directory of the scripts, so it is now part of the .rar-file.

i am currently updating the http://members.liwest.at/scoutice/thoma ... ming02.rar , so it will be available in a few minutes.

yours, thomas

mattgoody

Postby mattgoody » 14 Feb 2005 05:33

I think ive gotten everything to work, except that when the thing starts it has a slash before the ' (apostrophe) in my capture cards name. i fixed it by putting a variable in start.inc without that slash and telling it to use that variable instead of $_GET['vdevice'] in the line of code that puts the command line together... just wondering if i can do this a better way?

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

Postby scoutice » 14 Feb 2005 07:56

hmm, that is strange. where does the slash come from? have a look at index.php in the line

Code: Select all

<option value="<?php echo $video_device; ?>"><?php echo $video_device; ?></option>
is there some difference? because here the value for the capture card is taken ans used. to you have any special characters in your tv card's name (exept blanks, they work).

is the slash already in the HTML of index.php, when you open it with the webbrowser?

yours, thomas

mattgoody

Postby mattgoody » 16 Feb 2005 00:52

No, the only special character in the name is the ' also there are no slashes when it echoes it to the option box. I was thinking that mayb when the variable is passed to different pages, it adds slashes?

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

\-fix

Postby scoutice » 16 Feb 2005 09:33

no, the problem is the '
for some reason php adds a \ in front of a ' when submitting it in the form. i fixed it using urlencode and urldecode and thus masking the '

you can download the new files now, if you want. only index.php and start.inc was changed

mattgoody

Postby mattgoody » 16 Feb 2005 21:39

thanx a lot! u have done a great job with this whole projectr

Guest

Questions

Postby Guest » 18 Feb 2005 08:19

Sorry for my question but i am not so familiar with webservers etc.. The webserver e.g. JanaServer and PHP has to be installed on the machine where the TV-Card is installed. Am i right? The machine where the TV-signal is streamed to can connect to the webserver via a browser (Firefox) to start respectively kill vlc on the server machine and thereby change the vlc settings. Is this correct?

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

Postby scoutice » 18 Feb 2005 09:24

you got it! everything you said is absolutely right. you can use a normal browser to connect to the pc, where the tv-card and vlc is running and can use the browser to remotely change the settings of the vlc.

btw: you do not have to have vlc installed on the pc where you want to view, you also can use your normal webbrowser, when you have windows media player 7 or later installed. (not only IE, also Netscape, Mozilla and Firefox, but only Windows Platforms). But: Quality is better with VLC ;-)

Guest

Postby Guest » 18 Feb 2005 21:01

Hey scoutice,

can you recommend me a tv-card that I could buy to do what you are saying?

I'm kind of newbie, and I wouldn't like to buy the wrong one.

Thanks

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

TV Card

Postby scoutice » 19 Feb 2005 16:19

Actually I cannot recommend you a tv-card, because the tv-card-thing is also very new to me! i got the tv-card i use (Medion MD9415) only 4 days before I started to write the streaming-software. But it should work with any TV-Card which supports direct-show drivers under windows.

And I think, every TV-card does this, but don't blaim me for that. Definitely the streaming works with every tv-card which is supported by VLC. Please, other forum-readers, help us anwering this question.

For me, i use an old Medion MD9415 TV Card, based on an BT878 chipset. This chipset is quite common for TV-cards.

yous, greetings, thomas

Jonas

Next step: WAP

Postby Jonas » 24 Feb 2005 09:37

Really, really cool!

I havent tried this yet, but will as soon as I get some time over in the next couple of weeks.

Just wanted to air an idea which probably is quite easy to implement. (?)

When you have a web server its quite easy to make it work like a WAP server. (WAP is excellent for surfing on mobile phones).
A very simple WAP page where you can select channel to record and for how long, would be great and probably not to difficult to implement. (I know very little of web/wap development, but I hope its easy, dont know how PHP affect this?)

Think of how cool that would be! At the pub, you remember you now will miss the start of the fotball game. Up with the phone and within 15 seconds, you started recording it to your hardrive. Imagine the the expressions of your friends :-)

Any comments??

/Jonas
Stockholm, sweden

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

Postby scoutice » 24 Feb 2005 09:53

Cool idea! But I never developed WAP-pages, so i cannot estimate the needed effort, as well I am not sure, what a WAP-server is. It is an own protocol, or does it use http and it is only WML, which replaces HTML?

If it is a simple http-server, i am sure I can create these pages, this should not be a great effort.

I can imagine that it makes sense and I am sure, this also could be cool. I will inform myself (or does anyone know answers to the above questions?) what wap is and develop the pages.

if you want to test it, before it is officially released, just post it here in the forum or write a private message.

yours, greeetings, thomas / austria

scoutice
Blank Cone
Blank Cone
Posts: 44
Joined: 07 Feb 2005 17:07
Location: Austria / Linz
Contact:

WAP Control vor Videorecorder soon

Postby scoutice » 24 Feb 2005 12:55

ok, checked it. you can access wappages on a simple http-server, and wml is really simple. I will add the wap-support on the weekend, I think, it will be possible in a few hours to create the pages.

I will report it here, when I am finished. The sourcecode will then be updated. Any other ideas?

Anyone already using my pages?


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 14 guests