{"id":13567391,"url":"https://github.com/nathanbabcock/ffmpeg-sidecar","last_synced_at":"2025-05-14T17:08:26.918Z","repository":{"id":65896054,"uuid":"599652399","full_name":"nathanbabcock/ffmpeg-sidecar","owner":"nathanbabcock","description":"Wrap a standalone FFmpeg binary in an intuitive Iterator interface. 🏍","archived":false,"fork":false,"pushed_at":"2025-03-23T22:27:21.000Z","size":290,"stargazers_count":388,"open_issues_count":5,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-09T22:36:12.295Z","etag":null,"topics":["ffmpeg","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nathanbabcock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-09T15:42:36.000Z","updated_at":"2025-05-07T12:51:15.000Z","dependencies_parsed_at":"2023-10-14T22:52:17.117Z","dependency_job_id":"6028c170-4ce1-49b8-b869-1af5d46f4a9b","html_url":"https://github.com/nathanbabcock/ffmpeg-sidecar","commit_stats":{"total_commits":187,"total_committers":12,"mean_commits":"15.583333333333334","dds":"0.10160427807486627","last_synced_commit":"bbf37b9321e084f209a58e63b4599d026c838b51"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanbabcock%2Fffmpeg-sidecar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanbabcock%2Fffmpeg-sidecar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanbabcock%2Fffmpeg-sidecar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanbabcock%2Fffmpeg-sidecar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanbabcock","download_url":"https://codeload.github.com/nathanbabcock/ffmpeg-sidecar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190396,"owners_count":22029632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg","rust"],"created_at":"2024-08-01T13:02:30.373Z","updated_at":"2025-05-14T17:08:26.892Z","avatar_url":"https://github.com/nathanbabcock.png","language":"Rust","funding_links":[],"categories":["Rust","Libraries"],"sub_categories":["Video"],"readme":"# FFmpeg Sidecar 🏍\n\n[Github](https://github.com/nathanbabcock/ffmpeg-sidecar)  •\n[Crates.io](https://crates.io/crates/ffmpeg-sidecar) •\n[Docs.rs](https://docs.rs/ffmpeg-sidecar) •\n[\u003cimg src=\"https://github.com/nathanbabcock/ffmpeg-sidecar/actions/workflows/ci.yml/badge.svg\" align=\"center\" alt=\"Github Actions\"\u003e](https://github.com/nathanbabcock/ffmpeg-sidecar/actions/workflows/ci.yml)\n\n\u003e Wrap a standalone FFmpeg binary in an intuitive Iterator interface.\n\n## Features\n\n- ✨ Minimal dependencies\n- ⚡ Automatic FFmpeg CLI download (if needed)\n- 🤗 Support for Windows, MacOS, and Linux\n- 🧪 Thoroughly unit tested\n\n\u003e 👉 Jump to [Getting Started](#getting-started) 👈\n\n## Motivation\n\nThe core goal of this project is to provide a method of interacting with any video **as if it were an\narray of raw RGB frames**.\n\nOf course, that's what video _is_, fundamentally, but there is a whole pandora's\nbox of complexity in terms of receiving and decoding video before you get there.\n\nUsing FFmpeg as the core engine provides interoperability between a massive\nrange of formats, containers, extensions, protocols, encoders, decoders, hardware accelerations, and\nmore.\n\n## Why CLI?\n\nOne method of using FFmpeg is low-level bindings to the code used inside the CLI\nitself -- there are [good crates](https://crates.io/crates/ffmpeg-sys-next) in\nthe Rust ecosystem that do this.\n\nLow level bindings have drawbacks, though:\n\n- Difficult, time-consuming build, toolchain, and dependencies, especially on Windows\n- Complexity, especially for beginners\n- You end up manually re-implementing a lot of the standard conversions you need\n  from scratch\n\nBy wrapping the CLI, this crate avoids those downsides, and also solves some of\nthe pain points that you would encounter if you were to use the CLI directly on\nits own:\n\n- Raw data can easily move in and out of FFmpeg instances, or pipe between them. Under the hood they\n  are moving across stdin and stdout.\n- Rich semantic information is recovered from the FFmpeg stderr logs, including:\n  - Progress updates (frame #, timestamp, speed, bitrate, ...)\n  - Input/output metadata and stream mappings\n  - Warnings \u0026 errors\n- Argument presets and aliases with discoverable names through Intellisense/autocomplete\n\nThe only remaining downside is the size of the FFmpeg binary itself, but it's\nless than 100MB when zipped. It can be automatically downloaded by the crate, so\nyou may choose to not even ship it with your own application and instead\ndownload it at runtime.\n\n## Getting Started\n\n\u003e [!TIP]\n\u003e Integrating with async Rust or `tokio`? Check out [`async-ffmpeg-sidecar`](https://github.com/dvtkrlbs/async-ffmpeg-sidecar).\n\n### 1. Cargo Install\n\n```console\ncargo add ffmpeg-sidecar\n```\n\n### 2. Download FFmpeg\n\nTo automatically download \u0026 install a FFmpeg binary for your platform\n(Windows, MacOS, and Linux), call this function anywhere in your program:\n\n```rust\nffmpeg_sidecar::download::auto_download().unwrap();\n```\n\nYou can do this once to set up your dev environment, or include it as a feature\nof your client application.\n\n\u003e To customize or extend the download, see [`/examples/download_ffmpeg.rs`](/examples/download_ffmpeg.rs).\n\n## Examples\n\n### Hello world 👋\n\nRead raw video frames.\n\n```rust\nuse ffmpeg_sidecar::command::FfmpegCommand;\n\nfn main() -\u003e anyhow::Result\u003c()\u003e {\n  // Run an FFmpeg command that generates a test video\n  let iter = FfmpegCommand::new() // \u003c- Builder API like `std::process::Command`\n    .testsrc()  // \u003c- Discoverable aliases for FFmpeg args\n    .rawvideo() // \u003c- Convenient argument presets\n    .spawn()?   // \u003c- Ordinary `std::process::Child`\n    .iter()?;   // \u003c- Blocking iterator over logs and output\n\n  // Use a regular \"for\" loop to read decoded video data\n  for frame in iter.filter_frames() {\n    println!(\"frame: {}x{}\", frame.width, frame.height);\n    let _pixels: Vec\u003cu8\u003e = frame.data; // \u003c- raw RGB pixels! 🎨\n  }\n\n  Ok(())\n}\n```\n\nSource: [`/examples/hello_world.rs`](/examples/hello_world.rs)\n\n```console\ncargo run --example hello_world\n```\n\n### H265 Transcoding\n\nDecode H265, modify the decoded frames, and then write back to H265.\n\nSource: [`/examples/h265_transcode.rs`](/examples/h265_transcode.rs)\n\n```console\ncargo run --example h265_transcode\n```\n\n### FFplay\n\nPipe an FFmpeg instance to FFplay for debugging purposes.\n\nSource: [`/examples/ffplay_preview.rs`](/examples/ffplay_preview.rs)\n\n```console\ncargo run --example ffplay_preview\n```\n\n### Named pipes\n\nPipe multiple outputs from FFmpeg into a Rust program.\n\nSource: [`/examples/named_pipes.rs`](/examples/named_pipes.rs)\n\n```console\ncargo run --example named_pipes --features named_pipes\n```\n\n### Others\n\nFor a myriad of other use cases, check any of the [examples](/examples/), as\nwell as the unit tests in [/src/test.rs](/src/test.rs).\n\n## See also\n\nInspired loosely by Node.js\n[`fluent-ffmpeg`](https://www.npmjs.com/package/fluent-ffmpeg), which does\nsomething similar in Javascript.\n\nUses [`setup-ffmpeg`](https://github.com/FedericoCarboni/setup-ffmpeg) for\nGithub Actions and as a reference for the auto-download behavior.\n\n## 📣 Pull Requests Welcome 📣\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanbabcock%2Fffmpeg-sidecar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanbabcock%2Fffmpeg-sidecar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanbabcock%2Fffmpeg-sidecar/lists"}