Page 1 of 1

Apache http streaming problem

Posted: 10 Dec 2004 04:52
by Editor
Hi All,

I'm setting up a VoD solution at home, to stream movies recorded from digital TV to various PC's around the house.

I have setup Apache webserver v2.0.52 on a Win XP Home machine. I use VLC 8.1 on the client PC's.

A movie (mpeg2) can be anywhere from 2gB to 7gB in size and are recorded on to SATA 7200RPM Hard drives NTFS partitions.

On the client I enter http://movieserver:80//Movies/Movie.tp

I can succesfully stream 3 movies at the same time. The problem I am having is, irrespective of the size of the movie, If I try to stream more than 3 at the same time, some of the streams stop playing.

I have tried re-configuring the Apache httpd file but nothing I do affects the problem. I upgraded the network so all machines have 1gB network cards (Cat5e cabling) installed and are connected via a gigabit switch. The network utilization with 3 streams averages at 2% so I don't believe network bandwidth is an issue.

I can use VLC on the server to stream 8 concurrent movies using UDP to each individual client PC before I hit a disk bottleneck which can cause the movies to jutter. (CPU is a 3.2GhZPentium4 with 1mB cache, Ram 512kB) I tried increasing the server memory to 1gB but that also made no difference. CPU Util with 3 http streams 14%.

I read some documentation regarding Apache, suggesting that the following parameters were set in the httpd.conf file;
EnableMMap off
EnableSendfile off
Win32DisableAcceptex

With enablesend file off, the movies are cut short. In the VLC debug, the streamsize is reported incorrectly and an eof is received terminating the movie.

Has anybody else come across this 3 stream limit with Apache, and if so is there a solution other than chucking out XP and going with Linux?

Regards

Update - Is this a Videolan or Apache problem?

Posted: 11 Dec 2004 04:19
by Editor
I uninstalled VLC 8.1 and installed VLC 7.1.

Client WinXP Home
http Server WinXP Home Apache2.0.52
EnableMMap off
EnableSendfile off
Win32DisableAcceptex

With VLC 8.1 on a test movie the Videolan debug showed one stream size With VLC 7.1 a different stream size was displayed.

No changes were made to the Win XP home Apache server.

Again with Apache config reflecting the "Enable sendfile off" the stream size is incorrect but reported differently between VLC7.1 and VLC8.1.

These versions have a different http user agent, so is this a VLC issue with http on XP or an Apache issue. Just clutching at straws, but, Is there a problem with the http getfile command within VLC?

Would love some assistance with this, have had no reply from Apache forums and am drawing a complete blank!


Regards

Posted: 14 Dec 2004 18:29
by markp
I did not see it, but are the streams going to one box or three different boxes?

Also, viewing with the plugin or running a VLC text hack?

Mark

Posted: 15 Dec 2004 10:04
by Guest
Hi Markp

Many thanks for the reply,

The streams are all going to seperate boxes. I have a main theatre lounge where the Apache server with the movie files. PC in upstairs lounge, kids bedrooms and a playroom.

I'm not sure what you mean by "Also, viewing with the plugin or running a VLC text hack?"

On the client PC all I do is start VLC and from the menu select 'File' Open network stream. In the http section I enter the URL - http://movieserver:80//Movies/Movie.tp (or whatever the name of the movie is.) and click OK.

The movie then starts streaming. As I say I can stream 3 movies with no problems at the same time it's just when one starts of the 4th that it all dies in the water.

I've been playing around some more and have done lots of searching but haven't come up with anything new yet.

Cheers

http streaming

Posted: 15 Dec 2004 10:24
by Editor
Oopps,

Wasn't logged in..Guest this time was me...Editor...

Sorry.........

Posted: 15 Dec 2004 18:47
by markp
Could you post your apache access.log and error.log? May give us a clue.

Mark

Although I don't really think this is an apache issue. This could be a firewall issue or a router issue.

HTTP Streaming prob

Posted: 16 Dec 2004 05:20
by Editor
Hi Markp,

Here are the 2 logs. I cleared them out, restarted the server and then ran 4 movies. Apache reports no errors. Same result 3 movies run OK. As soon as the 4th is started 1 will stop.

