Skip to main content

Import Sony Alpha HLG stills and convert them into Ultra HDR JPEGs automatically.

Project description

Sony HLG to Ultra HDR Importer

Automate your Sony Alpha ingest workflow: copy new Hybrid Log Gamma (HLG) stills and clips from the SD card, convert .HIF frames into Ultra HDR JPEGs, and resume where you left off on the next card import.

Why This Exists

Modern Sony Alpha bodies (A1, A7R V, A7S III, A6700, FX30, ZV-E1, and more) can capture stills in HLG as .HIF files. Converting those files to viewable Ultra HDR JPEGs typically requires a handful of command-line tools and careful bookkeeping. This package wraps the process in a single command:

  • Detect a mounted Sony SD card (or use a manual path on any platform).
  • Copy any new stills (.HIF, .ARW) and clips (.MP4, .MXF, .M2TS) into timestamped export folders.
  • Invoke the bundled conversion helper to turn fresh HLG stills into Ultra HDR JPEGs.
  • Track the last imported filenames in a SQLite database so repeat runs focus only on new material.

Features

  • Multi-camera awareness: Works with current Sony Alpha, FX, and ZV series bodies that write HLG .HIF.
  • Safe imports: Leaves existing exports untouched; only copies media newer than the last recorded filename.
  • Ultra HDR conversion: Bundles convert_hif_to_ultrahdr.sh so you can feed captures straight to Google Photos or Android devices that understand Ultra HDR.
  • Portable state: Stores progress in ~/.sony_hlg_ultrahdr/media_progress.db by default, with overrides for shared workflows.
  • Dual entry points: Installs the new sony-hlg-to-ultrahdr CLI and keeps the legacy sony-media-import name for existing scripts.

Installation

Install from a source checkout or a downloaded wheel:

python -m pip install sony-hlg-to-ultrahdr

This installs the package and exposes the command-line entry points.

External Dependencies

The conversion pipeline relies on a few native tools. Install them before running the importer.

Required binaries

  • ffmpeg (must include the zscale filter)
  • ffprobe
  • exiftool
  • ultrahdr_app built from Google’s libultrahdr project

Quick install snippets

macOS (Homebrew):

brew install ffmpeg exiftool

Ubuntu / Debian:

sudo apt update
sudo apt install ffmpeg exiftool

Build ultrahdr_app:

git clone https://github.com/google/libultrahdr.git
cd libultrahdr
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target ultrahdr_app -j

Point the importer at build/ultrahdr_app using --ultrahdr-app or the HLG_ULTRAHDR_APP environment variable.

Quick Start

sony-hlg-to-ultrahdr \
  --image-dest ~/Pictures/sony/imports/images \
  --video-dest ~/Pictures/sony/imports/videos \
  --ultra-dest ~/Pictures/sony/imports/images_ultrahdr
  • If you omit --sd-root, the tool attempts to auto-detect a mounted card (macOS /Volumes/*). Supply the flag on Linux/Windows or when multiple cards are attached.
  • Export folders default to export_YYMMDD[_NN] relative to the current working directory if you skip the destination flags.

Configuration Reference

Purpose CLI flag Environment variables
SD card mount point --sd-root HLG_ULTRAHDR_SD_ROOT, AUTO_IMPORT_SD_ROOT
Still destination --image-dest
Video destination --video-dest
Ultra HDR destination --ultra-dest
SQLite database path --db-path HLG_ULTRAHDR_DB_PATH, AUTO_IMPORT_DB_PATH
State directory (default parent for DB) derived from --db-path HLG_ULTRAHDR_STATE_DIR, AUTO_IMPORT_STATE_DIR
Conversion script --convert-script HLG_ULTRAHDR_CONVERT_SCRIPT, AUTO_IMPORT_CONVERT_SCRIPT
ultrahdr_app binary --ultrahdr-app HLG_ULTRAHDR_APP, AUTO_IMPORT_ULTRAHDR_APP

Use either the CLI flags or the environment variables; flags take precedence.

Developing and Packaging

Run the CLI module directly from the source tree:

python -m sony_hlg_ultrahdr.cli --help

Build distribution artifacts:

python -m pip install --upgrade build twine  # once per environment
python -m build                              # produces dist/*.tar.gz and dist/*.whl

Publish to PyPI or TestPyPI with Twine:

# TestPyPI
python -m twine upload --repository testpypi dist/*

# PyPI
python -m twine upload dist/*

Export TWINE_USERNAME=__token__ and TWINE_PASSWORD=<token> or configure ~/.pypirc before uploading.

License

Update pyproject.toml with the correct author and license metadata before distributing the package. If you plan to share binaries of ultrahdr_app, review Google’s libultrahdr licensing terms as well.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sony_hlg_to_ultrahdr-0.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sony_hlg_to_ultrahdr-0.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file sony_hlg_to_ultrahdr-0.2.0.tar.gz.

File metadata

  • Download URL: sony_hlg_to_ultrahdr-0.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for sony_hlg_to_ultrahdr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b96985fccdd2c472858937c183a9ba0095e53d7e2cef947af8c7be7c7cb5676e
MD5 8e11827cf1d1bef8c11ec43002158b45
BLAKE2b-256 a2c96a4b2422520efcb49bcd97588ef540c0d38a1d40c4ea8ec1e681b328816d

See more details on using hashes here.

File details

Details for the file sony_hlg_to_ultrahdr-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sony_hlg_to_ultrahdr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c484ddfda45d9fa0e01c02579093d2afd8ebce8ec638bb94b7f95d4ceeb2fa27
MD5 42c3d273fea2264f0acb70169656da4b
BLAKE2b-256 c58e1e56f1fc6ac85946537d520ad6ef3dd307a392fb2cd5446cda4472b77a97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page