Ask Your Question
0

Android VideoCapture File Format and Alternatives

asked 2017-06-28 06:22:19 -0600

cmcphee gravatar image

updated 2017-06-28 06:26:43 -0600

Hi all,

I'm trying to create an android application that will frame-by-frame process video files taken with a phone camera (.mp4) with openCV. Having looked at previous questions on this subject, I know that the android version of openCV doesn't include ffmpeg backend for decoding files of this format, so the videocapture won't be able to open them.

However, in some answers to previous questions, it has been stated that there is no way of opening any kind of video files with videocapture on android, and in another couple that the videocapture just needs a very specific file format (MJPEG in an AVI container) and then will work as usual.

If there is no way whatsoever of doing this, please let me know so I can stop spending time on it. However, if there is a specific format that definitely DOES work, would it be possible to get some more details about this? I've made several attempts at using various different conversion methods, including ffmpeg, to convert my mp4 files to MJPEGs in AVI contaniers, but still haven't produced anything that the videocapture will accept.

Any information about correct ffmpeg commands to use (ones from a previous question haven't worked for me - http://answers.opencv.org/question/12...) would be most appreciated. Otherwise, just more specifics about the required format would be good, then I can ask somewhere else about how to get there from an mp4.

As for other alternatives, so far I'm aware of ffmpegmediadataretriever (https://github.com/wseemann/FFmpegMed...), which appears to be far too slow for these purposes, and the ffmpegframegrabber class from javaCV, which appears to have numerous issues working on android devices. If anyone knows any other alternatives I'd be extremely grateful.

Thanks very much!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-04-03 16:11:37 -0600

Waseem Syed gravatar image

i used OPENCV 4.1.1 and it is doing the job

edit flag offensive delete link more
0

answered 2017-06-29 01:24:34 -0600

berak gravatar image

let's clarify:

opencv 2.4 has NO means at all to read or write video files on android.

opencv 3 has a builtin MJPG/avi encoder/decoder, but that is the ONLY format you can use with VideoCapture/VideoWriter there.

edit flag offensive delete link more

Comments

Thanks very much for your answer! Are you in a position to clarify any further what exactly the required format is? As in, do any specific properties have to be within any specific ranges (bitrate, framerate, colour properties, whatever)? Sorry, I'm by no means an expert when it comes to video formats. I've tried various methods of conversion to the required format but have had no success with getting the videocapture to accept my resulting files thus far.

Presumably, as an alternative to recording with a standard camera app and converting, I could record videos with the videowriter object and open those later with videocapture as both would use the same built in encoder/decoder? I'd prefer to be able to convert videos taken with any camera app but this could be a good fallback.

cmcphee gravatar imagecmcphee ( 2017-06-29 05:10:27 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-06-28 06:22:19 -0600

Seen: 1,749 times

Last updated: Jun 29 '17