我有一个来自Tenvis IP摄像机的直播流,通过HTTP直播流和它的mjpeg压缩。从IP摄像机(MJPEG压缩)录制实时流
我想将它保存到一个文件,我试图用PHP来做到这一点。我的代码如下所示:
<?php
$input = fopen("http://xxx.xxx.xxx.xxx:81/videostream.cgi?user=user&pwd=admin&resolution=8");
$output = fopen("video.mpg", "c+");
$end = time() + 60;
do {
fwrite($output, (fread($input, 30000)), 30000);
} while (time() <= $end);
fclose($output);
fclose($input);
echo "<h1>Recording</h1>";
?>
代码我创建了该文件,但没有写入任何内容。任何建议将不胜感激