LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2011, 07:55 PM   #1
Spac3
LQ Newbie
 
Registered: Oct 2011
Distribution: Ubuntu 10.04
Posts: 2

Rep: Reputation: Disabled
Question Trying to setup Automated "Video on Demand" with VLC. Ubuntu 10.04 Desktop


Hi,
I'm tring to setup an Automated VoD (Video on Demand) system, but having some newbie issues.

### The product ###
You connect to the servers' web interface.
Look at the list of Movies/Shows, copy the VoD link for your desired movie into VLC and play.

There is 2 reasons I want to do this.
A) I cannot find a Linux server/service that does something similar, witch does not give me codex problems.
B) My brother keeps on copying shows/movies to other PCs to watch, but does not delete it when he's done. (Duplicates all over the network)

### FYI ###
I've got a nice little GB lan running at home with a "server" (Ubuntu 10.04 LTS).
This box contains Apache,PHP,MySQL and VLC. (Relevant to this project)

### What I've managed to do so far ###
I've managed to successfully setup VLC with VoD with the following:

The "stream" you see below will be replaced with the "VoD number" from the array. (Mentioned in below "What I need")

$ sudo vlc-wrapper --intf telnet
$ telnet 127.0.0.1 4212
<login>
$ new stream vod enabled
$ setup stream input video.avi

I can now access this from any box with VLC. (rtsp://192.168.1.2:5554/stream)
The Web server is also fully up and running.

### The gaps ###
-Need to make a file listing (for the array for VLC).
|- The best I found is, ls -1 -R
\_ The problem is that it (ls) lists the directories and then only the files names in that directory .

-Get a why to pass the "Telnet output" file to telnet. Command per line. (Mentioned in below "What I need")

-Find a why to run 1 file witch will when:
|-get the file listing
|-start VLC (VLC occupies the terminal until VLC quits)
\_then telnet add the media (all the VoD entries from the "Telnet output" file) (Mentioned in below "What I need")

### What I need ###
Cron Job that:
-lists(array) all my video files in a folder (recursive).

-Give each file a VoD number (Auto-increase), used in VLC.
|-Telnet add (output to a file) it to the "Media server" and add it to the HTML listing.

-The HTML listing must have 2 columns.
|- URL to that VoD file
\_ The name of that VoD file

-Result
|- HTML file that contains file listing ("rtsp://192.168.1.2:5554/movie001" , "The epic movie")
\_ TXT file that must be passed to Telnet (Telnet for VLC) to add those files.

### Thoughts ###
Hope this post made sense, I tried posting in sections for the different views of the script. (for understanding)
I think once this script is working, it'll be nice as the VoB list will auto update (cron job).
I wish there was only 1 programming language that works everywhere and in everything :P
For someone that knows linux bash coding, this should be relatively easy. (I think)

____________________
Spac3
 
Old 11-18-2011, 03:34 AM   #2
davemguru
Member
 
Registered: Apr 2006
Location: London
Distribution: Pclos,Debian,Puppy,Fedora
Posts: 87

Rep: Reputation: 42
Quote:
Originally Posted by Spac3 View Post
Hi,
I'm tring to setup an Automated VoD (Video on Demand) system, but having some newbie issues.

### The product ###
You connect to the servers' web interface.
Look at the list of Movies/Shows, copy the VoD link for your desired movie into VLC and play.

There is 2 reasons I want to do this.
A) I cannot find a Linux server/service that does something similar, witch does not give me codex problems.
B) My brother keeps on copying shows/movies to other PCs to watch, but does not delete it when he's done. (Duplicates all over the network)

### FYI ###
I've got a nice little GB lan running at home with a "server" (Ubuntu 10.04 LTS).
This box contains Apache,PHP,MySQL and VLC. (Relevant to this project)

### What I've managed to do so far ###
I've managed to successfully setup VLC with VoD with the following:

The "stream" you see below will be replaced with the "VoD number" from the array. (Mentioned in below "What I need")

$ sudo vlc-wrapper --intf telnet
$ telnet 127.0.0.1 4212
<login>
$ new stream vod enabled
$ setup stream input video.avi