Apache Access Log
192.168.0.3 - - [16/Dec/2004:13:49:53 +1000] "GET //Movies/XMen.tp HTTP/1.1" 206 19196033280
192.168.0.4 - - [16/Dec/2004:13:51:19 +1000] "GET /Movies/Home_Alone_2.tp HTTP/1.1" 206 7668402500
192.168.0.5 - - [16/Dec/2004:13:50:53 +1000] "GET //Movies/Willow.tp HTTP/1.1" 206 8529157680
192.168.0.6 - - [16/Dec/2004:13:51:42 +1000] "GET /Movies/Lord_of_The_Rings.tp HTTP/1.1" 206 8803521308

Apache Error Log
[Thu Dec 16 13:48:12 2004] [notice] Parent: Created child process 2476
[Thu Dec 16 13:48:12 2004] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Dec 16 13:48:12 2004] [notice] Child 2476: Child process is running
[Thu Dec 16 13:48:12 2004] [notice] Child 2476: Acquired the start mutex.
[Thu Dec 16 13:48:12 2004] [notice] Child 2476: Starting 250 worker threads.
[Thu Dec 16 13:48:12 2004] [notice] Child 2476: Listening on port 80.

----------------------

Just to test I have tried some smaller files but they do the same.
I have disabled all firewall and antivirus software but it makes no difference.

The 5 computers are connected via a Netgear Gigibit switch. There is an Netgear ADSL Modem/Router connected to one of the Gigabit ports. The ADSL Modem/Router runs at 100M. This router also provides DHCP functionality for the 5 computers. I disconnected this and set static IP adresses for the 5PC's but again, stream 4 movies and crunch. I also borrowed some new network cards just in case there was a problem there...same result.

I have been playing around with the Timeout settings in the Apache conf file. These are my current settings;

Timeout 5400
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 15

Changing them doesn't seem to effect the 4 movie syndrome. (With Timeout at 5400 it provides a longer pause time for the kids to go do a chore or eat something without having to restart the movie)

If it would help I could post the Apache conf file and mime type file unless there is a way of attaching a file to a post?

Cheers

Posted: 16 Dec 2004 08:05
by markp
Well, no errors on apache.

I just don't believe this is an apache error, but I will did into some of my apache books just to make sure.

Could be an windows/apache thing. I run a linux apache server, but have not tried to do what you want to do.

Out of curiosity, why don't you just share a directory for everyone to go grab the movie they want? You can associate the extension with the vlc program and boom, double click and you are there.

I can right click on the file name right now and select open with vlc and it starts. I have ripped many movies to an ISO for this purpose.

Mark

Posted: 16 Dec 2004 20:33
by markp
I found this little nugget, but I think the defaults may be present

Code: Select all

The main differences in Apache for Windows are: Because Apache for Windows is multithreaded, it does not use a separate process for each request, as Apache does with Unix. Instead there are usually only two Apache processes running: a parent process, and a child which handles the requests. Within the child each request is handled by a separate thread. So, "process"-management directives are different: MaxRequestsPerChild - Like the Unix directive, this controls how many requests a process will serve before exiting. However, unlike Unix, a process serves all the requests at once, not just one, so if this is set, it is recommended that a very high number is used. The recommended default, MaxRequestsPerChild 0, does not cause the process to ever exit. ThreadsPerChild - This directive is new, and tells the server how many threads it should use. This is the maximum number of connections the server can handle at once; be sure and set this number high enough for your site if you get a lot of hits. The recommended default is ThreadsPerChild 50.
I'll keep digging around

Mark

http streaming

Posted: 18 Dec 2004 02:27
by Editor
Hi Markp,

Sorry about the delay getting back to you....Work kinda got in the way.

Share out directory -

Good point.....I don't share out directories on my pc's anymore. Got hit with a virus via email a few months ago and it bounced across all the PC's through the shares infecting those as well. What I read at the time was to remove the shares from the PC's to make them more secure. With kids on the network even though they are good kids one can't always see what they are up to so no shares at least gives a bit more protection.

Maybe XP SP2 makes this more secure but is it?

