简体   繁体   中英

Saving h.264 streaming video using MediaMuxer on Android

(I'm not really good in English but I'll do my best.)

I'm working on a Android app that saves received h.264 streaming video/audio frames into a clip. And I ran into a problem that mentioned here , "Missing codec specific data."

I tried some method to solve this.

  1. Assign pre-defined codec specific data.
    Which I borrow from this post , It worked surprisedly perfect - but only on my personal phone (Sony Xperia Z3, Android 5.1.1). Most test devices just crush.(Android 4.3/4.4).
  2. Parsing codec specific data from video stream itself.
    On my phone it crushed. But somehow works on some devices. I use this code as an example.
  3. Create a encoder to encode received video frames then pass them to MediaMuxer.
    Yes it's a stupid idea, it doesn't work.
  4. Create a decoder to decode received video frames, pass them to an encoder, and then pass encoded frames to MediaMuxer, save it.
    App isn't able to get any free buffer from the encoder. DEADLOCK.

Now I'm running out of ideas.

The last hope I got is using ffmpeg.
But the resources I found are encode/decode videos from video files, not from stream.
Any suggestions?

Thanks in advance. :)

After been trying out a week including weekend studying h.264 spec and more.

I found out the problem isn't about video.

It's the AUDIO that is causing app to crush.


Case close , thanks for viewing. :\\

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM