Jump to content

Search the Community

Showing results for tags 'mjpeg'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello, I have a webcam on a computer running Motion, a webcam streaming program popular in Linux. Motion basically outputs a mjpeg stream. I'd like to use PHP to grab a single jpeg from the mjpeg stream and display it. The reason I'm doing this is because Motion doesn't have any built in password protection. With PHP, I can hide the port and IP address of my home server. I'm trying code provided by the creators of Motion on their website. The code is suppose to grab just a single jpeg from the mjpeg stream, but I get an error when trying to run it on an nginx server locally. <? $camurl="http://127.0.0.1:8080/"; $boundary="\n--"; $f = fopen($camurl,"r") ; if(!$f) { //**** cannot open echo "error"; } else { //**** URL OK while (substr_count($r,"Content-Length") != 2) $r.=fread($f,512); $start = strpos($r,'ΓΏ'); $end = strpos($r,$boundary,$start)-1; $frame = substr("$r",$start,$end - $start); header("Content-type: image/jpeg"); echo $frame; } fclose($f); ?> For reference, this is where I got the code from: http://www.lavrsen.dk/foswiki/bin/view/Motion/MjpegFrameGrabPHP Maybe someone could help me out? I have very little understanding of PHP, and don't understand why the fopen command is returning a fault. In case you're wondering, I've also tried this code snippet. It works, but it's grabbing an entire mjpeg stream. When ran locally on my lan, it works, but when I try the code on a shared host, the shared host computer seems to be trying to download the entire mjpeg stream, which would never complete of course. That's why I'm trying to find code that grabs just a single jpeg instead of streaming the mjpeg. set_time_limit(0); $fp = fsockopen ("xxxx.dyndns.org", 20804, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "GET / HTTP/1.0\r\n\r\n"); while ($str = trim(fgets($fp, 4096))) header($str); fpassthru($fp); fclose($fp); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.