title: ffmpeg - av_interleaved_write_frame(): Unknown error Error number -10053
body: <p>Using ffmpeg, I am able to stream video. I wrote socket Java program that connects to TCP and reading this the Live stream.</p>
  
  <p>After my Java program finished recording, ffmpeg is stopping with following the error unexpectedly. I would like to keep ffmpeg running the whole time. </p>
  
  <blockquote>
    <p>av_interleaved_write_frame(): Unknown error Error writing trailer of
    tcp://XX.XX.XX.XX:5800?listen: Error number -10053 curred</p>
  </blockquote>
  
  <p>The ffmpeg command I am using:</p>
  
  <pre><code>ffmpeg.exe -f gdigrab -an -sn -framerate 7 -i desktop -video_size 800x600 -c:v libx264 -preset ultrafast -maxrate 4000k -crf 40 -bufsize 8000k -probesize 32 -f mpegts tcp://xx.xx.xx.xx:5800?listen
  </code></pre>
  
  <p>Java code:</p>
  
  <pre><code>DataInputStream ois = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
  while((n = ois.read(buf)) != -1 &amp;&amp; n!=3 ){
      fos.write(buf,0,n);
      fos.flush();
      cnt--;
      if(cnt ==0) break;
  }
  </code></pre>