I can now access this from any box with VLC. (rtsp://192.168.1.2:5554/stream)
The Web server is also fully up and running.

### The gaps ###
-Need to make a file listing (for the array for VLC).
|- The best I found is, ls -1 -R
\_ The problem is that it (ls) lists the directories and then only the files names in that directory .

-Get a why to pass the "Telnet output" file to telnet. Command per line. (Mentioned in below "What I need")

-Find a why to run 1 file witch will when:
|-get the file listing
|-start VLC (VLC occupies the terminal until VLC quits)
\_then telnet add the media (all the VoD entries from the "Telnet output" file) (Mentioned in below "What I need")

### What I need ###
Cron Job that:
-lists(array) all my video files in a folder (recursive).

-Give each file a VoD number (Auto-increase), used in VLC.
|-Telnet add (output to a file) it to the "Media server" and add it to the HTML listing.

-The HTML listing must have 2 columns.
|- URL to that VoD file
\_ The name of that VoD file

-Result
|- HTML file that contains file listing ("rtsp://192.168.1.2:5554/movie001" , "The epic movie")
\_ TXT file that must be passed to Telnet (Telnet for VLC) to add those files.

### Thoughts ###
Hope this post made sense, I tried posting in sections for the different views of the script. (for understanding)
I think once this script is working, it'll be nice as the VoB list will auto update (cron job).
I wish there was only 1 programming language that works everywhere and in everything :P
For someone that knows linux bash coding, this should be relatively easy. (I think)

____________________
Spac3
Hmmmm - I was trying to use UPNP or DLNA boxes - you know? Cheap little box you plug into a TV with it's own remote control and a lan interface?
The issue with most of these things is - unless the movie/item is in a format that their codec understands - no viewing or stuttering or no sound etc. In fact - it's bigger than that coz of "container issues" and (sigh) competing standards.

SO.... (like you) I "plumped" for a little box (PC/netbook/whatever) and let the user choose that which they wish to view.
Like you - I chose VLC as the media player. Like you - I looked at setting up VLC on my server to stream.
However, I ran into problems and it all became "too fiddely".

Then I discovered 2 things - "mediatomb" http://mediatomb.cc/for my distro (PCLOS - Mandriva/Debian based - like Ubuntu) AND "djmount http://djmount.sourceforge.net/.

mediatomb gives me the browsing and streaming interface I want. For what you want - you could just stop there - cut the file name out of the mediatomb browser screen and paste it into your local VLC - and away you go. The other nice thing about mediatomb is - that it will transcode (if you ask it) AND it "knows" about the peculiarities of things like PS3 boxes.. which are another cheap source of media player.

From what you said "### The Product ###" I think MT fits the bill.

I wanted to go a step further. I wanted to be able to control the "playing" remotely. Also, I wanted the interface to be easier. Some media players differentiate between local files (media) and streams... you have to choose a submenu and say "open url" or something like that.
I wanted it to be able to not even have to use a browser (if I or my user chose).

djmount presents the upnp/dlna media as a filesystem within my local machine - mounted at any location I like.
Eg..
Code:
 
mkdir Movies
djmount Movies
ls Movies
and inside (in various different orders depending on which folders you list) is all my media - organised by title, alphabetically, by-whatever.
NOW - with this - I don't have to tell VLC (or any other media player) that it is a stream. I can use my normal gui file manager/s to "point n click".
PLUS - it is far easier for my "remote control" scripting.... because - issuing an "ssh command" to run vlc with an argument of /whatever/myfolder/Movies/Moviename.avi is very simple.

The purpose of my remote controlling is so that I can schedule (via cron) the broadcasting AND PLAYING of a given program/movie. This is for my 87 year old aunt who likes to watch a detective show at 2pm and the tv company stopped showing it. Now, she just switches the tv on to "my channel" (the netbook is attached to one of the inputs of the tv) and - there it is. In the protected community she lives in - there are other old people who can also receive these shows.. a netbook with wifi from ebay is less than 50 pounds - the cable to connect the netbook to the tv is another 2 pounds - and it is all done.
I have "acquired" a large selection of programs that these old people enjoy - and my cron script works from a list of about 300 episodes. I put a banner on the screen 3 minutes before the program is scheduled to start - saying what it is and a timer countdown - so they know the thing is alive and pending.

ANSWERING YOUR SPECIFIC QUESTIONS - (or a couple of them)
instead of telnet - look at "netcat" - then you can "echo" what you want into netcat.
Listing all the files in a folder WITHOUT the directory names recursing...
Code:
 find startingpath \( ! -type d \) >filelist
Partial script to create URL and filename
Code:
 while read pathname
do
   echo "rtsp://$myipstream/$pathname\t\t`basename $pathname`"
done <filelist
basename removes the directory part of the pathname - leaving only the name of the file.
If you didn't need the full path name in your filelist - then you could change the find command by appending "-exec basename {} \;" to the end of it. But, I thought the server component might need the full path to the file.
As for the HTML - I am useless. Sorry.

Maybe I have "hijacked your thoughts"? If so - I apologise. But, you said you couldn't find a linux server/service which didn't give you codec problems and MAYBE MT will solve them for you?
Dave

Last edited by davemguru; 11-18-2011 at 03:50 AM.
 
Old 12-04-2011, 10:28 AM   #3
Spac3
LQ Newbie
 
Registered: Oct 2011
Distribution: Ubuntu 10.04
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for the feedback davemguru.
I've not gotten around to try out the things you advised on.

Currently the server does not want me to Remote into it.
I can still use all the services, so to be quite honest, I'm just to lazy to go hookup all the screen and stuff.
O and working on websites, witch is eating my time.
However, I will save your post to HDD so that I can try it out some other time.

Regarding your foot note, you don't have to worry about "hi-jacking" my idea.
It's nice to see other options and what other people has done.

When I eventually do try this out, I'll come and post feedback.
That is if the thread is still here :P

Once again, thanks for taking the time to replay.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "Service 'phononbackends/vlc.desktop' is malformatted." MTK358 Linux - Software 9 06-01-2011 04:23 PM
how to run exe files like"VLC"in ubuntu while it's installed in windows krishnadas Linux - Newbie 2 09-25-2009 03:51 PM
VLC error: VLC could not open the file "/usr/share/vlc/skins2/text.bmp". brjoon1021 Ubuntu 1 01-14-2009 10:48 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
".cam" webcam video -- is there a codec? Can I play it with xine, Mplayer, VLC, ...? ErrorBound Linux - Software 0 07-09-2006 10:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration