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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With