0.1.35 • Published 2 years ago

@jakope/ffmpeg-fo v0.1.35

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ffmpeg-fo

Your the Captian on the ride to transform some videos. But you are not alone, FFMPEG-FO is you First Officier. Your "Chief Mate" will help you to reach your destination.

ChiefMate

ffmpeg-fo is a command builder tool for ffmpeg written in JavaScript as a class. It is designed to solve all common problems with hardware acceleration and typical export standards. You can use it to generate ffmpeg commands including progress events.

Installation

You can install ffmpeg-fo using npm:

npm install ffmpeg-fo

Usage

To use ffmpeg-fo, simply import the CommandBuilder class and create a new instance:

import CommandBuilder from 'ffmpeg-fo';

const builder = new CommandBuilder('profileName', { videocodex: 'h264' });

You can then use the builder instance to set input and output paths, add filters, and generate the ffmpeg command:

builder.setInputPath('/path/to/input/file.mp4');
builder.setOutputPath('/path/to/output/file.mp4');
builder.addVideoFilter('scale=1920:1080');
builder.addAudioFilter('volume=2.0');
const command = builder.buildCommand();

You can also listen for progress events by passing a function to the onProgress method:

builder.onProgress((progress) => {
  console.log(`Progress: ${progress}%`);
});

API

CommandBuilder(profileName, options)

Creates a new instance of the CommandBuilder class.

  • profileName (string): The name of the profile to use.
  • options (object): Optional configuration options.
    • videocodex (string): The video codec to use. Defaults to 'h264'.
    • progressEventName (string): The name of the progress event to listen for. Defaults to 'progress'.

setInputPath(path)

Sets the input path for the ffmpeg command.

  • path (string): The path to the input file.

setOutputPath(path)

Sets the output path for the ffmpeg command.

  • path (string): The path to the output file.

addVideoFilter(filter)

Adds a video filter to the ffmpeg command.

  • filter (string): The filter to add.

addAudioFilter(filter)

Adds an audio filter to the ffmpeg command.

  • filter (string): The filter to add.

onProgress(callback)

Listens for progress events and calls the specified callback function.

  • callback (function): The function to call when a progress event is received.

buildCommand()

Generates the ffmpeg command based on the current configuration.

Returns a string containing the ffmpeg command.

License

ffmpeg-fo is licensed under the MIT License. See the LICENSE file for more information.

0.1.34

2 years ago

0.1.35

2 years ago

0.1.33

2 years ago

0.1.32

2 years ago

0.1.29

2 years ago

0.1.26

2 years ago

0.1.25

2 years ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago