title: axis ip camera live streaming using java
body: <p>i have <strong>axis m1114 ip camera</strong> </p>
  
  <p>i want to display live streaming as well as record streaming using java. i tried following code but frame rate is very low </p>
  
  <p>please suggest some api gives me more frame rate and recording functionality.</p>
  
  <pre><code>import java.io.File;
  import java.net.URL;
  import com.googlecode.javacpp.Loader;
  import com.googlecode.javacv.*;
  import com.googlecode.javacv.cpp.*;
  import static com.googlecode.javacv.cpp.opencv_core.*;
  import static com.googlecode.javacv.cpp.opencv_imgproc.*;
  import static com.googlecode.javacv.cpp.opencv_calib3d.*;
  import static com.googlecode.javacv.cpp.opencv_objdetect.*;
  import java.awt.image.BufferedImage;
  import java.io.IOException;
  import java.io.InputStream;
  import javax.imageio.ImageIO;
  import  demo.authenticator.MyAuthenticator;
  import java.net.Authenticator;
  import java.net.MalformedURLException;
  import org.jcodec.api.SequenceEncoder;
  public class Demo {
      public static void main(String[] args) throws IOException {
  
          CanvasFrame CamWindow = new CanvasFrame("Camera");
          int i=0,j=0;
  
          URL url = null ;
          SequenceEncoder encoder=new SequenceEncoder(new File("video.mp4"));
          try {
              // Create a new URL object from the URL-string of our camera.
              url = new URL("http://192.168.168.92/axis-cgi/jpg/image.cgi");
          } catch (MalformedURLException m) {
              m.getMessage();
          }
  
          // Check if this camera requires authentication.
          // If so, then create and set the authenticator object.
  
              MyAuthenticator authenticator = new MyAuthenticator("root",
                          "pass");
      Authenticator.setDefault(authenticator);
  
      Long stime=System.currentTimeMillis();
          while(true){
              i++;
          //InputStream is = url.openStream();
          BufferedImage image = ImageIO.read(url);
  
          CamWindow.showImage(image);
       //   is.close();
  
         /* if(i&lt;100)
          {
             encoder.encodeImage(image);
          }
          else 
          {
              if(j==0)
              {
                  encoder.finish();
                  j++;
                  System.out.println("video saved");
                  System.out.println((System.currentTimeMillis()-stime)/1000+"seconds");
              }
  
          }*/
          System.out.println((System.currentTimeMillis()-stime));
          }
      }
  }
  </code></pre>