文件名称:PHP MJPEG(php mjpg) [PHP 即時影像監控 模擬 / PHP 動態提片切換]
文件大小:184KB
文件格式:ZIP
更新时间:2022-01-28 09:38:37
php mjpeg
PHP MJPEG(php mjpg) [PHP 即時影像監控 模擬 / PHP 動態提片切換]
資料來源:https://github.com/donatj/mjpeg-php
http://blog.changyy.org/2009/11/php-motion-jpeg-mjpegmjpg-http-streaming.html
index.html:
mjpeg.php
<?php
//https://github.com/donatj/mjpeg-php
//http://blog.changyy.org/2009/11/php-motion-jpeg-mjpegmjpg-http-streaming.html
// Used to separate multipart
$boundary = 'jashliao';
$delay = 1;
// We start with the standard headers. PHP allows us this much
header("Cache-Control: no-cache");
header("Cache-Control: private");
header("Pragma: no-cache");
header("Content-type: multipart/x-mixed-replace; boundary=$boundary");
// Set this so PHP doesn't timeout during a long stream
set_time_limit(0);
while(true) {
for( $i=1 ; $i<= 12 ; $i++ )
{
echo 'Content-Type: image/jpeg'."\n\n";
echo file_get_contents( "./images/$i.jpg" );
echo "\n--$boundary\n" ;
flush();
sleep( $delay );
}
}
【文件预览】:
php-mjpeg-master
----index.html(21B)
----Readme.txt(985B)
----images()
--------2.jpg(14KB)
--------11.jpg(21KB)
--------8.jpg(7KB)
--------6.jpg(8KB)
--------1.jpg(14KB)
--------12.jpg(15KB)
--------4.jpg(25KB)
--------5.jpg(12KB)
--------9.jpg(18KB)
--------10.jpg(20KB)
--------7.jpg(17KB)
--------3.jpg(17KB)
----mjpeg.php(705B)