Ask Your Question

Revision history [back]

how to read the frames from url?

i want read the frames from the url and i want to calculate the fps and bit rate in opencv android when try to open the connection its showing always FALSE. below is my code snippet

plz help me

public class MainActivity extends Activity { public static String TAG = "praaksh"; //Mat ma;

//String filename="/storage/2CDA-07E1/Wildlife.wmv";
String filename = "http://trailers.divx.com/divx_prod/profiles/WiegelesHeliSki_DivXPlus_19Mbps.mkv";

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {

    @Override
    public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS:
            {
                Log.i(TAG, "OpenCV loaded successfully");

            //    ma = new Mat();



           VideoCapture      mvideoCapture     = new   VideoCapture("filename");
             //   Mat BGRMat = Imgcodecs.imread(getResources().getDrawable(R.drawable.ic_launcher).toString());  

                    //  Log.d(TAG, "opened ..?"+BGRMat);

                //   Log.d(TAG, "opened ..?"+b);

                boolean b = mvideoCapture.isOpened();
                  Log.d(TAG, "opened ..?"+b);

              //  double fps = mvideoCapture.get(Videoio.CAP_PROP_FPS);
              //  Log.d(TAG, "FRame Rate"+fps);
                //double framecount = mvideoCapture.get(Videoio.CAP_PROP_FRAME_COUNT);
             //   Log.d(TAG, "FRame Rate"+framecount);

                /* Now enable camera view to start receiving frames */

            } break;
            default:
            {
                super.onManagerConnected(status);
            } break;
        }
    }
};