You are here: Re: [PHP] Streaming video BLOBs from MySQL « PHP « IT news, forums, messages
Re: [PHP] Streaming video BLOBs from MySQL

Posted by Richard Lynch on 04/19/05 07:19

On Thu, April 14, 2005 12:40 pm, J J said:
> I have a case where video files (mov, flv, etc) have
> been stored in a MySQL database as blobs.

Doc: Don't do that.

> I'm loading them into a flash video player and
> everything works fine except it takes longer it seems
> and it doesn't allow streaming the actual video.
>
> If I load the same videos with a direct link to the
> http:// file system (/videos/file.flv) it loads in
> super-fast and allows streaming.
>
> I'm guessing mysql and/or php doesn't actually release
> the BLOB until it's loaded it completely.

You need to figure out where the time is going.

If it's taking all that time to get the BLOB from MySQL to PHP, then it
really doesn't matter how fast you do or don't spew it out from PHP to the
browser.

Do some of these:
<?php error_log(__LINE__ . ' ' . microtime()); ?>

> So, is there a way to actually have PHP read the BLOB
> and stream it as it's loading? Is there an fstream()
> option like the fread()?

You could *maybe* use MySQL substring and http://php.net/echo and
http://php.net/flush in a loop, but that's going to be horrible on your
PHP <-> MySQL end.

You're really going to be better off storing the movies in files where
they belong, as it's perfectly natural to fopen and fread a small chunk to
spew out so it comes out as a stream, not one big blob.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация