title: MJPEG Video from IP Camera too fast
body: <p>I'm just trying to read a video Stream out of an IP Camera (Basler BIP-1280c).
  The stream I want to have is saved in a buffer on the camera, has a length of 40 seconds and is decoded in MJPEG. </p>
  
  <p>Now if I access the stream via my webbrowser it shows me the 40 seconds without any problems. 
  But actually I need an application which is capable of downloading and saving the stream by itself.</p>
  
  <p>The camera is accessed via http, so I am using <code>libcurl</code> to access it. This works fine and I also can download the stream without any troubles. I have chosen to save the stream data into an *.avi file (hope that's correct…?). </p>
  
  <p>But now to the problem: I can open the video (tried with Totem Video Player and VLC) and also view all that has been recorded — BUT it's way too fast. The whole video lasts like 5 seconds (instead of 40). Is there in MJPEG anything in a header where to put information like the total video length or the fps? I mean there must be some information missing for the video players, so that they play it way to fast?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>As suggested in the answers, I opened the file with a hexeditor and what I found was this:</p>
  
  <p><code>--myboundary..Content-Type: image/jpeg..Content-Length: 39050.........*Exif..II*...............V...........................2...................0210................FrameNr=000398732
  6.AOI=(0800x0720)@(0240,0060)/(1280x0720).Motion=00000 (no)
  [00000 | 00000 | 00000 | 00000 | 00000].Alarm=0000 (no) .IO
  =000.RtTrigger=0...Basler..BIP2-1280c..1970:01:05 23:08:10.8
  98286......JFIF.....</code>.<code>............................ ....&amp;"((</code></p>
  
  <p>This header reoccurs in the file all over ( followed by a a lot of Bytes of binary Data ). This is actually okay, since I read in the camera manual that all MJPEG Pictures get this Header.</p>
  
  <p>More interesting ins the <code>JFIF</code>in the last line. As in the answers suggested this is maybe the indicator of the file format. But afaik JFIF is a single picture format just like jpg. So does this maybe even mean that the whole video file is just some "brainless" chained pictures? And my Player just assumes that he should show this pictures one after another, without any knowledge about the framerate?</p>