title: Stream video using javacv to a rtsp server
body: <p>I am using java CV for video streaming.And I captured video from web cam.But it fails when i tried to transfer the stream to the Darwin server. The code is,</p>
  
  <pre><code>package streamingapp;
  
  import com.googlecode.javacpp.Loader;
  import com.googlecode.javacv.CanvasFrame;
  import com.googlecode.javacv.FFmpegFrameRecorder;
  import com.googlecode.javacv.FrameGrabber;
  import com.googlecode.javacv.OpenCVFrameGrabber;
  import com.googlecode.javacv.cpp.avcodec;
  import com.googlecode.javacv.cpp.opencv_objdetect;
  import static com.googlecode.javacv.cpp.avutil.*;
  import static com.googlecode.javacv.cpp.opencv_core.*;
  
  
  public class StreamingApp {
  
  public static void main(String[] args) throws Exception {
  
      Loader.load(opencv_objdetect.class);
      CanvasFrame frame = new CanvasFrame("webcam");
      FrameGrabber grabber = new OpenCVFrameGrabber(0);
  
      grabber.setImageHeight(500);
      grabber.setImageWidth(500);
      grabber.start();
  
      IplImage grabbedImage = grabber.grab();
      int width = grabbedImage.width();
      int height = grabbedImage.height();
  
      CvMemStorage storage = CvMemStorage.create();
  
      FFmpegFrameRecorder recorder = new FFmpegFrameRecorder("rtsp://ipaddress:portno/testVideoStream.3gp", width, height);
  
  
  
      recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
      recorder.setFormat("rtsp");
      recorder.setFrameRate(grabber.getFrameRate());
      recorder.setVideoCodec(13);
      recorder.setPixelFormat(AV_PIX_FMT_YUV420P);
      recorder.setVideoBitrate(10 * 1024 * 1024);
      recorder.start();
  
      int i = 0;
  
      while (frame.isVisible() &amp;&amp; (grabbedImage = grabber.grab()) != null) {
      System.out.println("(" + i++ + ") Invio. . .");
      frame.showImage(grabbedImage);
      recorder.record(grabbedImage);
      }
  
      cvClearMemStorage(storage);
      recorder.stop();
      grabber.stop();
    }
  
  }
  </code></pre>
  
  <p>Is it possible to stream video using javacv in rtsp format.</p>