ipcam to stream?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CptDondo

    #1

    ipcam to stream?

    I have an airlink101 ipcam. It "streams" jpeg images to a web browser.

    Basically, the camera sends a never-ending http page, and continually
    retransmits a jpeg image.

    This sort of works, but eventually the browser tries to save the file.
    It's also impossible to embed in a page.

    What I really want is to grab that stream at the web server level using
    something like php, and create a stream similar to a webcam so that I
    can show embedded live video on the page.

    I have never done anything like this, though, and my google searches
    have not revealed anything useful - mostly how-tos on creating
    proprietary streams using desktop tools.

    I need something that can automagically create a stream that a browser
    can understand.

    I've tried mplayer/mencoder and motion, but neither will produce a
    stream....

    The web server is running linux (debian etch), apache2, and php5.

    I would appreciate any pointers or guidance.

    Thanks,

    --Yan

  • Erwin Moller

    #2
    Re: ipcam to stream?

    CptDondo wrote:
    I have an airlink101 ipcam. It "streams" jpeg images to a web browser.
    >
    Basically, the camera sends a never-ending http page, and continually
    retransmits a jpeg image.
    Hi,

    Really? A never ending http page that refreshes the image all the time?
    Do they use some meta-refresh header for that?

    They would be better off using JavaScript, and simply replace the image all
    the time (better performance).

    But I think you can just look at the URL of the image, and my bet is that
    that same image changes all the time. Right?

    If so: what you need in PHP to get the stream of images is simply
    rerequesting the same image all the time and store them on HD or something.

    So you need something simple as:

    *************** **************
    // Look up the path in the sourcecode of you page that displays the jpg
    $imageSourcePat h = "http://localhost/path/to/your/cam/image.jpg";
    $saveDir = "/home/Yan/webcam/";
    $nrOfPicsToCapt ure = 1000;

    for ($counter=0;$co unter<$nrOfPics ToCapture;$coun ter++){
    // make sure nobody caches
    $theImg = $imageSourcePat h."?rand="+micr otime();
    // get new picture
    $content = file_get_conten ts($theImg);
    // safe it in a file
    $fileName = $saveDir."image ".$counter.".jp g";
    file_put_conten ts($fileName,$c ontent);
    }
    *************** **************
    (not tested of course)

    How you make a movie out of the seperate jpg files, I don't know, but I am
    sure some software out there can help you with that (try sourceforge eg).

    Hope that helps.

    Regards,
    Erwin Moller

    >
    This sort of works, but eventually the browser tries to save the file.
    It's also impossible to embed in a page.
    >
    What I really want is to grab that stream at the web server level using
    something like php, and create a stream similar to a webcam so that I
    can show embedded live video on the page.
    >
    I have never done anything like this, though, and my google searches
    have not revealed anything useful - mostly how-tos on creating
    proprietary streams using desktop tools.
    >
    I need something that can automagically create a stream that a browser
    can understand.
    >
    I've tried mplayer/mencoder and motion, but neither will produce a
    stream....
    >
    The web server is running linux (debian etch), apache2, and php5.
    >
    I would appreciate any pointers or guidance.
    >
    Thanks,
    >
    --Yan

    Comment

    • CptDondo

      #3
      Re: ipcam to stream?

      Erwin Moller wrote:
      CptDondo wrote:
      >
      >I have an airlink101 ipcam. It "streams" jpeg images to a web browser.
      >>
      >Basically, the camera sends a never-ending http page, and continually
      >retransmits a jpeg image.
      >
      Hi,
      >
      Really? A never ending http page that refreshes the image all the time?
      Do they use some meta-refresh header for that?
      >
      They would be better off using JavaScript, and simply replace the image all
      the time (better performance).
      >
      But I think you can just look at the URL of the image, and my bet is that
      that same image changes all the time. Right?
      >
      If so: what you need in PHP to get the stream of images is simply
      rerequesting the same image all the time and store them on HD or something.
      >
      So you need something simple as:
      >
      *************** **************
      // Look up the path in the sourcecode of you page that displays the jpg
      $imageSourcePat h = "http://localhost/path/to/your/cam/image.jpg";
      $saveDir = "/home/Yan/webcam/";
      $nrOfPicsToCapt ure = 1000;
      >
      for ($counter=0;$co unter<$nrOfPics ToCapture;$coun ter++){
      // make sure nobody caches
      $theImg = $imageSourcePat h."?rand="+micr otime();
      // get new picture
      $content = file_get_conten ts($theImg);
      // safe it in a file
      $fileName = $saveDir."image ".$counter.".jp g";
      file_put_conten ts($fileName,$c ontent);
      }
      *************** **************
      (not tested of course)
      >
      How you make a movie out of the seperate jpg files, I don't know, but I am
      sure some software out there can help you with that (try sourceforge eg).
      >
      Hope that helps.
      >
      Regards,
      Erwin Moller
      >
      That was my first cut.... But it takes about 1-2 seconds to refresh,
      and the camera frame rate is 10 fps. Here's the description of the
      process the camera uses (from
      <http://msdn.microsoft. com/coding4fun/hardware/video/article.aspx?ar ticleid=912407>
      ):

      MotionJPEG over HTTP uses the Content-Type header
      "multipart/x-mixed-replace" along with a configurable boundary. This
      means that the stream is made up of Multiple Parts (hence multipart) and
      each new frame should replace the previous frame (hence
      x-mixed-replace). This particular camera sends an HTTP Header like this:

      Content-Type: multipart/x-mixed-replace;boundar y=--video boundary--

      So.. I'm kind of stuck on how to deal with that. I want to take that
      stream and display it an an embedded object.

      --Yan

      Comment

      • Erwin Moller

        #4
        Re: ipcam to stream?

        CptDondo wrote:
        Erwin Moller wrote:
        >CptDondo wrote:
        >>
        >>I have an airlink101 ipcam. It "streams" jpeg images to a web browser.
        >>>
        >>Basically, the camera sends a never-ending http page, and continually
        >>retransmits a jpeg image.
        >>
        >Hi,
        >>
        >Really? A never ending http page that refreshes the image all the time?
        >Do they use some meta-refresh header for that?
        >>
        >They would be better off using JavaScript, and simply replace the image
        >all the time (better performance).
        >>
        >But I think you can just look at the URL of the image, and my bet is that
        >that same image changes all the time. Right?
        >>
        >If so: what you need in PHP to get the stream of images is simply
        >rerequesting the same image all the time and store them on HD or
        >something.
        >>
        >So you need something simple as:
        >>
        >************** ***************
        >// Look up the path in the sourcecode of you page that displays the jpg
        >$imageSourcePa th = "http://localhost/path/to/your/cam/image.jpg";
        >$saveDir = "/home/Yan/webcam/";
        >$nrOfPicsToCap ture = 1000;
        >>
        >for ($counter=0;$co unter<$nrOfPics ToCapture;$coun ter++){
        > // make sure nobody caches
        > $theImg = $imageSourcePat h."?rand="+micr otime();
        > // get new picture
        > $content = file_get_conten ts($theImg);
        > // safe it in a file
        > $fileName = $saveDir."image ".$counter.".jp g";
        > file_put_conten ts($fileName,$c ontent);
        >}
        >************** ***************
        >(not tested of course)
        >>
        >How you make a movie out of the seperate jpg files, I don't know, but I
        >am sure some software out there can help you with that (try sourceforge
        >eg).
        >>
        >Hope that helps.
        >>
        >Regards,
        >Erwin Moller
        >>
        >
        That was my first cut.... But it takes about 1-2 seconds to refresh,
        and the camera frame rate is 10 fps. Here's the description of the
        process the camera uses (from
        >
        <http://msdn.microsoft. com/coding4fun/hardware/video/article.aspx?ar ticleid=912407>
        ):
        >
        MotionJPEG over HTTP uses the Content-Type header
        "multipart/x-mixed-replace" along with a configurable boundary. This
        means that the stream is made up of Multiple Parts (hence multipart) and
        each new frame should replace the previous frame (hence
        x-mixed-replace). This particular camera sends an HTTP Header like this:
        >
        Content-Type: multipart/x-mixed-replace;boundar y=--video boundary--
        >
        So.. I'm kind of stuck on how to deal with that. I want to take that
        stream and display it an an embedded object.
        Yes, I see.
        Sorry, I have no clue how to proceed either. I never did that before. :-/
        Maybe dig into RFC that describe this type of stream?


        Good luck

        Regards,
        Erwin
        >
        --Yan

        Comment

        • Jerry Stuckle

          #5
          Re: ipcam to stream?

          CptDondo wrote:
          I have an airlink101 ipcam. It "streams" jpeg images to a web browser.
          >
          Basically, the camera sends a never-ending http page, and continually
          retransmits a jpeg image.
          >
          This sort of works, but eventually the browser tries to save the file.
          It's also impossible to embed in a page.
          >
          What I really want is to grab that stream at the web server level using
          something like php, and create a stream similar to a webcam so that I
          can show embedded live video on the page.
          >
          I have never done anything like this, though, and my google searches
          have not revealed anything useful - mostly how-tos on creating
          proprietary streams using desktop tools.
          >
          I need something that can automagically create a stream that a browser
          can understand.
          >
          I've tried mplayer/mencoder and motion, but neither will produce a
          stream....
          >
          The web server is running linux (debian etch), apache2, and php5.
          >
          I would appreciate any pointers or guidance.
          >
          Thanks,
          >
          --Yan
          >
          Yan,



          I've never tried it either, but I've seen it done. It normally requires
          more than just dumping the jpeg repeatedly to the browser. HTTP is a
          request/response protocol - it's not really designed to have one request
          go on for long periods of time.

          You could take a look at http://195.196.35.90/view/view.shtml. He's
          doing the same thing I think you want to do, using some javascript. It
          might give you some ideas.

          Unfortunately I don't have the webmaster's email - I bookmarked this a
          couple of years ago as a neat site and have since lost contact with him.

          You could also try asking over on alt.www.webmasters - some of them
          might have some ideas.


          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          Working...