MediaRecorder setVideoFrameRate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaRecorder setVideoFrameRate method.

This code example shows how to use the following methods:setOutputFormat, setPreviewDisplay, setVideoEncoder, setVideoFrameRate, setVideoSize
	{						 
		if ( mRecorder != null){
			mRecorder.reset();
			mRecorder.release();
		} 
		mRecorder = new MediaRecorder();
		try { 
	    	mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);  
	    	mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
	        mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
	        mRecorder.setVideoFrameRate(27);
	        mRecorder.setVideoSize(640, 480);   
		} catch(RuntimeException e) {
			Log.e(TAG, "Could not set camera settings",e );
			return; 
		} 
         
        if(mViewer.hasSurface)
		{			 
			mRecorder.setPreviewDisplay(mViewer.holder.getSurface());

6
CodeRank
This code example shows how to use the following methods:setOutputFile, setOutputFormat, setVideoEncoder, setVideoFrameRate, setVideoSource
	 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
 
		super.onCreate(savedInstanceState);
		recorder = new MediaRecorder();
 
		mPreview = new CameraPreview(this, recorder);
		setContentView(mPreview);
		 
		try { 
			socket = new Socket(DEST_ADDR, PORT);
			fd = ParcelFileDescriptor.fromSocket(socket);
//			byte[] buffer = new byte[] {1,2,3,4,5}; 
//			new FileOutputStream(fd.getFileDescriptor()).write(buffer); 
			 
//			File file = new File(name); 
//			fd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_CREATE); 
		} catch (UnknownHostException e) {
			e.printStackTrace();

6
CodeRank
This code example shows how to use the following methods:setOutputFile, setOutputFormat, setVideoEncoder, setVideoFrameRate, setVideoSource
 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
 
		super.onCreate(savedInstanceState);
		recorder = new MediaRecorder();
		 
		mPreview = new CameraPreview(this, recorder);
		setContentView(mPreview);
 
		String PATH_NAME = "/sdcard/test.mp4";
 
		recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
		recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
		recorder.setVideoFrameRate(15);
		recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
 
		recorder.setOutputFile(PATH_NAME);
 
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

6
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioSource, setMaxDuration, setMaxFileSize, setOutputFormat
    public void setCamera(Camera camera) {
    	recorder.setCamera(camera);	
	} 
     
    public void setRecorderParams(int vbr, int abr, int asr, int ach, int vfr, int w, int h, int md, int mfs) {
        recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
        recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
        /*recorder.setVideoEncodingBitRate(vbr); 
        recorder.setAudioEncodingBitRate(abr); 
        recorder.setAudioSamplingRate(asr); 
        recorder.setAudioChannels(ach);*/ 
        recorder.setVideoFrameRate(vfr);
        recorder.setVideoSize(w, h);
        recorder.setMaxDuration(md);
        recorder.setMaxFileSize(mfs);
    } 
     

6
CodeRank
This code example shows how to use the following methods:prepare, setOutputFile, setOutputFormat, setPreviewDisplay, setVideoEncoder
		public void surfaceDestroyed(SurfaceHolder holder) {
			// 
		} 
 
		public void initializeVideoSettings() { 
			myRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); 
			myRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
			myRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP); 
 
			myRecorder.setOutputFile("/sdcard/sample.3gp"); 
			myRecorder.setVideoFrameRate(30); 
			myRecorder.setVideoSize(320, 240);		
				myRecorder.setPreviewDisplay(v_holder.getSurface()); 
			try { 
				myRecorder.prepare(); //
			} catch (Exception e) {
				Log.e("recMovie", e.getMessage());
			} 
		} 
 
6
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioSource, setOrientationHint, setOutputFormat, setVideoEncoder
        surfaceHolder.addCallback(this);
        surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    } 
 
    private void initRecorder() { 
        mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    	mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
    	mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
    	mediaRecorder.setOrientationHint(90);
    	mediaRecorder.setVideoSize(1280, 720);
    	mediaRecorder.setVideoFrameRate(30);
//    	filePath = getOutputFilePath(); 
//        mediaRecorder.setOutputFile(filePath); 
    } 
     
    public final class StreamViaSocketTask extends AsyncTask<String,Boolean,String> {
    	@Override 
    	protected String doInBackground(String...params) {
5
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioEncodingBitRate, setAudioSource, setOutputFormat, setVideoEncoder
		 
		holder = getHolder();
		holder.addCallback(this);
		holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
		 
		recorder = new MediaRecorder();
		  
		recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
		recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
		recorder.setVideoSize(900, 480);
		 recorder.setVideoEncodingBitRate(7000000);
		 recorder.setAudioEncodingBitRate(50000);
			recorder.setVideoFrameRate(24);
 
		recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
		 
 
//		 recorder.setVideoEncodingBitRate(DRAWING_CACHE_QUALITY_HIGH); 

5
CodeRank
This code example shows how to use the following methods:prepare, setPreviewDisplay, setVideoFrameRate
        recorder.setMaxDuration(50000); // 50 seconds
        recorder.setMaxFileSize(5000000); // Approximately 5 megabytes
    } 
 
    private void prepareRecorder() { 
        recorder.setPreviewDisplay(holder.getSurface());
        recorder.setVideoFrameRate(5);
        try { 
            recorder.prepare();
        } catch (IllegalStateException e) {
            e.printStackTrace();
            finish();
        } catch (IOException e) {
            e.printStackTrace();
            finish();
        } 
    } 
 
    public void onClick(View v) {
        if (recording) {
5
CodeRank
This code example shows how to use the following methods:prepare, setAudioEncoder, setAudioSource, setOutputFile, setOutputFormat
		File directory = new File(path).getParentFile();
		if (!directory.exists() && !directory.mkdirs()) {
			throw new IOException("Path to file could not be created.");
		} 
 
		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.MPEG_4_SP);
		recorder.setVideoFrameRate(30);
		 
		recorder.setOutputFile(path);
		Surface s = holder.getSurface();
		recorder.setPreviewDisplay(s);
		recorder.prepare();
		recorder.start();
	} 
 
	/** 

5
CodeRank
This code example shows how to use the following methods:setCamera, setOutputFile, setOutputFormat, setPreviewDisplay, setVideoEncoder
	 * @return 
	 */ 
	private Boolean setRecorderInstance(ParcelFileDescriptor pfd) {
		 
		// instance 
		recorder = new MediaRecorder();
        // settings 
		recorder.setCamera(mCamera);
		recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);      
        recorder.setOutputFile(pfd.getFileDescriptor());
        recorder.setVideoFrameRate(10);
        recorder.setVideoSize(176,144);
        recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
        recorder.setPreviewDisplay(mView.getHolder().getSurface());
        return true; 
	} 
	 
	/* Release recorder safely. */ 
	private void releaseRecorder() { 
5
CodeRank

Related MediaRecorder setVideoFrameRate Questions & Answers:

setVideoFrameRate Method Overview
Sets the frame rate of the video to be captured.
See Code Examples for other Android MediaRecorder Methods: