package packets type NalAccessUnit struct { SPS []byte PPS []byte SEI [][]byte Data [][]byte } func (u *NalAccessUnit) AsAnnexB() (output []byte) { startCode := []byte{ 0x00,0x00,0x01} AUD := []byte{0x09, 0xF0} format := [][]byte{startCode, AUD, startCode, u.SPS, startCode, u.PPS } for i := range format { output = append(output,format[i]...) } for i := range u.SEI { output = append(output, append(startCode,u.SEI[i]...)...) } for i := range u.Data { output = append(output, append(startCode,u.Data[i]...)...) } return }