Java tutorial
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static void writeVideoHeader(ByteBuffer buffer, int flvVideoFrameType, int codecID, int AVCPacketType) { byte first = (byte) (((flvVideoFrameType & 0x0F) << 4) | (codecID & 0x0F)); buffer.put(first); buffer.put((byte) AVCPacketType); buffer.put((byte) 0x00); buffer.put((byte) 0x00); buffer.put((byte) 0x00); } }