I know though that XP can also only handle 5 concurrent connections. Assumeably part of Microsofts way of ensuring that if you need many network connections one buys a server OS. Fine for the corporate office but it gets pricy for home use. I guess this is also why MS don't ship IIS with XP home. (apparently XPpro can only handle 5 as well)

However just to test I shared out the directory, mapped it on the other PC's and used VLC to directly read the movies. It worked fine on 5 PC's, no lock ups, freezing or jittering, (just love VLC). Firing up a 6th I got an error from XP saying that the limit of connections had been reached.

I would assume that if this limit applied with http connections as well, then I should be able to use Apache to a max of 5 connections. I've also been reading that http is not that great a protocol for streaming. Could it be that the problem is http, or http and XP?

Would much rather use Apache http than network shares for security. (unless my understanding of all of this is incorrect)

MaxRequestsPerChild -
ThreadsPerChild -


I've played with these values and they also hadn't helped. I had tried different values for Threadsperchild-50 so I tried 50....No change either.

Windows/Apache Thing-

I agree that it probably is but how do I get in touch with Apache Org? No point in contacting Micky soft...They'll just suggest buying Server 2003 and charge $1M for the support!! I've posted this on a few Apache forums and not a single answer. I'm a bit 'scared' of posting this into Apache's Bugzilla as I'm not sure it's a bug as such....or is it?

The only response I have had is from you on the Videolan forum and this is greatly appreciated!!! I agree that it is more likely that it is not VLC that is the problem but that XP is the root cause...

Maybe I should drop XP as the server machine and go linux. Never having used anything other than a Windows machine it seems like a daunting process...Wouldn't even know where to start..........

Again thanks for all your assistance and ideas on this.....

Cheers

Posted: 20 Dec 2004 05:46
by markp
Man, I'm stumped. Have you tried the built in web server on vlc?

I have a text file I run to start it.

vlc -I http

is the only thing in the file. I created it using notepad and made it a batch file (vlc.bat). It runs on port 8080 so it won't interfer with apache.

Mark

VlC http server

Posted: 06 Jan 2005 03:00
by Editor
Hi Markp,

Hope you had a good XMAS and Happy New Year to you.

Apologies not getting back to you but XMAS etc and family got in the way of playing....Think I need to do something about that...I had lots of thoughts about how to fix this issue. The only solution I could come up with was to get rid of the need.....apparently though as I have been informed that getting rid of the missus and kids is not an option.....BUMMER!!!

Thanks for the suggestion about using VLC built in HTTP server. I must be missing something though....tried to run it but when a file is requested it cannot be found. In Apache one defines the directories and the user rights on the server. How can I tell VLC where these are ??

I'm also thinking about having a go with Apache on Linux...Bit terrified of UNIX though...maybe it's like the first time ya kiss a girl....Scared like hell at first but then ya kinda get ta like it.....

Cheers

Posted: 09 Jan 2005 07:16
by markp
When I run

Code: Select all

vlc -I http
I point my web brower to

Code: Select all

http://localhost:8080
This brings up a webpage to add the files to the play list. And once on the playlist, you can click the link and it starts the stream.

Are you saying the you can't add files to the playlist because it can't find the file? Or you add the file and it says it can find the file from the playlist?

http://www.videolan.org/doc/vlc-user-guide/en/ch05.html is the link to the http interface. It is not a great help, but the top line tells you how to specify a ip host and port.

I would not be terrified of linux. I have been playing with it for less than a year and I have built a web server, file server, and printer server all on one box. I have a shared directory that only I can write to and everyone else reads. This directory has all of my videos on it. I also have a music and image directory with the same set up. To protect the files I installed a virus checker that runs when each file is loaded to the directory. It will delete the file if a virus is found. Never happen, yet, but I am sure it will sooner or later.

I wanted to do the same thing as you, but I don't think it makes sense to me any more. I had envisioned cool web pages the all of the videos (with movie posters of course), but the above solution (shared directory with only me allowed to post to it) worked the best. Hell my oldest son (he is five) can get on it and watch all of the movies. So I think this was the solution I wanted. It just was not as sexy as my mind made it.

I'm with ya tell the end.

Mark