From ad547ff9d80382f8716f5b649725370537e03394 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 21 Jan 2026 18:27:55 +0100 Subject: [PATCH] support raw YUV420 in MOV --- nihav-commonfmt/src/demuxers/mov.rs | 21 +++++++++++++-------- nihav-registry/src/register.rs | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index 3b339e4..bc3191f 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -708,14 +708,19 @@ fn read_stsd(track: &mut Track, br: &mut dyn ByteIO, size: u64) -> DemuxerResult "unknown" }; let format = if cname == "rawvideo" { - match depth { - 1..=8 | 33..=40 => PAL8_FORMAT, - 15 | 16 => RGB555_FORMAT, - 24 => RGB24_FORMAT, - 32 => ARGB_FORMAT, - _ => { - println!("unknown depth {depth}"); - return Err(DemuxerError::NotImplemented); + if &fcc == b"j420" { + validate!(depth == 12); + YUV420_FORMAT + } else { + match depth { + 1..=8 | 33..=40 => PAL8_FORMAT, + 15 | 16 => RGB555_FORMAT, + 24 => RGB24_FORMAT, + 32 => ARGB_FORMAT, + _ => { + println!("unknown depth {depth}"); + return Err(DemuxerError::NotImplemented); + } } } } else if depth > 8 && depth <= 32 { diff --git a/nihav-registry/src/register.rs b/nihav-registry/src/register.rs index b869108..1ed3dc7 100644 --- a/nihav-registry/src/register.rs +++ b/nihav-registry/src/register.rs @@ -459,6 +459,8 @@ static MOV_VIDEO_CODEC_REGISTER: &[(&[u8;4], &str)] = &[ (b"mp4v", "mpeg4asp"), (b"avc1", "h264"), + + (b"j420", "rawvideo"), ]; static MOV_AUDIO_CODEC_REGISTER: &[(&[u8;4], &str)] = &[ -- 2.39.5