1

Is there a way to either select the video format output of the video recorded by setting an Intent extra? Or can I do it in a post-recording processing function? What I'm trying to do is take the video that I just recorded and send it in an MMS message using an ACTION_SEND intent, but it won't take the .mp4 format that the camera is storing it as.

How would I go about doing this?

Edit: This is what my recording code is:

Intent videoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 60);
videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
startActivityForResult(videoIntent, VIDEO_ACTIVITY);
stema
  • 90,351
  • 20
  • 107
  • 135
K. Barresi
  • 1,275
  • 1
  • 21
  • 46
  • are you collecting the video from the device's native video recorder? Or are you recording the video yourself in your app? – Yevgeny Simkin May 11 '12 at 06:40
  • I'm using the native video recorder using an ACTION_VIDEO_CAPTURE intent – K. Barresi May 11 '12 at 06:45
  • I think your best bet is to write your own video recording activity which allows you to set whatever settings you wish. See if this helps:http://stackoverflow.com/questions/1817742/android-video-recording-sample – Yevgeny Simkin May 11 '12 at 06:59
  • Bummer, I was hoping to not have to go down that road...oh well, looks like I'll end up having to give that a try. – K. Barresi May 11 '12 at 07:23
  • as per the answer below, before you waste any time constructing your own recorder (it's not that big a hassle, the code in that link is works pretty much out of the box), try making a tiny video and saving it on the sdcard and sending *that... see what the limitations are and then build to those. – Yevgeny Simkin May 11 '12 at 08:06
  • Alright, I'll give it a try and get back :) – K. Barresi May 11 '12 at 08:31

1 Answers1

2

You can pass any of the following extra's to the intent ACTION_VIDEO_CAPTURE although I'm quite sure this is not what your looking for exactly, but lets dig into it a little bit more.

EXTRA_OUTPUT
EXTRA_VIDEO_QUALITY
EXTRA_SIZE_LIMIT
EXTRA_DURATION_LIMIT

While I don't think there is a protocol limitation on the file size for mms' maybe there is a limit in Android (just speculating herebetween 300kb & 500kb although some devices allow you to increase it in message settings) so try sending a video with a lower quality and perhaps a size limit to check if that solves your problem.

The reason I'm saying this is because I remember something similar a while ago, and the error message was something like (quoting my memory):

Sorry, you can not add this video to your message

Which turned out to be the size limitation I mentioned, not encoding or file type.

Update

Looking at the docs I found out a mention to mms on the MediaStore's stuff, particularly on the EXTRA_VIDEO_QUALITY one, here it is:

The name of the Intent-extra used to control the quality of a recorded video. This is an integer property. Currently value 0 means low quality, suitable for MMS messages, and value 1 means high quality. In the future other quality levels may be added.

Juan Cortés
  • 20,634
  • 8
  • 68
  • 91
  • Thats the exact error message I'm getting, "Sorry, you can not add this video to your message". I have this set already: videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); – K. Barresi May 11 '12 at 07:22
  • Then it probably means the filesize is too big, try with a really really small video of low quality and see if it work. – Juan Cortés May 11 '12 at 07:26
  • I recorded at ~50 kb, and I'm getting the same error. Note: this is only for SMS/MMS apps, not email/facebook/etc – K. Barresi May 11 '12 at 07:27
  • Maybe storing it locally before sending it on an mms?Have you tried a local file instead of the streamed one from the camera intent? – Juan Cortés May 11 '12 at 07:33
  • Yes, I'm storing it in a local on the sdcard, and sending it to mms via that file. – K. Barresi May 11 '12 at 08:00
  • I know this isn't your preferred answer either, but you can always send the video through a 3rd party aggregator, who will take videos of up to 20 megs and transcode them for every handset and so forth. – Yevgeny Simkin May 11 '12 at 08:05