Log in

View Full Version : h.264 streaming with PHP and Apache


unix_sansei
4th June 2011, 22:35
hi,
i don't see a thread/forum for this so here goes.

with apache server 2.2 and php 5.3, no lighttpd, i'm looking to stream h264 video

they are doing some work but on win7 x64 i can't get it to compile with cygwin or mingw, apache, php, perl ,ruby etc all run fine

http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Apache-Version2

anyone else working on this or have any clues to efficient streaming of 1080p L5.1 video?

LoRd_MuldeR
4th June 2011, 23:15
Well, maybe you should tell us what kind of client you are trying to stream to!

Flash Player, for example, can read H.264/MP4 files from a simple HTTP file server, e.g. plain Apache - not even PHP needed.

Well, that's more "progressive download" than real streaming, but it might do the job...

(AFAIK there is some way to implement "true" streaming to Flash Player with a PHP script, but it needs the FLV container)

unix_sansei
5th June 2011, 05:50
Well, maybe you should tell us what kind of client you are trying to stream to!

Flash Player, for example, can read H.264/MP4 files from a simple HTTP file server, e.g. plain Apache - not even PHP needed.

Well, that's more "progressive download" than real streaming, but it might do the job...

(AFAIK there is some way to implement "true" streaming to Flash Player with a PHP script, but it needs the FLV container)

Well, maybe you should tell us what kind of client you are trying to stream to!

Flash Player, for example, can read H.264/MP4 files from a simple HTTP file server, e.g. plain Apache - not even PHP needed.

Well, that's more "progressive download" than real streaming, but it might do the job...

(AFAIK there is some way to implement "true" streaming to Flash Player with a PHP script, but it needs the FLV container)
Thanks for reply.

I have three streams of h264

1. low-res. Postage stamp theater for people with small 320x240 screens

2. iiPhone/iPad/Android/Tablet @ 720p

3. Desktop @ full 1080p, i encoded that at the absolute max video/audio rates at L-5.1 with 4.1 audio

iPhone/iPad doesnt support official flash but there is some kind of container or hooks to youtube as iPhones/iPad can view content from ywt.

I've run into all kinds of problems with streaming

1. my server doesn't have flash server but runs apache and i could probably drop lighttpd in the backdoor in my directory and config it, the server runs on Centros

2. java/flash cross domain errors, are real headache

3. i've done 100+hr of R&D with jwplayer, flowplayer, shadowbox, and some small java/flash packages, they all have problems configuring/streaming h264, putting wrappers around wrappers, kluges, ad infinitum


There's one group that has a hack going for h264
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Apache-Version2 but i can't get the damn thing to compile, win7 x64 with gcc 4.6 mingw or cygwin, i have not tried m$ vstudio or cross compiling for Centros

so i'm looking for a stripped down, lightweight, fast, moderately skinnable player but not that awful bloated XML.

now i'm looking into how painful it would be to set up VLC to stream and pop up a simple PHP form/gui.

how hard can it be to setup?

i'll have my SD up either today or tomorrow and the full HD probably same day, i'll post a link, just don't kill the server.

unix_sansei
8th June 2011, 01:17
anyone have any experience building and configuring mac darwin streaming server?

smok3
8th June 2011, 08:19
the "easy" way is php streaming, h.264 must be rewraped into flv, also on client side specific flash component must be used. I'am pretty sure i still have that version packed somewhere, let me know if interested.

unix_sansei
11th June 2011, 21:06
hello, thanks for the reply and yes i'm very interested.

what code did you use to wrap mp4/m4v into flv?

is this what youtube is doing to get their content delivered to iPhone/iPad? since officially Jobs has ranted against apple playing any flash content.

i've been looking at php hacks and rebuilt my site with php and have been investigating various php threading libs but haven't quite figured out how to serve it up the content with rstp or http? or do i just thread up content and deliver it in an iframe and let the browser figure out what to do with it??

smok3
11th June 2011, 21:50
what code did you use to wrap mp4/m4v into flv?
it used to work like this:
ffmpeg -i name_file.mp4 -vcodec copy -acodec copy name_file.flv
and then metadata injection with
flvmdi file.flv /k
is this what youtube is doing to get their content delivered to iPhone/iPad? since officially Jobs has ranted against apple playing any flash content.
nope.

actually there are some new hacks on the horizon, so my example script would be pretty out of date today (not that i can find it anyway...), here is a good reading start thought:
http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12534/video-delivery-http-pseudo-streaming

Blue_MiSfit
11th June 2011, 23:39
This method is what I've used in the past for very simple (non adaptive) streaming.

If you need to do this professionally, and with any kind of scale, you should probably look at a CDN. They can help with the player aspect quite a bit.

unix_sansei
12th June 2011, 09:32
Thanks, I'll have a look at some CDN's. Any recommendations?

I spent more than a few hours with the latest flavor of xmoov, PHP streaming and some interesting Apache mod/hooks. Maybe the best approach for streaming 1080P is to line up a bunch 'free' servers that limit file size but are fast, a VLC/P2P kind of hack for streaming 264 files

unix_sansei
12th June 2011, 09:41
This method is what I've used in the past for very simple (non adaptive) streaming.

If you need to do this professionally, and with any kind of scale, you should probably look at a CDN. They can help with the player aspect quite a bit.

have you looked at amazon's cloud?

cali_axela
13th June 2011, 19:36
Thanks, I'll have a look at some CDN's. Any recommendations?


BitGravity is my favorite. Much lower cost then the "big name" guys, with almost as much pro-level streaming support.

Blue_MiSfit
13th June 2011, 23:05
Limelight is another good relatively low cost option. Akamai if you've got the bucks ;)

unix_sansei
14th June 2011, 06:38
I was trying out some free HD places like youtube which sucks
1. limit content to 15min
2. uploading srt subtitles is flakey
3. not the fastest server around

but I did find these guys www.dailymotion.com, you can upload up to 2Gb but they limit the size of the pipe to ~1.7/2Mb

amazon cloud didn't look too bad for the big boys at least its pay as you go rather than flat rate. ha ha if i could afford akamai servers, i wouldn't be scrounging for apache/php hacks.

xmoov streaming is 'almost' there.

i did find one service that has a P2P like hack for streaming, i'll have to dig the link out again.