#heif #heic #hevc #command-line-tool #graphics #bpg

bin+lib bpg2hevc

CLI tool to convert some BPG pictures to raw HEVC streams (and indirectly to HEIC images)

1 unstable release

0.1.0 May 4, 2023

#385 in Video

MIT/Apache

8KB
113 lines

bpg2hevc

Command line tool that allows you to losslessly convert compatible BPG files to HEIC format that is more widely supported. The tool itself handles extraction of HEVC stream from BPG files. That stream can be consumed by other tools like FFmpeg or MP4Box.

Example

$ bpgenc sample.png -o sample.bpg
$ bpg2hevc sample.bpg > sample.hvc
$ MP4Box -add-image sample.hvc:primary -new sample.heic

Limitations

The tool was created to process my own files, which are rather uniform, and may fail to handle arbitrary BPG files.

  • Only basic BPG files are supported: no alpha, no animations, only one specific colourspace, etc.
  • Most things are just hard coded - only picture width and height are handled carefully. BPG files that were encoded differently (e.g. non-default -m or -b) may fail to be converted.

Installation

Download a pre-built executable from Github releases or install from source code with cargo install --path . or cargo install bpg2hevc.

CLI options

bpg2hevc --help output
ARGS:
    <path>
      BPG file to read and convert to HEVC raw stream to stdout.
      `MP4Box -add-image w.hvc:primary -new w.heic` would help to pack it as a HEIF image.

OPTIONS:
    -h, --help
      Prints help information.

Dependencies

~2.5MB
~50K SLoC