Android的Mediarecorder:获取3GP,而不是MPEG4 [英] Android Mediarecorder: Getting 3GP instead of MPEG4

查看:303
本文介绍了Android的Mediarecorder:获取3GP,而不是MPEG4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想只有在与MPEG4格式的Andr​​oid录制视频。我想容器和codeC是MPEG4。因此,这里是我该做的。

I want to record video only in android with MPEG4 format. I want the container and codec to be MPEG4. So here is what I have done for that.

Thread video = new Thread(new Runnable() {
    public void run() {
        videoRecorder = new MediaRecorder();
        videoRecorder.setPreviewDisplay(surfaceView.getHolder().getSurface());
        videoRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        videoRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        videoRecorder.setVideoEncodingBitRate(56 * 8 * 1024);
        videoRecorder.setVideoSize(176, 144);
        videoRecorder.setVideoFrameRate(12);
        videoRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
        videoRecorder.setOutputFile("/sdcard/video.m4e");
        try {
            videoRecorder.prepare();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        videoRecorder.start();
    }
});
video.start();

现在,记录后,我得到了记录到 video.m4e 文件中的视频。但是,当我检查它的信息,我得到了以下内容:

Now, after recording, I got the video recorded into video.m4e file. But when I check its information, I got the following:

同时我用下面的录制音频:

At the same time I used the following to record audio:

Thread audio = new Thread(new Runnable() {              
    public void run() {
        audioRecorder = new MediaRecorder();
        audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
        audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        audioRecorder.setOutputFile("/sdcard/audio.amr");
        try {
            audioRecorder.prepare();
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        audioRecorder.start();
    }
});
audio.start();

和我得到的容器格式和codeC为AMR,我打算:

and I got the container format and codec as AMR as I intended:

那么,是什么原因导致 MediaRecorder 来记录视频3GP格式?我没有在我的计划中指定3GP任何地方。我运行Android 2.2我的三星Galaxy Tab上测试该code

So, what causes MediaRecorder to record video in 3GP format? I haven't specified 3GP anywhere in my program. I am testing this code on my Samsung Galaxy tab running Android 2.2

推荐答案

MPEG-4是一个定义音频和视频(AV)数字数据的COM pression的方法。搜索结果的文件格式存储基于时间的媒体内容。它是形成了一些其他更具体的文件格式(例如3GP,动态JPEG 2000,MPEG-4第14部分)。搜索结果的基础上的通用格式所以在你得到的结果没有任何阴谋你使用的COM pression方法(或codeC)为MPEG4和手机所产生的视频格式是3GP,这实际是对套件的MPEG4的视频格式的一部分COM $ p $对于媒体pssion方案。

MPEG-4 is a method of defining compression of audio and visual (AV) digital data.

A file format for storing time-based media content. It is a general format forming the basis for a number of other more specific file formats (e.g. 3GP, Motion JPEG 2000, MPEG-4 Part 14).

So there is no conspiracy in the result you got, the compression method (OR "Codec") you used was MPEG4 and the video format generated by your phone is 3gp, which in actual is a part of the video formats of the suite of the MPEG4 compression scheme for the media.

这篇关于Android的Mediarecorder:获取3GP,而不是MPEG4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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