title: nreco wrapper bitmap streaming through rtmp
body: <p>I'm developing an application for real time streaming.
  capture frames from video devices and encoding with a ffmpeg wrapper called nreco.</p>
  
  <p>the problerm is that if i try to stream encoded video to red5 via rtmp on red5 server, connection is immediatily closed.</p>
  
  <p>this is the code i use to configure the output streaming:</p>
  
  <pre><code>ffMpegTask = videoConv.ConvertLiveMedia(
       Format.raw_video,
       outstream,
       Format.flv,
       new ConvertSettings()
       {
           CustomInputArgs = " -re -pix_fmt bgr24 -video_size 800x600 ", 
           CustomOutputArgs = " -acodec copy -vcodec libx264 -pix_fmt yuv420p rtmp://127.0.0.1/live/stream ",   
       });
  
        ffMpegTask.Start();
  </code></pre>
  
  <p>adding frame this way:</p>
  
  <pre><code>void camera_Frame(object sender, FrameEventArgs e)
  {
     Bitmap item = e.Frame;
  
     BitmapData bd = item.LockBits(new Rectangle(0, 0, item.Width, item.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
     byte[] buf = new byte[bd.Stride * item.Height];
     Marshal.Copy(bd.Scan0, buf, 0, buf.Length);
     ffMpegTask.Write(buf, 0, buf.Length);
     item.UnlockBits(bd);
  }  
  </code></pre>
  
  <p>any help?</p>