How to include Video DSI in the 1st encoded data stream?

I intend to encode YUV data in H264 format on the Android platform. I have all of this implemented, however I have one small request to ask here about returning DSI data with a call to dequeOutputBuffer ().

Currently, for the first call to the dequeOutputBuffer () function, I am returning DSI data. So, for the first YUV input frame for ViceoEncoder, I call dequeOutputBuffer () twice to get the encoded stream. For the rest of the frames, I call dequeOutputBuffer () only once to get the corresponding encoded data. This approach works great on devices running on an ARM arch, however, on a device running on x86 architecture, it hangs during dequeOutputBuffer () while encoding the first YUV frame.

So my questions are:

  • Am I missing something wrt encoder configuration?
  • Is there a way to return a combined DSI + EncodedData stream with a single call to dequeOutputBuffer ()?

Hope the question is clear.

+3
source share
1 answer

The video encoder will accept N frames before creating any output. In some cases, N will be 1, and you will see the output frame shortly after providing one input frame. Other codecs will want to collect a bright bit of video data before embarking on a release. It seems you were able to solve your current situation by doubling the frames and discarding half the output, but you should know that different devices and different codecs will behave differently (assuming portability is a problem).

CSD BUFFER_FLAG_CODEC_CONFIG. MediaCodec , . ( , VP8, .) AVC . CSD, .

, API , CSD, .

, , 0,1,2 0,2,1. - , . PTS , "" , .

+1

All Articles