Important
Due to the weakening Japanese yen, it has become increasingly difficult to afford not only the equipment needed to continue development, but even basic daily necessities. If you find this project useful, please consider supporting its development. Your help would mean a great deal.
SDR 動画を HDR10 向けに変換する Python ツールです。GUI と CLI の両方を備えています。
現行版は AI model 前提 の運用です。変換時には学習済み TorchScript モデル (.pt) を指定するか、GUI の models/ プルダウンから選択する必要があります。
- 入力は通常の SDR 動画です。
- 出力は HDR10 メタデータ付きの動画です。
- GUI は queue 実行に対応しています。
- AI モデルは
models/フォルダ内の.ptファイルを使用します。
- Python
ffmpegとffprobeが実行可能であること(ffmpeg5.1 以上)- PyTorch を含む依存関係
- RTX Video SDK 超解像を使う場合は、RTX GPU と
nvidia-vfx(pip install -e ".[rtx]") - Intel OpenVINO 超解像を使う場合は、
openvino(pip install openvino)。モデル自動ダウンロードにはopenvino-devも必要 - Intel QSV エンコードを使う場合は、対応Intel GPU、ドライバー、および
hevc_qsv対応FFmpeg
OS ごとの backend は次の通りです。
- Windows:
Auto,CUDA,XPU,CPU / NumPy - macOS:
Auto,MPS,CPU / NumPy - Linux:
Auto,XPU,CPU / NumPy - その他:
Auto,CPU / NumPy
Auto は使える環境で GPU backend を優先し、使えない場合は CPU 側へ寄せます。Intel GPU の XPU backend には XPU 対応の PyTorch ビルドが必要です。
Windows のGUIでは QSV (Fast on Intel) を選ぶとIntel Quick Sync VideoでHEVC Main10をエンコードします。QSVの初期化に失敗した場合は libx265 へフォールバックします。
依存関係をインストールし、学習済みモデルを models/ に置きます。
python -m venv .venv
.\.venv\Scripts\activate
pip install -e ".[ai]"RTX Video SDK 超解像も使う場合は、代わりに rtx 依存関係をまとめてインストールします。このコマンドで nvidia-vfx も導入されます。
pip install -e ".[ai,rtx]"Intel OpenVINO 超解像を使う場合は、openvino をインストールします。モデルの自動ダウンロードには openvino-dev(omz_downloader コマンド)も必要です。
pip install openvino openvino-devモデル配置例:
models/
enhancement_model_reuse_v1.pt
python -m sdr2hdr.guiGUI の基本動作:
InputとOutputを指定Presetは既定でportraitToneは既定でvivid、Input EOTFは既定でbt1886Output Sizeは既定でSource。高解像度出力が必要な場合は2x、4x、またはCustomCustomではTarget Sizeに3840 x 2160のような偶数解像度を指定Upscale Engineは既定でFFmpeg Scaler。RTX Video SDK を使う場合はRTX Video SDK、Intel OpenVINO 超解像を使う場合はIntel OpenVINO SRを選択AI Modelでmodels/内の.ptを選択AI Strengthは既定で0.25Add To QueueまたはAdd Filesで queue へ追加Start Queueで順次変換
python -m sdr2hdr.cli input.mp4 output_hdr.mp4 --model-path models\enhancement_model_reuse_v1.ptoutput_path を省略した場合は、入力ファイル名の末尾に _hdr を付けた名前が自動生成されます。
python -m sdr2hdr.cli input.mp4 --model-path models\enhancement_model_reuse_v1.ptYouTube comparison sample:
The sample video compares:
- Left: original SDR footage
- Right: HDR output converted with
sdr2hdr
Preset- 既定値は
portrait
- 既定値は
HDR Stylenatural(既定)、cinematic、nightからハイライト/シャドウの傾向を選択
Tone- 既定値は
vivid(SDR の白を peak nits に配置する、効果の分かりやすい絵)。referenceは BT.2408 準拠で白を 203 nits に固定する控えめな絵
- 既定値は
Input EOTF- 既定値は
bt1886(放送/BT.709 系動画向け)。PC 由来のソースはsrgb
- 既定値は
Upscale EngineFFmpeg Scaler(既定)、RTX Video SDK、またはIntel OpenVINO SRRTX Video SDKはフレームごとに NGX の超解像セッションを 1 回だけロードして使い回し、SDR→HDR 処理の直前で各フレームを超解像Intel OpenVINO SRは Intel Open Model Zoo の超解像モデル(sr-1032: 4x、sr-1033: 3x)を使用し、CPU / Intel iGPU / Arc GPU 上で推論を実行
Output SizeSource(既定)、2x、4x、Customから出力解像度を選択
Target SizeOutput SizeがCustomの場合に使用する明示的な偶数解像度
Scaler- 既定値は
Lanczos。FFmpeg Scaler使用時の ffmpeg スケーラを選択
- 既定値は
RTX QualityRTX Video SDK使用時の超解像品質(Low/Medium/High(既定)/Ultra)
Encoder- 環境に応じて
libx265、NVENC、VideoToolboxを選択
- 環境に応じて
Speed/QualityPreview,Balanced,Final
Backend- OS ごとの対応 backend から選択
AI Modelmodels/直下の.ptをプルダウン表示
Refreshmodels/を再スキャン
AI Strength- 既定値は
0.25
- 既定値は
3つとも絵に影響しますが、役割が異なります。
Preset: 何を変換するかで選ぶ(人物中心ならportrait)HDR Style: 仕上がりの雰囲気で選ぶ(迷ったらnatural)Tone: 明るさの基準。既定のvividは HDR の効果が分かりやすい派手な絵。放送グレーディングに近い控えめな絵にしたい場合はreferenceInput EOTF: 好みではなくソースの種類で決める(TV/カメラ動画 =bt1886、PC/Web 由来 =srgb)
GUI では各項目にマウスを乗せると説明がツールチップで表示されます。
GUI は複数ジョブの queue 実行に対応しています。
Add To Queue- 現在の入力設定を queue に追加
Add Files- 複数ファイルをまとめて queue に追加
Remove Selected- 選択中の queue 項目を削除
Clear Queue- queue を全削除
Start Queue- queue を順次処理
Stop Current- 実行中ジョブの停止を要求
Queue の status 表示は現在次の 7 種類です。
QUEUEDSTARTINGRUNNINGCANCELLINGOKFAILEDCANCELLED
Stop Current を押した場合は、まず CANCELLING になり、終了時に CANCELLED へ確定します。
ジョブが FAILED になった場合はログに記録され、queue の残りはそのまま継続実行されます。
- キャンセル時は partial output を保持する前提です。
- GUI の進捗欄には
partial output savedと表示されます。
現行 CLI の基本仕様:
input_pathは必須output_pathは省略可能--model-pathは必須--model-pathは.ptモデルを指定--presetの既定値はportrait--hdr-styleはnatural(既定),cinematic,night--backendはauto,numpy,cuda,mps--ai-strengthの既定値は0.25--toneはvivid(既定。SDR の白を peak nits に配置)またはreference(BT.2408 準拠で白を 203 nits に固定し、それ以上をハイライト用に確保)--input-eotfはsrgb(既定)またはbt1886(放送/BT.709 系の動画ソース向け)--upscale-engineはffmpeg(既定)、rtx-video、またはintel-vino--output-scaleは HDR 変換後の出力解像度倍率(既定1.0)。例:2.0で 1080p 入力を 4K 出力--target-resolutionは3840x2160のような明示的な偶数解像度。--output-scaleとは併用不可--scalerはlanczos(既定),bicubic,bilinear--rtx-video-qualityは RTX Video SDK 使用時の超解像品質。low,medium,high(既定),ultra--intel-sr-modelは Intel OpenVINO 超解像モデル。sr-1032(既定、4x) またはsr-1033(3x)--intel-sr-deviceは Intel OpenVINO 推論デバイス。AUTO(既定)、CPU、GPU(Intel iGPU/Arc)
例:
python -m sdr2hdr.cli input.mp4 output_hdr.mp4 `
--preset portrait `
--backend auto `
--encoder libx265 `
--x265-mode balanced `
--model-path models\enhancement_model_reuse_v1.pt `
--ai-strength 0.25 `
--output-scale 2.0 `
--scaler lanczosRTX Video SDK 超解像を使う例:
python -m sdr2hdr.cli input.mp4 output_hdr_4k.mp4 `
--model-path models\enhancement_model_reuse_v1.pt `
--upscale-engine rtx-video `
--output-scale 2.0 `
--rtx-video-quality highRTX Video SDK の超解像は nvidia-vfx(pip install -e ".[rtx]")経由で NVIDIA NGX を利用します。ジョブ全体で 1 つの超解像セッションをロードして使い回すため、フレームごとや外部プロセスごとに NGX を再初期化することはありません。
Intel OpenVINO 超解像を使う例:
python -m sdr2hdr.cli input.mp4 output_hdr_4k.mp4 `
--model-path models\enhancement_model_reuse_v1.pt `
--upscale-engine intel-vino `
--intel-sr-model sr-1032 `
--intel-sr-device GPU `
--target-resolution 3840x2160Intel OpenVINO 超解像は Open Model Zoo の single-image-super-resolution モデルを使用します。モデルは初回実行時に ~/.cache/sdr2hdr/intel_models/ へ自動ダウンロードされます(omz_downloader が必要。pip install openvino-dev でインストール)。推論は Intel CPU、統合GPU、または Arc dGPU 上で実行できます。
- GUI は
models/フォルダを参照します。 - 参照先は環境変数
SDR2HDR_MODELS_DIRで上書きできます。 - 読み込むのは
.ptファイルのみです。 - モデル未配置時は GUI のプルダウンに有効候補が出ません。
- CLI では
--model-pathに明示指定します。
推奨:
- 配布用・運用用モデルは
models/にまとめる - ファイル名で日付やバージョンを区別する
- 現行 README は
利用者向けの内容に絞っています。 peak nitsなどの内部パラメータは GUI からは直接設定できません。- VFR(可変フレームレート)入力は平均フレームレートの CFR に正規化して処理します。
- PQ 量子化時にはバンディング低減のためのディザリングを適用します。
.onnxや DirectML は現行の利用手順には含めていません。- AI モデルなしでの運用は前提にしていません。
This project is licensed under the MIT License.
sdr2hdr is a Python tool for converting SDR video to HDR10-style output. It provides both a GUI and a CLI.
The current workflow assumes AI model usage. You must provide a trained TorchScript model (.pt) for conversion, either from the GUI dropdown or with --model-path in the CLI.
- Input: regular SDR video
- Output: HDR10-tagged video
- The GUI supports queued batch processing
- AI models are loaded from
.ptfiles in themodels/folder
- Python
ffmpegandffprobeavailable inPATH(ffmpeg5.1 or newer)- Project dependencies including PyTorch
- An RTX GPU and
nvidia-vfx(pip install -e ".[rtx]") when RTX Video SDK super resolution is used openvino(pip install openvino) when Intel OpenVINO super resolution is used;openvino-devis also needed for automatic model download
Backend options by OS:
- Windows:
Auto,CUDA,CPU / NumPy - macOS:
Auto,MPS,CPU / NumPy - Other platforms:
Auto,CPU / NumPy
Auto prefers a GPU backend when available and falls back toward CPU processing otherwise.
Create a virtual environment, install the package, and place a trained model in models/.
python -m venv .venv
.\.venv\Scripts\activate
pip install -e ".[ai]"To also use RTX Video SDK super resolution, install the rtx dependencies at the same time instead. This command also installs nvidia-vfx.
pip install -e ".[ai,rtx]"To use Intel OpenVINO super resolution, install openvino. For automatic model download from the Open Model Zoo, also install openvino-dev (provides the omz_downloader command).
pip install openvino openvino-devExample model layout:
models/
enhancement_model_reuse_v1.pt
python -m sdr2hdr.guiBasic GUI workflow:
- Set
InputandOutput Presetdefaults toportraitTonedefaults tovividandInput EOTFdefaults tobt1886Output Sizedefaults toSource; choose2x,4x, orCustomfor higher-resolution outputCustomusesTarget Size, such as3840 x 2160, and requires even dimensionsUpscale Enginedefaults toFFmpeg Scaler; chooseRTX Video SDKfor NVIDIA SR, orIntel OpenVINO SRfor Intel-based super resolution- Select a
.ptmodel fromAI Model AI Strengthdefaults to0.25- Add jobs with
Add To QueueorAdd Files - Run them with
Start Queue
python -m sdr2hdr.cli input.mp4 output_hdr.mp4 --model-path models\enhancement_model_reuse_v1.ptIf output_path is omitted, the tool automatically creates a name with _hdr appended.
python -m sdr2hdr.cli input.mp4 --model-path models\enhancement_model_reuse_v1.ptYouTube 比較サンプル:
このサンプル動画では次を比較しています。
- 左: 元の SDR 映像
- 右:
sdr2hdrで変換した HDR 映像
Preset- Default:
portrait
- Default:
HDR Stylenatural(default),cinematic, ornighthighlight/shadow behavior
Tone- Default:
vivid(SDR white mapped to peak nits for a clearly visible HDR effect).referencefollows BT.2408 with SDR white anchored at 203 nits for a subtler picture
- Default:
Input EOTF- Default:
bt1886(for broadcast/BT.709 video). Usesrgbfor PC-origin sources
- Default:
Upscale EngineFFmpeg Scaler(default),RTX Video SDK, orIntel OpenVINO SRRTX Video SDKloads a single NGX super-resolution session once and reuses it for every frame, running just before the SDR-to-HDR passIntel OpenVINO SRuses Intel Open Model Zoo super-resolution models (sr-1032: 4x, sr-1033: 3x) and runs inference on CPU, Intel iGPU, or Arc dGPU
Output SizeSource(default),2x,4x, orCustom
Target Size- Exact even output resolution used when
Output SizeisCustom
- Exact even output resolution used when
Scaler- Default:
Lanczos; selects the ffmpeg scaler used withFFmpeg Scaler
- Default:
RTX Quality- Super-resolution quality when
RTX Video SDKis used (Low/Medium/High(default)/Ultra)
- Super-resolution quality when
Encoderlibx265,NVENC, orVideoToolboxdepending on platform
Speed/QualityPreview,Balanced,Final
Backend- Available backends depend on the current OS
AI Model- Dropdown populated from
.ptfiles inmodels/
- Dropdown populated from
Refresh- Rescans
models/
- Rescans
AI Strength- Default:
0.25
- Default:
All three affect the picture, but they answer different questions.
Preset: pick by what you are converting (portraitfor people-centric footage)HDR Style: pick by the mood you want (naturalif unsure)Tone: the brightness standard. The defaultvividgives a punchy, clearly-HDR picture; switch toreferencefor a subtler, broadcast-style gradeInput EOTF: determined by the source, not by taste (TV/camera video =bt1886, PC/web content =srgb)
In the GUI, hovering over each control shows a tooltip with the same guidance.
The GUI supports multi-job queue execution.
Add To Queue- Adds the current form values to the queue
Add Files- Adds multiple files to the queue
Remove Selected- Removes selected queue items
Clear Queue- Clears the queue
Start Queue- Starts sequential processing
Stop Current- Requests cancellation for the current job
The current queue status labels are:
QUEUEDSTARTINGRUNNINGCANCELLINGOKFAILEDCANCELLED
If you press Stop Current, the job first moves to CANCELLING and then settles on CANCELLED.
When a job becomes FAILED, the error is written to the log and the rest of the queue keeps running.
- Partial output is kept on cancellation
- The GUI progress text reports
partial output saved
Current CLI behavior:
input_pathis requiredoutput_pathis optional--model-pathis required--model-pathmust point to a.ptmodel--presetdefaults toportrait--hdr-styleisnatural(default),cinematic, ornight--backendsupportsauto,numpy,cuda,mps--ai-strengthdefaults to0.25--toneisvivid(default, maps SDR white to peak nits) orreference(BT.2408: anchors SDR white at 203 nits, reserving the range above for highlights)--input-eotfissrgb(default) orbt1886(for broadcast/BT.709 video sources)--upscale-engineisffmpeg(default),rtx-video, orintel-vino--output-scalescales the HDR output resolution after conversion (default1.0), for example2.0turns 1080p into 4K output--target-resolutionsets an exact even output size such as3840x2160; do not combine it with--output-scaleother than1.0--scalerislanczos(default),bicubic, orbilinear--rtx-video-qualityis the RTX Video SDK super-resolution quality:low,medium,high(default), orultra--intel-sr-modelis the Intel OpenVINO super-resolution model:sr-1032(default, 4x) orsr-1033(3x)--intel-sr-deviceis the Intel OpenVINO inference device:AUTO(default),CPU, orGPU(Intel iGPU/Arc)
Example:
python -m sdr2hdr.cli input.mp4 output_hdr.mp4 `
--preset portrait `
--backend auto `
--encoder libx265 `
--x265-mode balanced `
--model-path models\enhancement_model_reuse_v1.pt `
--ai-strength 0.25 `
--output-scale 2.0 `
--scaler lanczosExample using RTX Video SDK super resolution:
python -m sdr2hdr.cli input.mp4 output_hdr_4k.mp4 `
--model-path models\enhancement_model_reuse_v1.pt `
--upscale-engine rtx-video `
--output-scale 2.0 `
--rtx-video-quality highRTX Video SDK super resolution runs through nvidia-vfx (pip install -e ".[rtx]"), which wraps NVIDIA NGX. A single super-resolution session is loaded once and reused for the whole job, so NGX is never re-initialized per frame or per external process.
Example using Intel OpenVINO super resolution:
python -m sdr2hdr.cli input.mp4 output_hdr_4k.mp4 `
--model-path models\enhancement_model_reuse_v1.pt `
--upscale-engine intel-vino `
--intel-sr-model sr-1032 `
--intel-sr-device GPU `
--target-resolution 3840x2160Intel OpenVINO super resolution uses Open Model Zoo single-image-super-resolution models. Models are automatically downloaded to ~/.cache/sdr2hdr/intel_models/ on first use (omz_downloader from pip install openvino-dev is required). Inference runs on Intel CPUs, integrated GPUs, or Arc discrete GPUs.
- The GUI scans the
models/folder - The location can be overridden with the
SDR2HDR_MODELS_DIRenvironment variable - Only
.ptfiles are shown - If no model is present, the GUI dropdown has no usable candidate
- The CLI requires an explicit
--model-path
Recommended practice:
- Keep deployment models in
models/ - Use filenames with dates or versions
- This README is intentionally user-focused
- Internal parameters such as
peak nitsare not directly exposed in the GUI - VFR (variable frame rate) input is normalized to CFR at the average frame rate
- Dithering is applied at PQ quantization to reduce banding
.onnxand DirectML are not part of the current usage flow- Running without an AI model is not the intended workflow
This project is licensed under the MIT License.
