conversion can be done on fly if you are targeting normal SD playback.I'd prefer not to have to reconvert 300+GB of movie files to .wmv's
Yes. VLC's current HTTP interface should support this via Flash player.would it be possible to have a fully-functional embedded video player in the browser, so that the user wouldn't necessarily need to have the VLC client installed.
The server only needs to be started once per PC startup (unless it, for some reason goes down, in which case it will need to be restarted).Start the server
1. Open the Microsoft command prompt - START>>RUN>>Type in cmd and hit Enter on the keyboard.
2. Navigate to the VLC installation folder. At the prompt type in cd c:\progra~1\videolan\vlc - which is in my case - the path to the default VLC installation. Of course it's not mandatory that you be in the VLC folder but this saves you some typing later.
3. Now at the prompt again type - vlc.exe -I telnet --control telnet --telnet-password q7fmZ9s --rtsp-host 0.0.0.0:5554
Let me explain what the parameters are:
-I - Enables the VLC telnet interface.
--control - Specifies the control interface
--telnet-password - Password to access the telnet interface - for security (if you dont set this option it defaults to "admin")
--rtsp-host - IP address (of the interface) and port on the streaming server on which media is to be streamed - 0.0.0.0:5554 means listen on this host on port 5554
4. Exit the command prompt by typing exit
Verify that the VLC server is running in the background with Task Manager. It must have VLC.exe in the processes list.
Now that the server is setup and the media is loaded, the client also needs to watch the media, which is also outlined in the above link, excerpt here:Add media to stream
1. Open Putty.exe
2. Connect to the streaming server with the following settings
a. Host - localhost
b. Port - 4212 (default port that VLC server listens for telnet connections - can be set with --telnet-port)
c. Connection Type - RAW (some versions of VLC might not work proper if you set it to Telnet)
3. When the VLC telnet console prompts you for a password - just enter the telnet password you'd set at the command prompt - q7fmZ9s
4. Now to add a movie to stream - at the telnet prompt type in
new myvod1 vod enabled input D:\path\to\movie.avi
and hit enter. You can change the myvod1 tag to anything you want since it's just a tag that users can identify your movie with. The last part however is the path to the actual movie on your hard disk. So you could even use
new a_walk_to_remember vod enabled input D:\path\to\a_walk_to_remember.avi
if you think that's more convenient.
That's all there is to it. You can add more movies using the same command and format - just make sure you have unique tags/names for each movie that you add to your list to stream.
If you've managed to get that to work so far, then it's proven that this php-interfaced media server should be implementable. First catch. When the server is restarted, any loaded media is "lost" - I'm sure that there must be a way to create a config file for this kind of thing though, so that every time the server needs to be started the most current config file with all available media is loaded.So how do users view it?
Well I'd recommend using the VLC client itself on the viewer's system, since a lot many media players have different implementations of the RTSP protocol. For example Windows Media player uses RTSP over RTP whereas VLC's implementation of the RTSP protocol is over TCP. So Windows Media player will not be able to play a VLC RTSP stream even though it supports the RTSP protocol.
1. Open VLC on the user's system and go to File>>Open Network Stream
2. Select the RTSP radio button and in the text box type in the IP address and port of the computer which has the VLC server running and append the tag name you specified after a slash. In our examples it would be.
192.168.1.1:5554/myvod1
or
192.168.1.1:5554/a_walk_to_remember
Code: Select all
"browse.js","browser.php","checkprocs.php","config.config2",
"doBrowse.php","index.php","loadfile.php","ajax.js"
Code: Select all
<?php
$run ="running";
$nrun ="stopped";
set_error_handler("warning_handler", E_WARNING);
function warning_handler($errno, $errstr) {
//echo "warning thrown, caught. Proceed";
}
function checkRTSP(){
global $run,$nrun;
$fp = fsockopen("localhost", 5555, $errno, $errstr, 2);
if (!$fp) {echo $nrun.",<a href=\"javascript:ajaxComm('startrtsp')>start</a>";}
else{echo $run.",<a href=\"javascript:ajaxComm('stoprtsp')>stop</a>";}
fclose($fp);
}
function startRTSP(){
shell_exec('c:\progra~1\videolan\vlc\vlc.exe -I telnet --control telnet --telnet-password rumman0679 --rtsp-host 0.0.0.0:5554 --vlm-conf "http://localhost:80/vlm.config"');
}
function stopRTSP(){
shell_exec('taskkill /F /IM vlc.exe /T');
}
if (isset($_GET['task']) && $_GET['task'] != "") {
$task = $_GET['task'];
switch($task){
case "rtsp": {checkRTSP(); break;}
case "startrtsp": {startRTSP(); break;}
case "stoprtsp": {stopRTSP(); break;}
}
}
?>
Code: Select all
<?php
function parent_directory($path, $convert_backslashes = false) {
// Detect backslashes
if( strstr($path, '\\') ) $backslash = true;
// Convert backslashes to forward slashes
$path = str_replace('\\', '/', $path);
// Add trailing slash if non-existent
if( substr($path, strlen($path) - 1) != '/' ) $path .= '/';
// Determine parent path
$path = substr($path, 0, strlen($path) - 1);
$path = substr( $path, 0, strrpos($path, '/') ) . '/';
// Convert backslashes back
if( !$convert_backslashes) $path = str_replace('/', '\\', $path);
return $path;
}
function showFolderContents($path,$search=""){
if (($path =="\\")||(strpos($path,"..")!==false)){$path="";}
$basepath = "E:\movies\\"; // this basepath is the highest that a user can travel in the directory structure
$basepath .= $path;
$dir_handle = @opendir($basepath) or die("Unable to open $path"); // Open the folder
$entries = scandir($basepath); // Load files and dirs into $entries
global $dirs;
global $files;
foreach($entries as $entry){ // separate files from dirs
if (is_dir($basepath.$entry)){
$dirs[] = $entry;
}
else{
$files[] = $entry;
}
}
$mustSearch = false;
if (strlen($search)>0){ // check if a search string is being used
$mustSearch = true;
}
if (count($dirs) > 0){
natcasesort($dirs); // natural sort dirs, case insensitive
foreach($dirs as $dir){
if ($dir == ".."){ // if it's the parent folder
if ((strlen($path)!=0)) { //check to see if we're in the "root" folder
echo "<a class=\"dir\" href=?path=".urlencode(parent_directory($path)).">Directory Up</a><br/>";
}
}else{
if($dir!= "."){
if ($mustSearch){
if (stripos($dir,$search) !== false){
echo "<a class=\"dir\" href=?path=".urlencode($path).urlencode($dir)."\\>".$dir.'/</a><br />';
}
}
else {
echo "<a class=\"dir\" href=?path=".urlencode($path.$dir)."\\>".$dir.'/</a><br />';
}
}
}
}
}
if (count($files) > 0){
natcasesort($files); // natural sort files, case insensitive
foreach($files as $file){
$regexp = "/^.+\.((wmv)|(mkv)|(avi)|(mpg))$/";
if (preg_match($regexp,$file)){
if ($mustSearch){
if (stripos($file,$search) !== false){
echo "<a class=\"file\" href=\"loadfile.php?path=".$basepath.$file."\">".$file.'</a><br />';
}
}else{
echo "<a class=\"file\" href=\"loadfile.php?path=".$basepath.$file."\">".$file.'</a><br />';
}
}
}
}
// Close
closedir($dir_handle);
}
if (isset($_GET['path']) && $_GET['path'] != "") {
$path = $_GET['path'];
}
else {$path="";}
if (isset($_GET['search']) && $_GET['search'] != "") {
$search = $_GET['search'];
//echo "searching<br />";
showFolderContents($path,$search);
}
else {showFolderContents($path);}
Code: Select all
<?php
function checkConfig($path){
$cfgpath="http://localhost:80/vlm.config"; //location of the config file we're using
$cfgfile = file($cfgpath);
$flag=false;
foreach($cfgfile as $line){ //search through file for identifying string
if (strpos($line,$path)){
$flag = true;
}
}
$name = explode("\\",$path);
$name = $name[count($name)-1];
$name = substr($name,0,strlen($name)-3);
$name = str_replace(" ","",$name);
$name = str_replace(".","",$name);
$name = str_replace("_","",$name);
if (!$flag) { //if identifying string not found
$fp = fsockopen("localhost",5555,$errno,$errstr);
stream_set_timeout($fp,5);
if (!$fp){
echo "error connecting to RTSP server";
}
else{
$flag = false;
echo "connected to host via telnet<br />";
do{
fwrite($fp,"rumman0679\n"); //password
fwrite($fp,"new ".$name." vod enabled\n"); //add vod with generated name
fwrite($fp,"setup ".$name." input \"".$path."\"\n"); //add vod path
fwrite($fp,"show\n"); //check if vod added
sleep(1); //wait for server to put output
$output = '';
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
echo "Checking file exists<br />";
$flag = stripos($output,$path);
}while(!$flag);
fclose($fp);
echo "file sucessfully added to list ";
$cfgfile = fopen($cfgpath,"a");
fwrite($cfgfile,"\nnew ".$name." vod enabled"); //load into the VOD config file
fwrite($cfgfile,"\nsetup ".$name." input \"".$path."\"");//load into the VOD config file
fclose($cfgfile); //close the config file
}
}
echo "<a href=\"rtsp://localhost:5554/".$name."\">play movie</a>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<link href="/css/template_css.css" rel="stylesheet" type="text/css" media="screen"/>
<title>Processing request</title><meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
</head>
<body>
<div id="main">
<p><h2>Your request is being processed</h2></p>
<?php
if (isset($_GET['path']) && $_GET['path'] != "") {
$path = $_GET['path'];
checkConfig ($path);
}
?>
</div>
</body>
Code: Select all
c:\progra~1\videolan\vlc\vlc.exe -I telnet --control telnet --telnet-port 5555 --telnet-password rumman0679 --rtsp-host 0.0.0.0:5554
Code: Select all
echo "connected to host via telnet<br />";
do{
fwrite($fp,"rumman0679\n"); //password
fwrite($fp,"new ".$name." vod enabled\n"); //add vod with generated name
fwrite($fp,"setup ".$name." input \"".$path."\"\n"); //add vod path
fwrite($fp,"show\n"); //check if vod added
sleep(1); //wait for server to put output
$output = '';
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
$output.= stream_get_line($fp,8192,">")."<br /><br /><br />";
echo "Checking file exists<br />";
$flag = stripos($output,$path);
}while(!$flag);
Code: Select all
echo $output."<br />\n";
Code: Select all
echo "Checking file exists<br />";
Code: Select all
new testmedia
Code: Select all
setup testmedia /path/to/file
Code: Select all
show
Code: Select all
fwrite($fp,"new ".$name." vod enabled\n"); //add vod with generated name
fwrite($fp,"setup ".$name." input \"".$path."\"\n"); //add vod path
Code: Select all
echo "new ".$name." vod enabled<br />\n";
echo "setup ".$name." input \"".$path."\"\n";
Return to “VLC media player for Windows Troubleshooting”
Users browsing this forum: No registered users and 74 guests