Ask Your Question

VideoCapture device on Android

asked 2013-06-13 09:55:25 -0600

stephanmg gravatar image

Dear users,

i'm successfully using my Camera on Android (native C++ OpenCV) for capturing images from my Hardware Camera.

Nevertheless I cannot read with cv::VideoCapture from a videofile on my SD card on my Android phone... the videofile I have converted to the correct format for OpenCV, nevertheless the videofile is not recognized and cannot be played.

1) I read some posts that suggest to install "FFmpeg" Codecs on the Android device - but how, and is this possible at all?

some guy from #android-dev on Freenode suggested:

2) <anonymous> stephanmg, if you want to use ffmpeg decoders, yes, you should statically link libavcodec/libavformat into your opencv library so it'll have the decoders available.

My question is: How can i read videofiles with cv::VideoCapture from a file, analogous to the case which i succesfully could manage, that is to read and process images which i captured from my hardware camera.

All the best, Stephan

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2020-10-22 00:55:25 -0600

check this blog... here is basic camera function

1) Resolution

2) Focus Mode

3) Flash Mode

4) Switch Camera -> for FRONT/RARE Camera View

5) Take Pictures

6) Record Video -> START/STOP >> "NEED TO WRITE CODE FOR MediaRecorder IN OPNECV 4.4.0 LIBRARY"

edit flag offensive delete link more

answered 2013-07-01 08:39:53 -0600

stephanmg gravatar image

Dear Alexander,

thank's for your reply.

So, i do not necessarily need to use FFMPEG, i just want to read in videofiles on Android with OpenCV natively. Is there any other approach how I can do this?

All the best, Stephan

edit flag offensive delete link more


There is no compatible video i/o back-ends on Android platform. The only available solution is FFMPEG.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-07-09 08:37:42 -0600 )edit

answered 2013-06-28 08:49:38 -0600

OpenCV4Android does not support FFMPEG and does not include VideoCapture back-end for it. The only solution is to build OpenCV and FFMPEG manually. There is unofficial branch with FFMPEG integration on Android, but it is very very old. You can try to update the code to the current OpenCV version and finish integration.

edit flag offensive delete link more

Question Tools


Asked: 2013-06-13 09:55:25 -0600

Seen: 2,950 times

Last updated: Oct 22 '20