MediaRecorder setVideoEncoder - 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 setVideoEncoder method.

This code example shows how to use the following methods:prepare, setOutputFile, setOutputFormat, setVideoEncoder, setVideoSource
	public void CaptureVideo() 
	{ 
		 
		final String FICHIER_SORTIE = "/sdcard/video_test.3gp";
		 
		MediaRecorder mediaRecorder =  new MediaRecorder();
		 
		try { 
		mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
		 
		mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
		mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
		 
		mediaRecorder.setOutputFile(FICHIER_SORTIE);
		 
			mediaRecorder.prepare();
		} 
		catch (IOException e) {
			Log.e("CaptureVideo", "Failed to prepare the video recorder handler");
			return; 

6
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioSource, setOutputFormat, setVideoEncoder, setVideoSource
	private Socket clientSocket;
 
	public Camcorder(String ip, int port) throws UnknownHostException,
			IOException { 
		clientSocket = new Socket(ip, port);
		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.MPEG_4_SP);
		// recorder.setVideoSize(480, 320); 
		// recorder.setVideoFrameRate(15); 
		// recorder.setMaxDuration(10000); 
	} 
 
	public void startRecording() { 
		ParcelFileDescriptor fd = ParcelFileDescriptor.fromSocket(clientSocket);
		recorder.setOutputFile(fd.getFileDescriptor());
		recorder.setOutputFile(outputFile);
6
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioSource, setOutputFormat, setVideoEncoder, setVideoSource
	/** 
	 * M�todo para preparar la grabaci�n, configurando los atributos de la fuente para audio y video,  
	 * el formado y el codificador. 
	 */ 
	public void prepareRecorder(){ 
		mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
		mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
		mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); 
		mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
	} 
} 
6
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioSource, setOutputFormat, setVideoEncoder, setVideoSource
 
	/** 
	 * Set up the source and the encorder 
	 */ 
	private void setupSourceEncoder() { 
		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);
	} 
 
	public void surfaceCreated(SurfaceHolder holder) {
		recorder.setOutputFile(outputFile);
		recorder.setPreviewDisplay(holder.getSurface());
		prepare(); 
	} 
 
	/** 
	 * Prepare the camera. Basically call {@link MediaRecorder#prepare()} 
6
CodeRank
This code example shows how to use the following methods:prepare, reset, setAudioEncoder, setAudioSource, setOutputFile
		recorder.stop();
    	recorder.release();
	} 
 
	public void resetSurfaceFile(String filename) {
		recorder.reset();
		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);
		  
		  
		outputFile = filename;
		recorder.setOutputFile(filename);
		 
		recorder.setPreviewDisplay(holder.getSurface());
		if (recorder != null) {
			try { 
				recorder.prepare();

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: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:setAudioEncoder, setAudioSource, setCaptureRate, setOutputFile, setOutputFormat
6
CodeRank
This code example shows how to use the following methods:setAudioEncoder, setAudioSource, setOutputFormat, setVideoEncoder, setVideoSource
		 
		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.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
		// recorder.setVideoSize(480, 320); 
		// recorder.setVideoFrameRate(15); 
		// recorder.setMaxDuration(10000); 
	} 
 
	public void surfaceCreated(SurfaceHolder holder) {
		recorder.setOutputFile(outputFile);
		recorder.setPreviewDisplay(holder.getSurface());
		if (recorder != null) {
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

Related MediaRecorder setVideoEncoder Questions & Answers:

setVideoEncoder Method Overview
Sets the video encoder to be used for recording.
See Code Examples for other Android MediaRecorder Methods: