0.1.35 • Published 5 months ago

@jakope/ffmpeg-fo v0.1.35

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months 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

5 months ago

0.1.35

5 months ago

0.1.33

5 months ago

0.1.32

6 months ago

0.1.29

6 months ago

0.1.26

7 months ago

0.1.25

7 months ago

0.1.24

7 months ago

0.1.23

7 months ago

0.1.22

7 months ago

0.1.21

7 months ago

0.1.20

8 months ago

0.1.19

8 months ago

0.1.18

8 months ago

0.1.17

8 months ago

0.1.16

8 months ago

0.1.15

8 months ago

0.1.14

8 months ago

0.1.13

8 months ago

0.1.12

8 months ago

0.1.11

8 months ago

0.1.10

8 months ago

0.1.9

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago