Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stream android camera over RTMP

I was searching in all stackoverflow posts , but not find ask for this question. I need stream video from android camera to rtmp server. In this time, I make rtmp packet, put in rtmp body buffer from pipe:

mediaRecorder.setOutputFile(pipe[1].getFileDescriptor());

Settings for media:

camera = Camera.open();
mediaRecorder.setCamera(camera);
mediaRecorder.setVideoSource(0);
mediaRecorder.setOutputFormat(8);
mediaRecorder.setVideoSize(640, 480);
mediaRecorder.setVideoEncodingBitRate(10000);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); 
mediaRecorder.setPreviewDisplay(previewHolder.getSurface());

Then reading data from inputStream into array and put this data to rtmpbody I`m understand, thats wrong, but I have no idea how make raw h264 streamable

like image 780
native1989 Avatar asked Jul 12 '26 08:07

native1989


1 Answers

Maybe you already did, if not, you should take a look to these questions.

Accessing the output video while recording

Transfer InputStream to another Service (across process boundaries) with ParcelFileDescriptor.createPipe() failes with "EBADF (Bad file number)"

like image 127
javiCabanas Avatar answered Jul 14 '26 00:07

javiCabanas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!