You might try something like this to get a video using the VIDEO_CAPTURE
intent.
File will have .3gp extension and mimetype "video/3gpp"

   private static final int SHOOT_PHOTO =2;
    AssetFileDescriptor photoFile;
    InputStream photoStream;
...

            Intent i = new Intent("android.media.action.VIDEO_CAPTURE");
            startActivityForResult(i, SHOOT_VIDEO);

...

protected void  onActivityResult  (int requestCode, int resultCode, Intent
data){
if (requestCode==SHOOT_VIDEO){
            if (resultCode == RESULT_OK) {
                try {
                    photoFile =
getContentResolver().openAssetFileDescriptor(data.getData(), "r");
                    photoStream =photoFile.createInputStream();

                    // do something with the video stream

                 } catch (FileNotFoundException e) {
                    e.printStackTrace();
                    Toast.makeText(getBaseContext(),  "Could not find Video
file",
                            Toast.LENGTH_LONG).show();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    Toast.makeText(getBaseContext(),  "Could not read Video
file",
                            Toast.LENGTH_LONG).show();
                }
            }
            if (resultCode == RESULT_CANCELED) {

            }
        }

Carmen
-- 
Carmen Delessio
http://www.twitter.com/CarmenDelessio
http://www.talkingandroid.com






On Tue, May 25, 2010 at 9:27 PM, mike <[email protected]> wrote:

>
> Hi all,
>
> I'm trying to use a MediaRecorder to do something useful... like record
> video, send it up to a server and the redisplay it back on, oh say, my
> Android N1. Or G1. Or any old Android.
>
> You'd *think* that shouldn't be hard, but I haven't managed to get an
> intersection between the video encoder, output format, and what to
> send back down to the Android. The latest iteration I tried is:
>
> recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
> recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
> recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
>
> for which I create:
>
> <object type="video/3gpp" height="240" width="320"
> data="img.php?imgid=2943" alt="2010-05-25 18.00.19.3gp"><param name="src"
> value="img.php?imgid=2943"><embed height="240" width="320"
> src="img.php?imgid=2943" type="video/3gpp" alt="2010-05-25
> 18.00.19.3gp"></object>
>
> which duly does... nothing. ffmeg and mplayer seem to know what it is, so
> it's
> not screwed up on the recording end. I've tried many other combinations of
> encoders and containers but haven't managed to get anything to work.
>
> Has anybody managed to find a single intersection that actually works?
>
> Mike, video is a huge mess, yes I know
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to