Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to run video file using a video player

is there any way to run a video file using the default media player installed in the system?

running the below posted code does not run the video player that should be used to play the .avi file, the below code just open the .avi file and provide some data about the each frame.

how to let video player plays the provided video file Code:

static final String aviPath = "C:\\private\\ArbeitsOrdner_19_Mar_2015\\AVIs\\parabole.avi";

public static void main(String[] args) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    vCapture = new VideoCapture();
    matFrame = new Mat();
    clonedFrame = new Mat();

    try {
        vCapture.open(aviPath);
    } catch (Exception e1) {
        System.out.println("no video found.");
        try {
            vCapture.open(WEB_CAM);
        } catch (Exception e2) {
            System.out.println("No WEB_CAM attached.");
        }
    }

    if (vCapture.isOpened()) {
        while (vCapture.grab()) {

            vCapture.retrieve(matFrame);
            if (!matFrame.empty()) {
                System.out.println("grabbed frame");
                System.out.println("frame size: " + matFrame.size());
                clonedFrame = matFrame.clone();
                //showInFrame(clonedFrame);
            }
        } vCapture.release();
    }
}