Crates.io | less-avc |
lib.rs | less-avc |
version | 0.1.5 |
source | src |
created_at | 2022-11-19 15:51:45.978861 |
updated_at | 2023-08-29 13:30:52.035384 |
description | less Advanced Video Coding (H.264) encoding |
homepage | |
repository | https://github.com/strawlab/less-avc |
max_upload_size | |
id | 718537 |
size | 77,038 |
This module contains a pure Rust implementation of an H.264 encoder optimized for lossless encoding. It is simple ("less advanced") and uses a small subset of the encoder features in the H.264 specification.
Features and characteristics:
unsafe
.openh264
and
ffmpeg to ensure encoded image is losslessly preserved.std
. In other words,
the no_std
attribute is specified. (A global allocator is required.)Desired but not implemented feature:
Worthy of consideration features:
This was inspired by Ben Mesander's World's Smallest H.264 Encoder.
Run the basic tests with:
cargo test
Full round-trip tests with ffmpeg and openh264 are in the testbench
directory
and crate. For those:
cd testbench
cargo test
These tests can export the created streams to .h264
files if the
LESSAVC_SAVE_TEST_H264
environment variable is set. (To view the location
where the .h264 files are saved, run the tests with
cargo test -- --nocapture
.) To convert these to .mp4
:
#!/bin/bash -x
set -o errexit
FILES="./*.h264"
for f in $FILES
do
echo "Processing $f file..."
ffmpeg -i $f -vcodec copy $f.mp4
# ffmpeg -i $f $f.png
done
Benchmarks are in the testbench
directory and crate:
cd testbench
cargo bench
# Or, to benckmark while compiling for the native CPU architecture, like so:
RUSTFLAGS='-C target-cpu=native' cargo bench
Copyright 2022-2023 Andrew D. Straw.
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.