how to read the frames from url?

asked 2016-06-07 10:41:03 -0600

manju gravatar image

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;
        }
    }
};
edit retag flag offensive close merge delete

Comments

unfortunately VideoCapture does not allow reading streams from an url on android (missing the backend, like ffmpeg or gstreamer)

berak gravatar imageberak ( 2016-06-08 00:07:06 -0600 )edit

hi Thank you for your reply . I used ffmpeg with open cv i am getting unsatisified link error

plz help me

public void onClick(View arg0) { FFmpegMediaMetadataRetriever fmmr = new FFmpegMediaMetadataRetriever(); fmmr.setDataSource(mUri); int currentPosition = myVideoView.getCurrentPosition(); //in millisecond Toast.makeText(MainActivity.this, "Current Position: " + currentPosition + " (ms)", Toast.LENGTH_LONG).show();

       Bitmap bmFrame = fmmr
         .getFrameAtTime(1000000, F
manju gravatar imagemanju ( 2016-06-08 01:03:59 -0600 )edit