Ask Your Question

Explicitly set ffmpeg to open video

asked 2015-12-21 04:51:50 -0500

Anjenson gravatar image

updated 2015-12-21 04:53:10 -0500

Is there a way to explicitly specify ffmpeg usage to open video with VideoCapture on any platform?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-02-10 18:17:30 -0500

take a look at the documentation of VideoCapture and

example usage:

String filename = "768x576.avi";
VideoCapture capture( filename, CAP_FFMPEG);


String filename = "768x576.avi";
VideoCapture capture; filename, CAP_FFMPEG);
edit flag offensive delete link more

answered 2016-08-11 00:05:16 -0500

mnogono gravatar image

updated 2016-08-11 00:16:36 -0500

Hello every one. I'm using opencv 3.1

std::string filename = "1440x1072.avi";, CAP_FFMPEG);

//internally it invoke follow code
//opencv code
bool VideoCapture::open(const String& filename, int apiPreference)
    if (isOpened()) release();
    icap = IVideoCapture_create(filename);
    if (!icap.empty())
        return true;

    cap.reset(cvCreateFileCaptureWithPreference(filename.c_str(), apiPreference)); // !! <- and only here opencv start working with apiPreference!
    return isOpened();
//opencv code

so how to using apiPreference correctly? In my case, i get cap = IVideoCapture_create(filename) not empty and cvCreateFileCaptureWithPreference never invoke. Does it bug?

Just in case, I open "ProcessExplorer" app and check what kind of dll was started with my application. There no any ffmpeg dll in list.

Then I rename video file with non english words (some russians symbols) and after that string cap = IVideoCapture_create(filename) make empty, and program go to execute cvCreateFileCaptureWithPreference. I open "ProcessExplorer" and see now application using opencv_ffmpeg310_64.dll

Also the video file has some kind of interlines capture, and after procedure, the height ot the output mat is half of original video frame (536 instead of 1072). When opencv_ffmpeg310_64.dll using I get original frame

edit flag offensive delete link more


Is it a answer?

LBerger gravatar imageLBerger ( 2016-08-11 09:06:28 -0500 )edit

No, here I just provide more information about topic

mnogono gravatar imagemnogono ( 2016-08-11 09:47:15 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2015-12-21 04:51:50 -0500

Seen: 378 times

Last updated: Aug 11 '16