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.
$ bpgenc sample.png -o sample.bpg
$ bpg2hevc sample.bpg > sample.hvc
$ MP4Box -add-image sample.hvc:primary -new sample.heic
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
or not x265 encoder) may fail to be converted.
Download a pre-built executable from Github releases or install from source code with cargo install --path .
or cargo install bpg2hevc
.
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.