6

I am recording a video in android like this

List<Camera.Size> list =  myCamera.getParameters().getSupportedPictureSizes();
            Parameters parameters = myCamera.getParameters();
            parameters.setColorEffect(coloreffects.get(index_color_effect));
            myCamera.setParameters(parameters);
            mediaRecorder = new MediaRecorder();
            myCamera.unlock();
            mediaRecorder.setCamera(myCamera);
                mediaRecorder.setOrientationHint(90);
            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
            mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
            mediaRecorder.setAudioEncoder(AudioEncoder.HE_AAC);
            mediaRecorder.setVideoEncoder(VideoEncoder.H264);
            mediaRecorder.setOutputFile(Constants.videourl);
            mediaRecorder.setMaxDuration(30000); // Set max duration 60 sec.
            mediaRecorder.setVideoFrameRate(24);
             mediaRecorder.setVideoFrameRate(30);
             mediaRecorder.setVideoSize(720, 480);
            mediaRecorder.setPreviewDisplay(myCameraSurfaceView.getHolder().getSurface());

this recored video and able to play in android well but unable to play on iphone.

if if use this code for recording

         // work two
         {
         mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
         mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

         mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
         mediaRecorder.setOutputFile(videourl);
         mediaRecorder.setMaxDuration(30000); // Set max duration 60 sec.
         }

THis records video compatible.with iphone well. but this records 30 seconds video about 47 mbs on samsung note2.

Any help?

shailesh
  • 1,783
  • 2
  • 17
  • 26
  • 1
    I got the solution for video sizes to reduce. The size of video depends upon the **videobitrate.** you can set video bit rate by mediaRecorder.setVideoEncodingBitRate(150*1000); – shailesh Apr 20 '13 at 02:47
  • **Compatibility issue** comes with **Verizon lg lucid** and **htc vivid**. Any guess or help? Video recorded from these device not playable on iphone. – shailesh May 03 '13 at 07:57

1 Answers1

1

The iPhone supports video in MPEG-4 video format, and at a resolution not larger than 640x480

try this mediaRecorder.setVideoSize(640, 480);

MORE INFO: to play video on iphone

Video Format: MP4, MOV, M4V

Video Size: up to 640x480

Video Framerate: up to 30fps

Video Bitrate: up to 1.5Mbps for H.264, or 2.5Mbps for MPEG-4

Audio: AAC up to 160Kbps, 48kHz

oops.objective
  • 1,264
  • 1
  • 8
  • 8