3

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

native1989
  • 95
  • 3
  • 10

2 Answers2

3

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)"

Community
  • 1
  • 1
javiCabanas
  • 4,231
  • 1
  • 13
  • 8
0

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.

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131