ffmpex v0.1.1 FFmpex

Create and execute ffmpeg CLI commands.

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.

Example usage:

alias FFmpex.StreamSpecifier

import FFmpex
import FFmpex.Options.Main
import FFmpex.Options.Video.Libx264

command =
  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(%StreamSpecifier{stream_type: :video})
      |> add_stream_option(option_b("64k"))
    |> add_file_option(option_maxrate("128k"))
    |> add_file_option(option_bufsize("64k"))

system_cmd_result = execute(command)
{_, 0} = system_cmd_result

Summary

Functions

Add a per-file option to the command. Applies to the most recently added file

Add a global option that applies to the entire command

Add an input file to the command

Add an output file to the command

Add a per-stream option to the command. Applies to the most recently added stream specifier, of the most recently added file

Add a stream specifier to the most recent file. The stream specifier is used as a target for per-stream options

Execute the command using ffmpeg CLI

Begin a new blank (no options) ffmpeg command

Functions

add_file_option(command, option)

Add a per-file option to the command. Applies to the most recently added file.

add_global_option(command, option)

Add a global option that applies to the entire command.

add_input_file(command, file)

Add an input file to the command.

add_output_file(command, file)

Add an output file to the command.

add_stream_option(command, option)

Add a per-stream option to the command. Applies to the most recently added stream specifier, of the most recently added file.

add_stream_specifier(command, stream_specifier)

Add a stream specifier to the most recent file. The stream specifier is used as a target for per-stream options.

execute(command)

Execute the command using ffmpeg CLI.

new_command()

Begin a new blank (no options) ffmpeg command.