title: Bug while recording Axis camera stream with FFMPEG
body: <p>I am using FFMPEG to record the video stream (h264 / AAC in MP4) provided by an AXIS camera (<a href="http://www.axis.com/products/cam_p1346/" rel="nofollow">P1346</a>).</p>
  
  <p>I need to make recordings at specific times. To achieve this, I use a PHP script which is executed every minute (with <strong>cron</strong>), checks in the database whether a recording should be started or not.</p>
  
  <p>To record the stream, I use <strong>proc_open</strong> with the following command line:</p>
  
  <pre><code>/usr/local/bin/ffmpeg -i 'rtsp://192.168.0.103:554/axis-media/media.amp?udp&amp;buffer_size=65535' -vcodec copy -acodec copy -t 3600 -y '/path/to/video/folder/file.mp4'
  </code></pre>
  
  <p>Problem is, it works in most cases, but the recording fails every now and then. Have anyone ever tried to record AXIS streams in command line, and faced bugs while doing it?</p>
  
  <p>Thank you in advance.</p>
  
  <p>Regards,</p>
  
  <p>Mathieu</p>
  
  <p>N.B.: I have encountered the same difficulties using VLC.</p>
  
  <p><strong>EDIT:</strong> Network errors can be a good explanation on why the recordings sometimes suddenly interrupt; however, I still don't understand why the whole video file is corrupted after that.</p>