在Android的视频质量? [英] Video quality in android?

查看:237
本文介绍了在Android的视频质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的媒体记录器类录制视频时,我初始化录音机以下属性,

I am using the media recorder class for recording video, I initialize the recorder with following properties,

    recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);

    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);

不过,视频的质量是不是一样的视频我拍了原生的Andr​​oid摄像头,我的视频使用媒体录像机质量差相比,原生的,我怎么能提高视频质量记录。

But the quality of video is not as same as video I shoot over native android camera, my video recorded using media recorder is of poor quality as compared to the native one, how can I improve the video quality.

如果任何人知道我帮我out.Thanks

If any one knows me help me out.Thanks

推荐答案

最后,我找到了code到Android 2.1的录制高质量的视频通过设置videEncodingBitRate,AudioEncodingBitRate,AudioSamplingRate ...等。使用这种方法,你可以设置任何你想要提供高质量的视频属性的视频。

Finally I found the code to record high quality video in android 2.1 by setting videEncodingBitRate , AudioEncodingBitRate, AudioSamplingRate ...etc. Using this method you can set the properties for video whatever you want to provide high quality video.

有关设置高品质,低质量参数请参考这个网页,

For setting high quality and low quality parameter refer this page,

<一个href="http://www.andgps.com/20110410/camcorderprofile-$p$pdefined-camcorder-profile-settings-for-camcorder-applications" rel="nofollow">http://www.andgps.com/20110410/camcorderprofile-$p$pdefined-camcorder-profile-settings-for-camcorder-applications

与基础版本中使用的codeI Android 2.1系统,生产出高品质的视频如下图所示,

The code i used with base version android 2.1 to produce high quality video is shown below,

    recorder = new MediaRecorder();
    Method[] methods = recorder.getClass().getMethods();
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    recorder.setVideoFrameRate(24);
    recorder.setVideoSize(720, 480);

    for (Method method: methods){
    try{
        if (method.getName().equals("setAudioChannels")){
                method.invoke(recorder, String.format("audio-param-number-of-channels=%d", 1));
        } 
        else if(method.getName().equals("setAudioEncodingBitRate")){
                method.invoke(recorder,12200);
            }
        else if(method.getName().equals("setVideoEncodingBitRate")){
            method.invoke(recorder, 3000000);
        }
        else if(method.getName().equals("setAudioSamplingRate")){
            method.invoke(recorder,8000);
        }
        else if(method.getName().equals("setVideoFrameRate")){
            method.invoke(recorder,24);
        }
    }catch (IllegalArgumentException e) {

        e.printStackTrace();
    } catch (IllegalAccessException e) {

        e.printStackTrace();
    } catch (InvocationTargetException e) {

        e.printStackTrace();
    }
    }

    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);

`

这篇关于在Android的视频质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