Skip to content

Instantly share code, notes, and snippets.

@jruesga
jruesga / Mp4Demuxer.kt
Created October 10, 2023 10:55
Mp4Demuxer
import java.io.BufferedInputStream
import java.io.File
import java.io.FileInputStream
import java.math.BigInteger
import java.nio.ByteBuffer
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*
var position = 0L;
@jruesga
jruesga / HevcInitDataParser.kt
Created November 25, 2022 18:46
A HEVC nal unit init data parser
import java.nio.ByteBuffer
fun main() {
val vps_nal = "40010c01ffff01600000030090000003000003005d959809"
val rbsp_vps = ByteBuffer.wrap(vps_nal.decodeHex()).toBits()
println(rbsp_vps)
parseNalUnitHeader(rbsp_vps)
parseVps(rbsp_vps)
val sps_nal = "42010101600000030090000003000003005da002008024165959a4932bc05a70800001f480002ee0401f4880"