0

I want to output elementary video streams with media recorder in android for the purpose of streaming with live555. In essence, I want to get media recorder to output an MPEG-4 Video Elementary Stream file (an .m4e file) or an H.264 Video Elementary Stream file (an .264 file). Is it possible to do that with media recorder on android? Or is there any other way to get it work?

Jomoos
  • 12,823
  • 10
  • 55
  • 92

2 Answers2

1

The answer is, as I understand, that it is not easy to do that with MediaRecorder while recording. You may do that without much difficulty, using ffmpeg once the video is recorded. The reason is that, MediaPlayer cannot record as elementary streams. Even if we record video only, it will be put in a container format such as 3GPP or MP4. Now, for tools like ffmpeg to work on these files, they need the 3GPP or MP4 header information must be present on the recorded file. But, MediaPlayer will write those headers to the file only after it finished recording.

Jomoos
  • 12,823
  • 10
  • 55
  • 92
1

From the MediaRecorder APIs I see that you have to call the setOutputFormat() before calling prepare(), this limits you to select one of the available options - 3GP/MP4. Hence you can use your own parser to operate on the dump from the mediarecorder, which can give you elementary streams.

Deepak
  • 1,101
  • 9
  • 14
  • Do you know about any library that will do that? – Jomoos Dec 22 '11 at 06:03
  • I can think of FFmpeg player which is an open source player and there is lots of info available online and stackoverflow to use it. You can have a look at the link, http://stackoverflow.com/questions/4725773/ffmpeg-on-android – Deepak Dec 22 '11 at 06:16
  • This link too might help, http://stackoverflow.com/questions/5899044/ffmpeg-extract-elementary-streams-from-mp4 – Deepak Dec 22 '11 at 06:20