Skip to content

Add AV1 bitstream support (extract, inject, remove)#117

Open
sven-pke wants to merge 2 commits intoquietvoid:mainfrom
sven-pke:feat/av1-bitstream
Open

Add AV1 bitstream support (extract, inject, remove)#117
sven-pke wants to merge 2 commits intoquietvoid:mainfrom
sven-pke:feat/av1-bitstream

Conversation

@sven-pke
Copy link
Copy Markdown

@sven-pke sven-pke commented Mar 19, 2026

Summary

This PR adds AV1 bitstream support to hdr10plus_tool alongside the existing HEVC pipeline -- no HEVC code is removed or modified.

  • New av1_parser workspace crate owns all AV1 I/O: ObuReader, IvfWriter, ObuWriter, and frame-level read/write helpers
  • HDR10+-specific AV1 helpers (is_hdr10plus_obu, extract_hdr10plus_t35_bytes) live in src/core/av1_parser.rs
  • HDR10+ OBU encoding lives in hdr10plus/src/av1/mod.rs (encode_hdr10plus_obu / encode_av1_from_json) as part of the library crate
  • Format is detected by file extension (.av1 / .ivf); IVF vs. raw OBU stream is auto-detected at runtime via magic header

Commands extended

Command AV1 behaviour
extract Extracts HDR10+ metadata OBUs, writes standard .json
inject Injects HDR10+ OBU per temporal unit (right after OBU_TEMPORAL_DELIMITER)
remove Strips all HDR10+ metadata OBUs, passes everything else through

Design

  • av1_parser crate is responsible for all AV1 I/O
  • All existing HEVC code paths and dependencies are fully preserved
  • Both raw AV1 and IVF container formats are supported
  • Builds with zero warnings

Relates to #50

sven-pke and others added 2 commits March 19, 2026 12:31
Introduces an 'av1_parser' workspace crate that owns all generic AV1
OBU parsing and I/O (ObuReader, IvfWriter, ObuWriter, LEB128, IVF
container handling). All existing HEVC functionality is preserved.

Commands that process bitstreams (extract, inject, remove) now
auto-detect the input format:
  .av1 / .ivf  -> new AV1 code path
  everything else  -> existing HEVC code path (unchanged)

The hdr10plus library crate gains a new 'av1' module with HDR10+
OBU encoding/decoding (OBU_METADATA T.35, provider_code=0x003C).
HDR10+-specific AV1 helpers live in src/core/av1_parser.rs.
- Remove Av1NaluParser and TemporalUnitInfo structs from av1_parser.rs
  (they were unused dead code suppressed by #![allow(dead_code)])
- Remove unused re-exports (IvfWriter, ObuWriter) from av1_parser.rs
- Move inner use blocks to file-level imports in inject.rs and remove.rs
- Remove Av1NaluParser usage from extract.rs and inject.rs
- Builds with zero warnings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant