Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

H.264 Real-time Streaming

I'm trying to build a system that live-streams video and audio captured by android phones. I want to use media recorder to encode the data and then send it over RTP but the problem is how can i get the encoded data in a buffer.

like image 954
paparoch Avatar asked Nov 04 '22 18:11

paparoch


1 Answers

You can't. At least you can't without some hacks. Media recorder does not support writing to buffers.

The trick is to create pipe, extract pipe descriptor and pass it to setOutputFile(FileDescriptor fd) function. There are some issues with this approach, as MediaRecorder does not write media content in stream-oriented way. In other words, it relies on the fact that it can navigate back through file and write some package headers later on.

More details on this can be found here: Broadcasting video with Android - without writing to local files

like image 123
inazaruk Avatar answered Nov 13 '22 23:11

inazaruk