avmux

Crates.ioavmux
lib.rsavmux
version0.2.1
created_at2025-06-22 10:32:30.652945+00
updated_at2025-09-19 06:10:20.773061+00
descriptionA crate to merge video and audio based on rsmpeg (dynamic link with ffmpeg lib).
homepage
repositoryhttps://github.com/kingwingfly/avmux
max_upload_size
id1721547
size42,688
王翼翔 (kingwingfly)

documentation

README

Contributors Forks Stargazers Issues MIT License


AV Merge

A crate to merge video and audio based on rsmpeg (dynamic link with ffmpeg lib)
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

This crate provides a simple way to merge video and audio files into a single output file. It uses the rsmpeg library, which is a Rust binding for FFmpeg, to handle the underlying media processing.

(back to top)

Built With

  • Rust
  • rsmpeg

(back to top)

Getting Started

Prerequisites

  • Install FFmpeg and its development libraries
  • install pkg-config

See an example GitHub workflow.

Importing the Crate

To use this crate in your Rust project, add the following to your Cargo.toml:

[dependencies]
# if you want to mux audio and video and re-encode, try version 0.2
avmux = { version = "0.2" }
# if you just want to mux audio and video without re-encode, try version 0.1
avmux = { version = "0.1" }

NOTICE: version 0.2 hard-coded nvenc hwaccel as the encoder, which is non-free in FFmpeg's LICENSE. (You cannot distribute the FFmpeg binary or library with nvenc enabled for commertial usage. If you need, feel free to fork and modify this crate.)

Features

  • ffmpeg8/ffmpeg7/ffmpeg6/link_system_ffmpeg/link_vcpkg_ffmpeg: same as it is in rsmpeg

(back to top)

Usage

use avmux::*;

let video_file = VFile::new("input_video.mp4");
let audio_file = AFile::new("https://music.com/input_audio.mp3");
let output_file = VFile::new("output1.mp4");
(video_file, audio_file).mux(output_file, CodecConfig::default()).unwrap();

let file1 = AFile::new("testa.mp3");
let file2 = VFile::new("testv.mp4");
let output = VFile::new("output2.mp4");
(file1, file2)
    .mux(
        output,
        CodecConfig::builder()
            .vconf(VConf::builder().format(VFormat::H264).build())
            .aconf(AConf::builder().format(AFormat::AAC).build())
            .build(),
    )
    .unwrap();

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Feature

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Louis - 836250617@qq.com

Project Link: https://github.com/kingwingfly/avmux

(back to top)

Acknowledgments

(back to top)

Commit count: 15

cargo fmt