1

I implemented a video recorder in my code and it runs perfectly on almost all the devices except to HTC One X. There the video record getting stuck(the first image doesn't change) and when I'm trying to open the file I'm receiving a pop-up "Cannot play video, sorry this video cannot be played"

Here are my settings

mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());

    // Use the same frame rate for both, since internally
    // if the frame rate is too large, it can cause camera to become
    // unstable. We need to fix the MediaRecorder to disable the support
    // of setting frame rate for now.
    mMediaRecorder.setVideoFrameRate(mProfile.videoFrameRate);

    //mMediaRecorder.setVideoSize(mVideoWidth, mVideoHeight);
    mMediaRecorder.setVideoSize(640,480); // Works On Note(not on HTC One X)


    mMediaRecorder.setVideoEncodingBitRate(MAXIMAL_PERMITTED_VIDEO_ENCODING_BITRATE);
    // mMediaRecorder.setVideoEncoder(mProfile.videoCodec);
    mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
    // mMediaRecorder.setAudioEncoder(mProfile.audioCodec);
    mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);

Thanks

Nativ
  • 3,092
  • 6
  • 38
  • 69

1 Answers1

0

I adapted some code from this question How can I capture a video recording on Android? for recording video, set it to 640x480, and it ran fine on my AT&T One X: https://raw.github.com/lnanek/Misc/master/HtcOneXVideoRecord/src/com/htc/sample/videorecord/RecordVideo.java

So it isn't the 640x480 that isn't working in and of itself. What's the value for the bitrate you are setting? Have you considered using profiles instead, which are build in supported combinations? For example, you would set:

mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)

And that would set the resolution, bit rate, etc. to values that work. There are various constants for high quality recording, low, etc..

Community
  • 1
  • 1
Lance Nanek
  • 6,377
  • 2
  • 24
  • 19