native1989
native1989

Reputation: 95

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

Upvotes: 3

Views: 2386

Answers (2)

Paul Gregoire
Paul Gregoire

Reputation: 9793

I've got a small project that shows how to put raw h264 into an RTMP format here; its not perfect, but it mostly works.

Upvotes: 0

Related Questions