title: ffmpeg - Continuously stream webcam to single .jpg file (overwrite)
body: <p>I have installed ffmpeg and mjpeg-streamer. The latter reads a .jpg file from /tmp/stream and outputs it via http onto a website, so I can stream whatever is in that folder through a web browser.</p>
  
  <p>I wrote a bash script that continuously captures a frame from the webcam and puts it in /tmp/stream:</p>
  
  <pre><code>while true
  do
      ffmpeg -f video4linux2 -i /dev/v4l/by-id/usb-Microsoft_Microsoft_LifeCam_VX-5000-video-index0 -vframes 1 /tmp/stream/pic.jpg
  done
  </code></pre>
  
  <p>This works great, but is very slow (~1 fps). In the hopes of speeding it up, I want to use a single ffmpeg command which continuously updates the .jpg at, let's say 10 fps. What I tried was the following:</p>
  
  <pre><code>ffmpeg -f video4linux2 -r 10 -i /dev/v4l/by-id/usb-Microsoft_Microsoft_LifeCam_VX-5000-video-index0 /tmp/stream/pic.jpg
  </code></pre>
  
  <p>However this - understandably - results in the error message:</p>
  
  <pre><code>[image2 @ 0x1f6c0c0] Could not get frame filename number 2 from pattern '/tmp/stream/pic.jpg'
  av_interleaved_write_frame(): Input/output error
  </code></pre>
  
  <p>...because the output pattern is bad for a continuous stream of images.</p>
  
  <p>Is it possible to stream to just one jpg with ffmpeg?</p>
  
  <p>Thanks...</p>