WIP: Video: 10/12 BPP and HDR video output support #120033

Draft
Aras Pranckevicius wants to merge 5 commits from aras_p/blender:ffmpeg_hdr into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

WIP!

I don't think this works "actually correctly" yet; but also the OCIO config does not have the required HLG bits yet, so I'm trying to emulate that manually. And possibly I got something wrong. Also the whole settings thing, not sure if that is the right place and way of doing it.

Anyway, what is here now is:

  • Video section got "bits/pixel" setting. Defaults to 8, which was the only option before. Now also shows 10 and 12 bpp options.
    • TODO: Have to somehow limit it to only display what is supported by the codec (and the ffmpeg build, which might be custom!). E.g. H264 should show (8, 10) options with default ffmpeg build, whereas AV1 should show (8, 10, 12).
  • Video section got "HDR" setting. Currently this is either "None" or "Rec.2020 HLG".

The settings are independent, and it is a good question whether they should be. I opted for independent ones, since e.g. this would allow 10bpp videos even for non-HDR use cases (which can improve smooth gradients). In theory you can also use HDR with 8bpp videos (but really you should not, since banding will be quite severe) -- should the UI "somehow" try to prevent that?

Behavior:

  • When HDR video output is requested, the scene Linear colorspace gets hardcoded to Linear Rec.2020. The UI shows non-HDR color space options (since it thinks that "ffmpeg" image type is "not HDR", ugh). These are completely ignored!
  • For HDR input, the input Linear Rec.2020 values get manually transformed into HLG before passing that into ffmpeg. This ideally should be done by OCIO, but we don't have the config yet.
  • More than 8bpp incoming image for ffmpeg encoding gets translated into proper format for swscale (input packed RGBA floats -> planar R,G,B,A floats -> YUV formats with 10 or 12 bpp).
WIP! ![](/attachments/168820d2-f102-426b-bb97-ca4a4142a92f) I don't think this works "actually correctly" yet; but also the OCIO config does not have the required HLG bits yet, so I'm trying to emulate that manually. And possibly I got something wrong. Also the whole settings thing, not sure if that is the right place and way of doing it. Anyway, what is here now is: - Video section got "bits/pixel" setting. Defaults to 8, which was the only option before. Now also shows 10 and 12 bpp options. - TODO: Have to somehow limit it to only display what is supported by the codec (and the ffmpeg build, which might be custom!). E.g. H264 should show (8, 10) options with default ffmpeg build, whereas AV1 should show (8, 10, 12). - Video section got "HDR" setting. Currently this is either "None" or "Rec.2020 HLG". The settings are independent, and it is a good question whether they should be. I opted for independent ones, since e.g. this would allow 10bpp videos even for non-HDR use cases (which can improve smooth gradients). In theory you can also use HDR with 8bpp videos (but really you should not, since banding will be quite severe) -- should the UI "somehow" try to prevent that? Behavior: - When HDR video output is requested, the scene Linear colorspace gets hardcoded to `Linear Rec.2020`. The UI shows non-HDR color space options (since it thinks that "ffmpeg" image type is "not HDR", ugh). These are completely ignored! - For HDR input, the input `Linear Rec.2020` values get manually transformed into HLG before passing that into ffmpeg. This ideally should be done by OCIO, but we don't have the config yet. - More than 8bpp incoming image for ffmpeg encoding gets translated into proper format for swscale (input packed RGBA floats -> planar R,G,B,A floats -> YUV formats with 10 or 12 bpp).
Aras Pranckevicius added 2 commits 2024-03-28 20:42:01 +01:00
Aras Pranckevicius added this to the Video Sequencer project 2024-04-09 10:32:05 +02:00
Aras Pranckevicius added 1 commit 2024-04-12 19:23:24 +02:00
1cf58feaf8 Merge branch 'main' into ffmpeg_hdr
# Conflicts:
#	source/blender/blenkernel/intern/writeffmpeg.cc
Aras Pranckevicius added 1 commit 2024-04-12 19:27:57 +02:00
Aras Pranckevicius added 1 commit 2024-04-22 09:28:37 +02:00
This pull request is marked as a work in progress.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u ffmpeg_hdr:aras_p-ffmpeg_hdr
git checkout aras_p-ffmpeg_hdr
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#120033
No description provided.