src/main/java/org/jcodec/codecs/h264/H264Utils.java
public static void encodeMOVPacketInplace(ByteBuffer avcFrame) {

        ByteBuffer dup = avcFrame.duplicate();
        ByteBuffer d1 = avcFrame.duplicate();

        for (int tot = d1.position();;) {
            ByteBuffer buf = H264Utils.nextNALUnit(dup);
            if (buf == null)
                break;
            d1.position(tot);
            d1.putInt(buf.remaining());
            tot += buf.remaining() + 4;
        }
    }
public static void encodeMOVPacketInplace(ByteBuffer avcFrame) {

        ByteBuffer dup = avcFrame.duplicate();
        ByteBuffer d1 = avcFrame.duplicate();

        for (int tot = d1.position();;) {
            ByteBuffer buf = H264Utils.nextNALUnit(dup);
            if (buf == null)
                break;
            d1.position(tot);
            d1.putInt(buf.remaining());
            tot += buf.remaining() + 4;
        }
    }
public static void encodeMOVPacketInplace ( ByteBuffer avcFrame ) { ByteBuffer dup = avcFrame . duplicate ( ) ; ByteBuffer d1 = avcFrame . duplicate ( ) ; for ( int tot = d1 . position ( ) ; ; ) { ByteBuffer buf = H264Utils . nextNALUnit ( dup ) ; if ( buf == null ) break ; d1 . position ( tot ) ; d1 . putInt ( buf . remaining ( ) ) ; tot += buf . remaining ( ) + 4 ; } }
Encodes AVC frame in ISO BMF format. Takes Annex B format.

Scans the packet for each NAL Unit starting with 00 00 00 01 and replaces
this 4 byte sequence with 4 byte integer representing this NAL unit
length.

@param avcFrame
AVC frame encoded in Annex B NAL unit format
Encodes AVC frame in ISO BMF format . Takes Annex B format .