Skip to content

Instantly share code, notes, and snippets.

@Nook2007
Created May 1, 2016 16:51
Show Gist options
  • Save Nook2007/92f460c87d8556d35ab5676f40a5e840 to your computer and use it in GitHub Desktop.
Save Nook2007/92f460c87d8556d35ab5676f40a5e840 to your computer and use it in GitHub Desktop.
if (VIDEO_TRACK == trackIndex) {
if (firstVideoData) {
byte[] spspps = {0, 0, 0, 1, 103, 66, -64, 30, -23, 1, 64, 123, 64, 60, 34, 17, -88, 0, 0, 0, 1, 104, -50, 6, -30}; //from media encoder
MediaCodec.BufferInfo spsPpsBI = new MediaCodec.BufferInfo();
spsPpsBI.flags = bufferInfo.flags;
spsPpsBI.presentationTimeUs = bufferInfo.presentationTimeUs;
spsPpsBI.offset = 0;
spsPpsBI.size = spspps.length;
flv.writeVideoSample(ByteBuffer.wrap(spspps), spsPpsBI);
firstVideoData = false;
}
flv.writeVideoSample(byteBuf, bufferInfo);
} else {
flv.writeAudioSample(byteBuf, bufferInfo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment