Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/talklittle/ffmpex
Elixir wrapper for FFmpeg command line interface
https://github.com/talklittle/ffmpex
Last synced: 2 months ago
JSON representation
Elixir wrapper for FFmpeg command line interface
- Host: GitHub
- URL: https://github.com/talklittle/ffmpex
- Owner: talklittle
- License: mit
- Created: 2016-07-27T23:14:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-30T22:15:29.000Z (6 months ago)
- Last Synced: 2024-10-05T07:13:56.601Z (3 months ago)
- Language: Elixir
- Homepage: https://hexdocs.pm/ffmpex/
- Size: 1.27 MB
- Stars: 216
- Watchers: 5
- Forks: 40
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - FFmpeg command line wrapper. (Video)
- fucking-awesome-elixir - ffmpex - FFmpeg command line wrapper. (Video)
- awesome-elixir - ffmpex - FFmpeg command line wrapper. (Video)
README
# FFmpex
[![Build Status](https://github.com/talklittle/ffmpex/actions/workflows/ci.yml/badge.svg)](https://github.com/talklittle/ffmpex/actions?query=workflow%3ACI)
[![Module Version](https://img.shields.io/hexpm/v/ffmpex.svg)](https://hex.pm/packages/ffmpex)An Elixir wrapper for the FFmpeg command line interface.
Documentation: https://hexdocs.pm/ffmpex/
## Usage notes
The API is a builder, building up the list of options per-file, per-stream(-per-file), and globally.
Note that adding options is backwards from using the ffmpeg CLI; when using ffmpeg CLI, you specify the options before each file. But with FFmpex (this library), you add the file/stream first, then add the relevant options afterward.
## Examples
```elixir
import FFmpex
use FFmpex.Optionscommand =
FFmpex.new_command
|> add_global_option(option_y())
|> add_input_file("/path/to/input.avi")
|> add_output_file("/path/to/output.avi")
|> add_stream_specifier(stream_type: :video)
|> add_stream_option(option_b("64k"))
|> add_file_option(option_maxrate("128k"))
|> add_file_option(option_bufsize("64k")){:ok, output} = execute(command)
```It is possible to obtain ffmpeg's output with:
```elixir
command =
FFmpex.new_command
|> add_input_file("/path/to/input.mp4")
|> to_stdout()
|> add_file_option(option_f("avi")){:ok, output} = execute(command)
do_something(output)
```You can use the `FFprobe` module to query for file info:
```elixir
FFprobe.duration("/path/to/input.avi")
# => result in seconds, e.g., 228.456939
```See [silent_video](https://github.com/talklittle/silent_video)
and [thumbnex](https://github.com/talklittle/thumbnex)
for more usage examples.## Prerequisites
[FFmpeg](https://ffmpeg.org/) must be installed.
## Installation
Add `ffmpex` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ffmpex, "~> 0.11.0"}
]
end
```## Configuration
You can specify some options in `config.exs`:
```elixir
config :ffmpex, ffmpeg_path: "/path/to/ffmpeg"
config :ffmpex, ffprobe_path: "/path/to/ffprobe"
```## Release notes
See the [Changelog](./CHANGELOG.md) for changes between versions.
## Disclaimer
FFmpex is not affiliated with nor endorsed by the FFmpeg project.
FFmpeg is a trademark of [Fabrice Bellard](http://www.bellard.org/), originator of the FFmpeg project.
## Copyright and License
Copyright (c) 2016 Andrew Shu
FFmpex source code is licensed under the [MIT License](./LICENSE.md).