Matteo Cardellini
Matteo Cardellini

Reputation: 896

Set Videocamera resolution android

Hello everyone how can I set my Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); to take the video at a resolution of 320x480 instead of the default 1960x1080 to avoid a huge video size ?

Upvotes: 0

Views: 1994

Answers (2)

Salman Aziz
Salman Aziz

Reputation: 201

android do not have any permission to change the camera resolution you can achieve it with ffmpeg after recording the video here is a demo code http://androidwarzone.blogspot.com/2011/12/ffmpeg4android.html

Upvotes: 0

Alex Cohn
Alex Cohn

Reputation: 57173

Try to set EXTRA_VIDEO_QUALITY to 0, but there can be no guarantee that any intent provider will respect your EXTRA.

Explanation

Android introduced the inter-app cooperation mechanism of Intents. The idea is that any app can declare to the system that it knows how to handle an action of, e.g. create video, and the end-user can choose this app to fulfill the task next time, or to become the default handler of such action. The actions are defined as strings, and are infinitely extensible; and Google did define some "standard" action strings, though; e.g. "android.media.action.VIDEO_CAPTURE".

So, I could upload an app to Play Store that will claim that it knows how to handle this well-known Intent, and instead of turning on video recorder, download a video from YouTube. People who install my app, will be prompted to use it in any app they use to that asks to capture video. I believe that if an app severely disobeys the Intent "contract", Google will sooner or later remove it from the Play Store.

But adhering to all the _EXTRA_s, like _VIDEO_QUALITY_, is not a strictly enforced requirement in Android. Worse, some built-in apps, e.g. the stock Camera on your device, may be less than accurate in following the specs at http://developer.android.com/reference/android/provider/MediaStore.html, and unfortunately device manufacturers often choose to replace the AOSP camera app with their own creation which does not work well.

So, if your app (be it native, or webapp) requests a video on a device, there is no control which app will provide the video for you, and how it will accomplish the task. You must test your app with more than one video app, to make sure that your app survives some misinterpretations of the contract that different video apps my rely upon. You can recommend your users to install and use certain video capture app that you find to be best suited for your task.

I suggest that you try to install and use at least the Google Camera app - this one at least comes from a known source.

You may find it interesting to read a rant by another phonegap developer: Limitations of Video Capture in Phone Gap + Native Plugins

Upvotes: 3

Related Questions