Skip to content
This repository has been archived by the owner on Nov 21, 2021. It is now read-only.

Kotlin DSL to create FFmpeg commands

Notifications You must be signed in to change notification settings

moises-ai/ffmpeg-dsl-android

 
 

Repository files navigation

FFmpeg DSL Android

Pure Kotlin DSL library to build FFmpeg CLI commands in a more descriptive and comprehensive way

Latest Version


Summary

Getting Start

Steps explain how the add the FFmpeg DSL library to your Android project.

Take this post as a reference to the following steps.

1 - Create the github.properties file on your root project directory

// github.properties

gpr.usr=00000 // Your Github User ID
gpr.key=xxxx // Your Github Personal Access Token with the permission to read packages
  • Alternative: Set some environment variables with the credentials, something like GPR_USER and GPR_API_KEY.

*see the github.properties.example file

*how to get the Github User Id

2 - Add the repository to the bundle.gradle file

At the top of your bundle.gradle file, add the code to read the github.properties content

def githubProperties = new Properties()

try {
    githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
} catch(FileNotFoundException e) {
    // ignore
}

def user = githubProperties.getProperty('gpr.usr', System.getenv("GPR_USER"))
def key = githubProperties.getProperty('gpr.key', System.getenv("GPR_API_KEY"))

At the allprojects block, add a custom Maven repository

allprojects {
    repositories {
        ...
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/moises-ai/ffmpeg-dsl-android")
            credentials {
                username = user
                password = key
            }
        }
    }
}

3 - Add the library dependency to your app/bundle.gradle

implementation 'ai.moises:ffmpeg-dsl:[LATEST_VERSION]'

Publishing a new version

Steps explain how to manually publish a new version of the FFmpeg DSL library to the Github Package Registry.

Take this post as a reference to the following steps.

1 - Create the github.properties file on your root project directory

// github.properties

gpr.usr=00000 // Your Github User ID
gpr.key=xxxx // Your Github Personal Access Token with the permission to read packages
  • Alternative: Set some environment variables with the credentials, something like GPR_USER and GPR_API_KEY.

*see the github.properties.example file

*how to get the Github User Id

2 - Update the version name

On the build.gradle file, update the versionName variable with the new version.

3 - Publishing

For Windows and Linux, run the flowing scripts under the root directory of the project.

$ gradle clean
$ gradle assemble
$ gradle publish

For MacOS, run the flowing scripts under the root directory of the project.

$ ./gradlew clean
$ ./gradlew assemble
$ ./gradlew publish

Basic Usage

    ffmpegCommand {
        isOverrideAllowed = true

        input {
            seekStart = minutes(2)
            inputTimeOffset = seconds(0.3102834467120186)
            path = "test.mp3"
        }

        outputPath = "out.mp3"
    }

    // result: -y -ss "02:00" -itoffset "0.3102834467120186" -i "test.mp3" "out.mp3"

See the Example app for more usage examples.

👀 Check the Wiki for available commands and DSL syntax

About

Kotlin DSL to create FFmpeg commands

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%