diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
index 0df8b1dc..7cfaf5e8 100644
--- a/.github/CODE_OF_CONDUCT.md
+++ b/.github/CODE_OF_CONDUCT.md
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
## Enforcement
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mat.iavarone@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@deepmedia.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 89da4fab..b9763c60 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1 +1,30 @@
-Contributing guidelines are [hosted here](https://natario1.github.io/Transcoder/extra/contributing).
\ No newline at end of file
+
+Everyone is welcome to contribute with suggestions or pull requests. We are grateful to anyone who will contribute with fixes, features or feature requests.
+
+### Bug reports
+
+Please make sure to fill the bug report issue template on GitHub, if applicable.
+We highly recommend to try to reproduce the bug in the demo app, as this helps a lot in debugging
+and excludes programming errors from your side.
+
+Make sure to include:
+
+- A clear and concise description of what the bug is
+- Transcoder version, device type, Android API level
+- Exact steps to reproduce the issue
+- Description of the expected behavior
+- The original media file(s) that manifest the problem
+
+Recommended extras:
+
+- LogCat logs (use `Logger.setLogLevel(LEVEL_VERBOSE)` to print all)
+- Link to a GitHub repo where the bug is reproducible
+
+### Pull Requests
+
+Please open an issue first!
+
+Unless your PR is a simple fix (typos, documentation, bugs with obvious solution), opening an issue
+will let us discuss the problem, take design decisions and have a reference to the issue description.
+
+If you can, please write tests. We are planning to work on improving the library test coverage soon.
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
deleted file mode 100644
index 47471b0d..00000000
--- a/.github/FUNDING.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-# These are supported funding model platforms
-
-github: [natario1]
-patreon: # Replace with a single Patreon username
-open_collective: # Replace with a single Open Collective username
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-otechie: # Replace with a single Otechie username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f7f27098..e7a951e8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,5 +1,4 @@
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
-# Renaming ? Change the README badge.
name: Build
on:
push:
@@ -10,48 +9,55 @@ jobs:
ANDROID_BASE_CHECKS:
name: Base Checks
runs-on: ubuntu-latest
+ env:
+ SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
+ SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
with:
- java-version: 11
+ java-version: 17
distribution: temurin
cache: gradle
- name: Perform base checks
- run: ./gradlew demo:assembleDebug lib:publishToDirectory
+ run: ./gradlew demo:assembleDebug lib:deployLocal
ANDROID_EMULATOR_TESTS:
name: Emulator Tests
- runs-on: macos-latest
+ runs-on: ubuntu-latest
+ # Temporary workaround for deployer issue
+ env:
+ SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
+ SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
strategy:
fail-fast: false
matrix:
- EMULATOR_API: [22, 25, 28]
- include:
- - EMULATOR_API: 28
- EMULATOR_ARCH: x86_64
- - EMULATOR_API: 25
- EMULATOR_ARCH: x86
- - EMULATOR_API: 22
- EMULATOR_ARCH: x86
+ EMULATOR_API: [23, 25, 29]
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
with:
- java-version: 11
+ java-version: 17
distribution: temurin
cache: gradle
+
+ - name: Enable KVM group perms
+ run: |
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
+ sudo udevadm control --reload-rules
+ sudo udevadm trigger --name-match=kvm
+
- name: Execute emulator tests
timeout-minutes: 30
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.EMULATOR_API }}
- arch: ${{ matrix.EMULATOR_ARCH }}
- disable-animations: true
- profile: Nexus 5X
+ arch: x86_64
+ profile: Nexus 6
emulator-options: -no-snapshot -no-window -no-boot-anim -camera-back none -camera-front none -gpu swiftshader_indirect
script: ./.github/workflows/emulator_script.sh
+
- name: Upload emulator tests artifact
- uses: actions/upload-artifact@v1
+ uses: actions/upload-artifact@v4
with:
name: emulator_tests_${{ matrix.EMULATOR_API }}
- path: ./lib/build/outputs/code_coverage/debugAndroidTest/connected
\ No newline at end of file
+ path: ./lib/build/reports/androidTests/connected/debug/
\ No newline at end of file
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 523e092f..e7fcc894 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -5,19 +5,23 @@ on:
types: [published]
jobs:
MAVEN_UPLOAD:
- name: Maven Upload
+ name: Maven Central Upload
runs-on: ubuntu-latest
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ GHUB_USER: ${{ secrets.GHUB_USER }}
+ GHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GHUB_PERSONAL_ACCESS_TOKEN }}
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
with:
- java-version: 11
+ java-version: 17
distribution: temurin
cache: gradle
- - name: Perform maven upload
- run: ./gradlew publishToSonatype
+ - name: Publish to Maven Central
+ run: ./gradlew deployNexus
+ - name: Publish to GitHub Packages
+ run: ./gradlew deployGithub
diff --git a/.github/workflows/emulator_script.sh b/.github/workflows/emulator_script.sh
index 921467b1..af4ea4bb 100755
--- a/.github/workflows/emulator_script.sh
+++ b/.github/workflows/emulator_script.sh
@@ -5,4 +5,4 @@ ADB_TAGS="$ADB_TAGS VideoDecoderOutput:I VideoFrameDropper:I"
ADB_TAGS="$ADB_TAGS AudioEngine:I"
adb logcat -c
adb logcat $ADB_TAGS *:E -v color &
-./gradlew lib:connectedCheck
\ No newline at end of file
+./gradlew lib:connectedCheck --stacktrace
\ No newline at end of file
diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index db169d11..370794bf 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -14,12 +14,14 @@ jobs:
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ GHUB_USER: ${{ secrets.GHUB_USER }}
+ GHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GHUB_PERSONAL_ACCESS_TOKEN }}
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
with:
- java-version: 11
+ java-version: 17
distribution: temurin
cache: gradle
- - name: Publish sonatype snapshot
- run: ./gradlew publishToSonatypeSnapshot
\ No newline at end of file
+ - name: Publish nexus snapshot
+ run: ./gradlew deployNexusSnapshot
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 79859d12..d680f1ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
.gradle
/local.properties
-/.idea
.DS_Store
/build
*.iml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..26d33521
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..b589d56e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 00000000..81d2a465
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 00000000..96913344
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 00000000..6d0ee1c2
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..53b7407a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/deployLocal.xml b/.idea/runConfigurations/deployLocal.xml
new file mode 100644
index 00000000..f7ebf23b
--- /dev/null
+++ b/.idea/runConfigurations/deployLocal.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+ false
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..35eb1ddf
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 8dada3ed..119434ee 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright {yyyy} {name of copyright owner}
+ Copyright 2024 DeepMedia Srl
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index a0351f3e..a44321ad 100644
--- a/README.md
+++ b/README.md
@@ -1,93 +1,60 @@
-[](https://github.com/natario1/Transcoder/actions)
-[](https://github.com/natario1/Transcoder/releases)
-[](https://github.com/natario1/Transcoder/issues)
+[](https://github.com/deepmedia/Transcoder/actions)
+[](https://github.com/deepmedia/Transcoder/releases)
+[](https://github.com/deepmedia/Transcoder/issues)
-⠀
-
-
-
-
-
-*Looking for a powerful camera library to take videos? Take a look at our [CameraView](https://github.com/natario1/CameraView).*
-
-*Need support, consulting, or have any other business-related question? Feel free to get in touch.*
-
-*Like the project, make profit from it, or simply want to thank back? Please consider [sponsoring me](https://github.com/sponsors/natario1)!*
+
# Transcoder
Transcodes and compresses video files into the MP4 format, with audio support, using hardware-accelerated
-Android codecs available on the device. Works on API 18+.
-
-```groovy
-implementation 'com.otaliastudios:transcoder:0.10.5'
-```
+Android codecs available on the device. Works on API 21+.
- Fast transcoding to AAC/AVC
- Hardware accelerated
- Convenient, fluent API
- Thumbnails support
-- Concatenate multiple video and audio tracks [[docs]](https://natario1.github.io/Transcoder/docs/concatenation)
-- Clip or trim video segments [[docs]](https://natario1.github.io/Transcoder/docs/clipping)
-- Choose output size, with automatic cropping [[docs]](https://natario1.github.io/Transcoder/docs/track-strategies#video-size)
-- Choose output rotation [[docs]](https://natario1.github.io/Transcoder/docs/advanced-options#video-rotation)
-- Choose output speed [[docs]](https://natario1.github.io/Transcoder/docs/advanced-options#video-speed)
-- Choose output frame rate [[docs]](https://natario1.github.io/Transcoder/docs/track-strategies#other-options)
-- Choose output audio channels [[docs]](https://natario1.github.io/Transcoder/docs/track-strategies#audio-strategies)
-- Choose output audio sample rate [[docs]](https://natario1.github.io/Transcoder/docs/track-strategies#audio-strategies)
-- Override frames timestamp, e.g. to slow down the middle part of the video [[docs]](https://natario1.github.io/Transcoder/docs/advanced-options#time-interpolation)
-- Error handling [[docs]](https://natario1.github.io/Transcoder/docs/events)
-- Configurable validators to e.g. avoid transcoding if the source is already compressed enough [[docs]](https://natario1.github.io/Transcoder/docs/validators)
-- Configurable video and audio strategies [[docs]](https://natario1.github.io/Transcoder/docs/track-strategies)
-
-⠀
-
-
-
-
-
-⠀
+- Concatenate multiple video and audio tracks [[docs]](https://opensource.deepmedia.io/transcoder/concatenation)
+- Clip or trim video segments [[docs]](https://opensource.deepmedia.io/transcoder/clipping)
+- Choose output size, with automatic cropping [[docs]](https://opensource.deepmedia.io/transcoder/track-strategies#video-size)
+- Choose output rotation [[docs]](https://opensource.deepmedia.io/transcoder/advanced-options#video-rotation)
+- Choose output speed [[docs]](https://opensource.deepmedia.io/transcoder/advanced-options#video-speed)
+- Choose output frame rate [[docs]](https://opensource.deepmedia.io/transcoder/track-strategies#other-options)
+- Choose output audio channels [[docs]](https://opensource.deepmedia.io/transcoder/track-strategies#audio-strategies)
+- Choose output audio sample rate [[docs]](https://opensource.deepmedia.io/transcoder/track-strategies#audio-strategies)
+- Override frames timestamp, e.g. to slow down the middle part of the video [[docs]](https://opensource.deepmedia.io/transcoder/advanced-options#time-interpolation)
+- Error handling [[docs]](https://opensource.deepmedia.io/transcoder/events)
+- Configurable validators to e.g. avoid transcoding if the source is already compressed enough [[docs]](https://opensource.deepmedia.io/transcoder/validators)
+- Configurable video and audio strategies [[docs]](https://opensource.deepmedia.io/transcoder/track-strategies)
+
+```kotlin
+// build.gradle.kts
+dependencies {
+ implementation("com.otaliastudios:transcoder:0.10.5")
+}
+```
*This project started as a fork of [ypresto/android-transcoder](https://github.com/ypresto/android-transcoder).
-With respect to the source project, which misses most of the functionality listed above,
-we have also fixed a huge number of bugs and are much less conservative when choosing options
+With respect to the source project, which misses most of the functionality listed above,
+we have also fixed a huge number of bugs and are much less conservative when choosing options
that might not be supported. The source project will always throw - for example, accepting only 16:9,
AVC Baseline Profile videos - we prefer to try and let the codec fail if it wants to*.
-## Support
-
-If you like the project, make profit from it, or simply want to thank back, please consider
-[sponsoring me](https://github.com/sponsors/natario1) through the GitHub Sponsors program!
-You can have your company logo here, get private support hours or simply help me push this forward.
-
-Transcoder is trusted and supported by [ShareChat](https://sharechat.com/), a social media app with
-over 100 million downloads.
+*Transcoder is trusted and supported by [ShareChat](https://sharechat.com/), a social media app with
+over 100 million downloads.*
-
-
-
+Please check out [the official website](https://opensource.deepmedia.io/transcoder) for setup instructions and documentation.
+You may also check the demo app (under `/demo`) for a complete example.
-Feel free to contact me for support, consulting or any
-other business-related question.
-
-## Setup
-
-Please read the [official website](https://natario1.github.io/Transcoder) for setup instructions and documentation.
-You might also be interested in our [changelog](https://natario1.github.io/Transcoder/about/changelog).
-Using Transcoder is extremely simple:
-
-```java
+```kotlin
Transcoder.into(filePath)
- .addDataSource(context, uri) // or...
- .addDataSource(filePath) // or...
- .addDataSource(fileDescriptor) // or...
- .addDataSource(dataSource)
- .setListener(new TranscoderListener() {
- public void onTranscodeProgress(double progress) {}
- public void onTranscodeCompleted(int successCode) {}
- public void onTranscodeCanceled() {}
- public void onTranscodeFailed(@NonNull Throwable exception) {}
- }).transcode()
+ .addDataSource(context, uri) // or...
+ .addDataSource(filePath) // or...
+ .addDataSource(fileDescriptor) // or...
+ .addDataSource(dataSource)
+ .setListener(object : TranscoderListener {
+ override fun onTranscodeProgress(progress: Double) = Unit
+ override fun onTranscodeCompleted(successCode: Int) = Unit
+ override fun onTranscodeCanceled() = Unit
+ override fun onTranscodeFailed(exception: Throwable) = Unit
+ }).transcode()
```
-
-Take a look at the demo app for a complete example.
\ No newline at end of file
diff --git a/assets/logo-256.png b/assets/logo-256.png
new file mode 100644
index 00000000..932c421a
Binary files /dev/null and b/assets/logo-256.png differ
diff --git a/build.gradle.kts b/build.gradle.kts
index a697c900..1e81addf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,30 +1,5 @@
-buildscript {
-
- extra["minSdkVersion"] = 18
- extra["compileSdkVersion"] = 31
- extra["targetSdkVersion"] = 31
-
- repositories {
- google()
- mavenCentral()
- jcenter()
- }
-
- dependencies {
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30")
- classpath("com.android.tools.build:gradle:7.0.2")
- classpath("io.deepmedia.tools:publisher:0.6.0")
- }
-}
-
-allprojects {
- repositories {
- google()
- mavenCentral()
- jcenter()
- }
-}
-
-tasks.register("clean", Delete::class) {
- delete(buildDir)
+plugins {
+ kotlin("android") version "2.0.0" apply false
+ id("com.android.library") version "8.2.2" apply false
+ id("com.android.application") version "8.2.2" apply false
}
\ No newline at end of file
diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts
index be206540..93fcf8ac 100644
--- a/demo/build.gradle.kts
+++ b/demo/build.gradle.kts
@@ -1,27 +1,21 @@
plugins {
id("com.android.application")
- id("kotlin-android")
+ kotlin("android")
}
android {
- setCompileSdkVersion(property("compileSdkVersion") as Int)
-
+ namespace = "com.otaliastudios.transcoder.demo"
+ compileSdk = 34
defaultConfig {
- applicationId = "com.otaliastudios.transcoder.demo"
- minSdk = property("minSdkVersion") as Int
- targetSdk = property("targetSdkVersion") as Int
+ minSdk = 21
+ targetSdk = 34
versionCode = 1
versionName = "1.0"
}
-
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
- }
}
dependencies {
implementation(project(":lib"))
- implementation("com.google.android.material:material:1.4.0")
- implementation("androidx.appcompat:appcompat:1.3.1")
+ implementation("com.google.android.material:material:1.12.0")
+ implementation("androidx.appcompat:appcompat:1.7.0")
}
diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml
index 7390e0d5..5da9cd95 100644
--- a/demo/src/main/AndroidManifest.xml
+++ b/demo/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
+ xmlns:tools="http://schemas.android.com/tools">
0) {
builder.addResizer(new AspectRatioResizer(aspectRatio));
}
- float fraction;
- switch (mVideoResolutionGroup.getCheckedRadioButtonId()) {
- case R.id.resolution_half: fraction = 0.5F; break;
- case R.id.resolution_third: fraction = 1F / 3F; break;
- default: fraction = 1F;
- }
+
+ float fraction = 1F;
+ int fractionId = mVideoResolutionGroup.getCheckedRadioButtonId();
+ if (fractionId == R.id.resolution_half) fraction = 0.5F;
+ else if (fractionId == R.id.resolution_third) fraction = 1F / 3F;
builder.addResizer(new FractionResizer(fraction));
- int rotation;
- switch (mVideoRotationGroup.getCheckedRadioButtonId()) {
- case R.id.rotation_90: rotation = 90; break;
- case R.id.rotation_180: rotation = 180; break;
- case R.id.rotation_270: rotation = 270; break;
- default: rotation = 0;
- }
+
+
+ int rotation = 0;
+ int rotationId = mVideoRotationGroup.getCheckedRadioButtonId();
+ if (rotationId == R.id.rotation_90) rotation = 90;
+ else if (rotationId == R.id.rotation_180) rotation = 180;
+ else if (rotationId == R.id.rotation_270) rotation = 270;
builder.setRotation(rotation);
// Launch the transcoding operation.
diff --git a/demo/src/main/java/com/otaliastudios/transcoder/demo/TranscoderActivity.java b/demo/src/main/java/com/otaliastudios/transcoder/demo/TranscoderActivity.java
index ea904de9..c07ef4bb 100644
--- a/demo/src/main/java/com/otaliastudios/transcoder/demo/TranscoderActivity.java
+++ b/demo/src/main/java/com/otaliastudios/transcoder/demo/TranscoderActivity.java
@@ -159,24 +159,21 @@ protected void onCreate(Bundle savedInstanceState) {
}
private void syncParameters() {
- int channels;
- switch (mAudioChannelsGroup.getCheckedRadioButtonId()) {
- case R.id.channels_mono: channels = 1; break;
- case R.id.channels_stereo: channels = 2; break;
- default: channels = DefaultAudioStrategy.CHANNELS_AS_INPUT;
- }
- int sampleRate;
- switch (mAudioSampleRateGroup.getCheckedRadioButtonId()) {
- case R.id.sampleRate_32: sampleRate = 32000; break;
- case R.id.sampleRate_48: sampleRate = 48000; break;
- default: sampleRate = DefaultAudioStrategy.SAMPLE_RATE_AS_INPUT;
- }
- boolean removeAudio;
- switch (mAudioReplaceGroup.getCheckedRadioButtonId()) {
- case R.id.replace_remove: removeAudio = true; break;
- case R.id.replace_yes: removeAudio = false; break;
- default: removeAudio = false;
- }
+ int channels = DefaultAudioStrategy.CHANNELS_AS_INPUT;
+ int channelsId = mAudioChannelsGroup.getCheckedRadioButtonId();
+ if (channelsId == R.id.channels_mono) channels = 1;
+ else if (channelsId == R.id.channels_stereo) channels = 2;
+
+ int sampleRate = DefaultAudioStrategy.SAMPLE_RATE_AS_INPUT;
+ int sampleRateId = mAudioSampleRateGroup.getCheckedRadioButtonId();
+ if (sampleRateId == R.id.sampleRate_32) sampleRate = 32000;
+ else if (sampleRateId == R.id.sampleRate_48) sampleRate = 48000;
+
+ boolean removeAudio = false;
+ int removeAudioId = mAudioReplaceGroup.getCheckedRadioButtonId();
+ if (removeAudioId == R.id.replace_remove) removeAudio = true;
+ else if (removeAudioId == R.id.replace_yes) removeAudio = false;
+
if (removeAudio) {
mTranscodeAudioStrategy = new RemoveTrackStrategy();
} else {
@@ -186,26 +183,23 @@ private void syncParameters() {
.build();
}
- int frames;
- switch (mVideoFramesGroup.getCheckedRadioButtonId()) {
- case R.id.frames_24: frames = 24; break;
- case R.id.frames_30: frames = 30; break;
- case R.id.frames_60: frames = 60; break;
- default: frames = DefaultVideoStrategy.DEFAULT_FRAME_RATE;
- }
- float fraction;
- switch (mVideoResolutionGroup.getCheckedRadioButtonId()) {
- case R.id.resolution_half: fraction = 0.5F; break;
- case R.id.resolution_third: fraction = 1F / 3F; break;
- default: fraction = 1F;
- }
- float aspectRatio;
- switch (mVideoAspectGroup.getCheckedRadioButtonId()) {
- case R.id.aspect_169: aspectRatio = 16F / 9F; break;
- case R.id.aspect_43: aspectRatio = 4F / 3F; break;
- case R.id.aspect_square: aspectRatio = 1F; break;
- default: aspectRatio = 0F;
- }
+ int frames = DefaultVideoStrategy.DEFAULT_FRAME_RATE;
+ int framesId = mVideoFramesGroup.getCheckedRadioButtonId();
+ if (framesId == R.id.frames_24) frames = 24;
+ else if (framesId == R.id.frames_30) frames = 30;
+ else if (framesId == R.id.frames_60) frames = 60;
+
+ float fraction = 1F;
+ int fractionId = mVideoResolutionGroup.getCheckedRadioButtonId();
+ if (fractionId == R.id.resolution_half) fraction = 0.5F;
+ else if (fractionId == R.id.resolution_third) fraction = 1F / 3F;
+
+ float aspectRatio = 0F;
+ int aspectRatioId = mVideoAspectGroup.getCheckedRadioButtonId();
+ if (aspectRatioId == R.id.aspect_169) aspectRatio = 16F / 9F;
+ else if (aspectRatioId == R.id.aspect_43) aspectRatio = 4F / 3F;
+ else if (aspectRatioId == R.id.aspect_square) aspectRatio = 1F;
+
mTranscodeVideoStrategy = new DefaultVideoStrategy.Builder()
.addResizer(aspectRatio > 0 ? new AspectRatioResizer(aspectRatio) : new PassThroughResizer())
.addResizer(new FractionResizer(fraction))
@@ -275,20 +269,16 @@ private void transcode(@NonNull Uri... uris) {
return;
}
- int rotation;
- switch (mVideoRotationGroup.getCheckedRadioButtonId()) {
- case R.id.rotation_90: rotation = 90; break;
- case R.id.rotation_180: rotation = 180; break;
- case R.id.rotation_270: rotation = 270; break;
- default: rotation = 0;
- }
+ int rotation = 0;
+ int rotationId = mVideoRotationGroup.getCheckedRadioButtonId();
+ if (rotationId == R.id.rotation_90) rotation = 90;
+ else if (rotationId == R.id.rotation_180) rotation = 180;
+ else if (rotationId == R.id.rotation_270) rotation = 270;
- float speed;
- switch (mSpeedGroup.getCheckedRadioButtonId()) {
- case R.id.speed_05x: speed = 0.5F; break;
- case R.id.speed_2x: speed = 2F; break;
- default: speed = 1F;
- }
+ float speed = 1F;
+ int speedId = mSpeedGroup.getCheckedRadioButtonId();
+ if (speedId == R.id.speed_05x) speed = 0.5F;
+ else if (speedId == R.id.speed_2x) speed = 2F;
// Launch the transcoding operation.
mTranscodeStartTime = SystemClock.uptimeMillis();
diff --git a/docs/.gitignore b/docs-legacy/.gitignore
similarity index 100%
rename from docs/.gitignore
rename to docs-legacy/.gitignore
diff --git a/docs/Gemfile b/docs-legacy/Gemfile
similarity index 100%
rename from docs/Gemfile
rename to docs-legacy/Gemfile
diff --git a/docs-legacy/README.md b/docs-legacy/README.md
new file mode 100644
index 00000000..995fe576
--- /dev/null
+++ b/docs-legacy/README.md
@@ -0,0 +1 @@
+Read the docs at https://opensource.deepmedia.io/transcoder.
diff --git a/docs-legacy/_about/changelog.md b/docs-legacy/_about/changelog.md
new file mode 100644
index 00000000..575f5a04
--- /dev/null
+++ b/docs-legacy/_about/changelog.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/changelog
+title: "Changelog"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/changelog
\ No newline at end of file
diff --git a/docs-legacy/_about/getting-started.md b/docs-legacy/_about/getting-started.md
new file mode 100644
index 00000000..35eda638
--- /dev/null
+++ b/docs-legacy/_about/getting-started.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/install
+title: "Getting Started"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/install
diff --git a/docs-legacy/_about/install.md b/docs-legacy/_about/install.md
new file mode 100644
index 00000000..7f4cdead
--- /dev/null
+++ b/docs-legacy/_about/install.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/install
+title: "Install"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/install
diff --git a/docs/_config.yml b/docs-legacy/_config.yml
similarity index 97%
rename from docs/_config.yml
rename to docs-legacy/_config.yml
index ae6e178d..b5950cf3 100644
--- a/docs/_config.yml
+++ b/docs-legacy/_config.yml
@@ -8,7 +8,6 @@ title: Transcoder
color: '#f8f8f8'
description: A well documented Android library providing hardware-accelerated video transcoding, using MediaCodec APIs instead of native code (no FFMPEG patent issues). Supports cropping to any dimension, concatenation, clipping, audio processing, video speed and much more. # used by ourselves and by seo tag.
disqus_shortname: 'natario1-transcoder'
-google_analytics_id: 'UA-155077779-2'
google_site_verification: '4x49i17ABIrSvUl52SeL0-t0341aTnWWaC62-FYCRT4'
github: [metadata] # TODO What's this?
github_repo: Transcoder
diff --git a/docs-legacy/_docs/advanced-options.md b/docs-legacy/_docs/advanced-options.md
new file mode 100644
index 00000000..8cb956b5
--- /dev/null
+++ b/docs-legacy/_docs/advanced-options.md
@@ -0,0 +1,8 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/advanced-options
+title: "Advanced Options"
+order: 7
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/advanced-options
diff --git a/docs-legacy/_docs/clipping.md b/docs-legacy/_docs/clipping.md
new file mode 100644
index 00000000..5eb543ba
--- /dev/null
+++ b/docs-legacy/_docs/clipping.md
@@ -0,0 +1,9 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/clipping
+title: "Clipping and trimming"
+order: 2
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/clipping
+
diff --git a/docs-legacy/_docs/concatenation.md b/docs-legacy/_docs/concatenation.md
new file mode 100644
index 00000000..f09a789c
--- /dev/null
+++ b/docs-legacy/_docs/concatenation.md
@@ -0,0 +1,8 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/concatenation
+title: "Concatenation"
+order: 3
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/concatenation
diff --git a/docs-legacy/_docs/data-sources.md b/docs-legacy/_docs/data-sources.md
new file mode 100644
index 00000000..274eb541
--- /dev/null
+++ b/docs-legacy/_docs/data-sources.md
@@ -0,0 +1,9 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/data-sources
+title: "Data Sources"
+order: 1
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/data-sources
+
diff --git a/docs-legacy/_docs/events.md b/docs-legacy/_docs/events.md
new file mode 100644
index 00000000..80e0c86f
--- /dev/null
+++ b/docs-legacy/_docs/events.md
@@ -0,0 +1,9 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/events
+title: "Transcoding Events"
+order: 4
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/events
+
diff --git a/docs-legacy/_docs/track-strategies.md b/docs-legacy/_docs/track-strategies.md
new file mode 100644
index 00000000..385de184
--- /dev/null
+++ b/docs-legacy/_docs/track-strategies.md
@@ -0,0 +1,8 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/track-strategies
+title: "Track Strategies"
+order: 6
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/track-strategies
diff --git a/docs-legacy/_docs/validators.md b/docs-legacy/_docs/validators.md
new file mode 100644
index 00000000..1228ce17
--- /dev/null
+++ b/docs-legacy/_docs/validators.md
@@ -0,0 +1,9 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder/validators
+title: "Validators"
+order: 5
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder/validators
+
diff --git a/docs-legacy/_extra/contact.md b/docs-legacy/_extra/contact.md
new file mode 100644
index 00000000..683854eb
--- /dev/null
+++ b/docs-legacy/_extra/contact.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder
+title: "Contact"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder
diff --git a/docs-legacy/_extra/contributing.md b/docs-legacy/_extra/contributing.md
new file mode 100644
index 00000000..c4c64357
--- /dev/null
+++ b/docs-legacy/_extra/contributing.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder
+title: "Contributing & License"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder
diff --git a/docs-legacy/_extra/donate.md b/docs-legacy/_extra/donate.md
new file mode 100644
index 00000000..dbc95dfd
--- /dev/null
+++ b/docs-legacy/_extra/donate.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder
+title: "Donate"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder
diff --git a/docs/_includes/disqus.html b/docs-legacy/_includes/disqus.html
similarity index 100%
rename from docs/_includes/disqus.html
rename to docs-legacy/_includes/disqus.html
diff --git a/docs/_includes/footer.html b/docs-legacy/_includes/footer.html
similarity index 100%
rename from docs/_includes/footer.html
rename to docs-legacy/_includes/footer.html
diff --git a/docs/_includes/google_analytics.html b/docs-legacy/_includes/google_analytics.html
similarity index 100%
rename from docs/_includes/google_analytics.html
rename to docs-legacy/_includes/google_analytics.html
diff --git a/docs/_includes/head.html b/docs-legacy/_includes/head.html
similarity index 100%
rename from docs/_includes/head.html
rename to docs-legacy/_includes/head.html
diff --git a/docs/_includes/header.html b/docs-legacy/_includes/header.html
similarity index 100%
rename from docs/_includes/header.html
rename to docs-legacy/_includes/header.html
diff --git a/docs/_includes/navigation.html b/docs-legacy/_includes/navigation.html
similarity index 100%
rename from docs/_includes/navigation.html
rename to docs-legacy/_includes/navigation.html
diff --git a/docs/_layouts/landing.html b/docs-legacy/_layouts/landing.html
similarity index 100%
rename from docs/_layouts/landing.html
rename to docs-legacy/_layouts/landing.html
diff --git a/docs/_layouts/main.html b/docs-legacy/_layouts/main.html
similarity index 100%
rename from docs/_layouts/main.html
rename to docs-legacy/_layouts/main.html
diff --git a/docs/_layouts/page.html b/docs-legacy/_layouts/page.html
similarity index 100%
rename from docs/_layouts/page.html
rename to docs-legacy/_layouts/page.html
diff --git a/docs-legacy/_layouts/redirect.html b/docs-legacy/_layouts/redirect.html
new file mode 100644
index 00000000..f057557a
--- /dev/null
+++ b/docs-legacy/_layouts/redirect.html
@@ -0,0 +1,15 @@
+
+
+
+
+ Redirecting…
+
+
+
+
+
+
+
Redirecting…
+Click here if you are not redirected.
+
+
\ No newline at end of file
diff --git a/docs/css/colors.css b/docs-legacy/css/colors.css
similarity index 100%
rename from docs/css/colors.css
rename to docs-legacy/css/colors.css
diff --git a/docs/css/fonts.css b/docs-legacy/css/fonts.css
similarity index 100%
rename from docs/css/fonts.css
rename to docs-legacy/css/fonts.css
diff --git a/docs/css/fonts_responsive.css b/docs-legacy/css/fonts_responsive.css
similarity index 100%
rename from docs/css/fonts_responsive.css
rename to docs-legacy/css/fonts_responsive.css
diff --git a/docs/css/landing.css b/docs-legacy/css/landing.css
similarity index 100%
rename from docs/css/landing.css
rename to docs-legacy/css/landing.css
diff --git a/docs/css/main.css b/docs-legacy/css/main.css
similarity index 100%
rename from docs/css/main.css
rename to docs-legacy/css/main.css
diff --git a/docs/css/syntax.css b/docs-legacy/css/syntax.css
similarity index 100%
rename from docs/css/syntax.css
rename to docs-legacy/css/syntax.css
diff --git a/docs-legacy/home.md b/docs-legacy/home.md
new file mode 100644
index 00000000..7ddf3f2c
--- /dev/null
+++ b/docs-legacy/home.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder
+title: "Transcoder"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder
\ No newline at end of file
diff --git a/docs/icons/github.svg b/docs-legacy/icons/github.svg
similarity index 100%
rename from docs/icons/github.svg
rename to docs-legacy/icons/github.svg
diff --git a/docs/icons/menu.svg b/docs-legacy/icons/menu.svg
similarity index 100%
rename from docs/icons/menu.svg
rename to docs-legacy/icons/menu.svg
diff --git a/docs-legacy/index.md b/docs-legacy/index.md
new file mode 100644
index 00000000..ee7fbb4e
--- /dev/null
+++ b/docs-legacy/index.md
@@ -0,0 +1,7 @@
+---
+layout: redirect
+redirect_to: https://opensource.deepmedia.io/transcoder
+title: "Transcoder"
+---
+
+Migrated to https://opensource.deepmedia.io/transcoder
diff --git a/docs/script/launch b/docs-legacy/script/launch
similarity index 100%
rename from docs/script/launch
rename to docs-legacy/script/launch
diff --git a/docs/static/banner.png b/docs-legacy/static/banner.png
similarity index 100%
rename from docs/static/banner.png
rename to docs-legacy/static/banner.png
diff --git a/docs/static/icon_foreground.png b/docs-legacy/static/icon_foreground.png
similarity index 100%
rename from docs/static/icon_foreground.png
rename to docs-legacy/static/icon_foreground.png
diff --git a/docs/static/screenshot-1.png b/docs-legacy/static/screenshot-1.png
similarity index 100%
rename from docs/static/screenshot-1.png
rename to docs-legacy/static/screenshot-1.png
diff --git a/docs/static/screenshot-2.png b/docs-legacy/static/screenshot-2.png
similarity index 100%
rename from docs/static/screenshot-2.png
rename to docs-legacy/static/screenshot-2.png
diff --git a/docs/static/sharechat.png b/docs-legacy/static/sharechat.png
similarity index 100%
rename from docs/static/sharechat.png
rename to docs-legacy/static/sharechat.png
diff --git a/docs/README.md b/docs/README.md
index 9312dc35..995fe576 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1 +1 @@
-Read the docs at https://natario1.github.io/Transcoder .
+Read the docs at https://opensource.deepmedia.io/transcoder.
diff --git a/docs/_about/getting-started.md b/docs/_about/getting-started.md
deleted file mode 100644
index 826130d9..00000000
--- a/docs/_about/getting-started.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-layout: page
-title: "Getting Started"
-description: "Simple guide to transcode your first video"
-order: 2
-disqus: 1
----
-
-### Before you start
-
-If your app targets versions older than API 18, you can override the minSdkVersion by
-adding this line to your manifest file:
-
-```xml
-
-```
-
-In this case you should check at runtime that API level is at least 18, before
-calling any method here.
-
-### Transcoding your first video
-
-Transcoding happens through the `Transcoder` class by passing it an output file path,
-and one of more input data sources. It's pretty simple:
-
-```java
-Transcoder.into(filePath)
- .addDataSource(context, uri) // or...
- .addDataSource(filePath) // or...
- .addDataSource(fileDescriptor) // or...
- .addDataSource(dataSource)
- .setListener(new TranscoderListener() {
- public void onTranscodeProgress(double progress) {}
- public void onTranscodeCompleted(int successCode) {}
- public void onTranscodeCanceled() {}
- public void onTranscodeFailed(@NonNull Throwable exception) {}
- }).transcode()
-```
-
-However, we offer many APIs and additional features on top that you can read about in the
-in-depth documentation.
-
diff --git a/docs/_about/install.md b/docs/_about/install.md
deleted file mode 100644
index 177524bd..00000000
--- a/docs/_about/install.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-layout: page
-title: "Install"
-description: "Integrate in your project"
-order: 1
----
-
-Transcoder is publicly hosted on the [Maven Central](https://repo1.maven.org/maven2/com/otaliastudios/)
-repository, where you can download the AAR package. To fetch with Gradle, make sure you add the
-Maven Central repository in your root projects `build.gradle` file:
-
-```kotlin
-allprojects {
- repositories {
- mavenCentral()
- }
-}
-```
-
-Then simply download the latest version:
-
-```kotlin
-api("com.otaliastudios:transcoder:{{ site.github_version }}")
-```
-
-> The library works on API 18+, which is the only requirement and should be met by many projects nowadays.
-
-### Snapshots
-
-We deploy snapshots on each push to the main branch. If you want to use the latest, unreleased features,
-you can do so (at your own risk) by adding the snapshot repository:
-
-```kotlin
-allprojects {
- repositories {
- maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
- }
-}
-```
-
-and changing the library version from `{{ site.github_version }}` to `latest-SNAPSHOT`.
\ No newline at end of file
diff --git a/docs/_extra/contact.md b/docs/_extra/contact.md
deleted file mode 100644
index 409dfe15..00000000
--- a/docs/_extra/contact.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-layout: page
-title: "Contact"
-order: 3
----
-
-This library is maintained by [Mattia Iavarone](https://github.com/natario1) (@natario1).
-Feel free to contact me privately by sending an email,
-for support, consulting, or have any other business-related question.
-
-To report issues, please use the [project GitHub page](https://github.com/natario1/Transcoder).
-
diff --git a/docs/_extra/contributing.md b/docs/_extra/contributing.md
deleted file mode 100644
index cf62752b..00000000
--- a/docs/_extra/contributing.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-layout: page
-title: "Contributing & License"
-order: 1
----
-
-Everyone is welcome to contribute with suggestions or pull requests, as the library is under active development.
-
-We are grateful to anyone who will contribute with fixes, features or feature requests. If you don't
-want to get involved but still want to support the project, please [consider donating](donate).
-
-### Bug reports
-
-Please make sure to fill the bug report issue template on GitHub, if applicable.
-We highly recommend to try to reproduce the bug in the demo app, as this helps a lot in debugging
-and excludes programming errors from your side.
-
-Make sure to include:
-
-- A clear and concise description of what the bug is
-- Transcoder version, device type, Android API level
-- Exact steps to reproduce the issue
-- Description of the expected behavior
-- The original media file(s) that manifest the problem
-
-Recommended extras:
-
-- LogCat logs (use `Logger.setLogLevel(LEVEL_VERBOSE)` to print all)
-- Link to a GitHub repo where the bug is reproducible
-
-### Pull Requests
-
-Please open an issue first!
-
-Unless your PR is a simple fix (typos, documentation, bugs with obvious solution), opening an issue
-will let us discuss the problem, take design decisions and have a reference to the issue description.
-
-If you can, please write tests. We are planning to work on improving the library test coverage soon.
-
-### License
-
-This project is licensed under Apache 2.0. It consists of improvements over
-the [ypresto/android-transcoder](https://github.com/ypresto/android-transcoder)
-project which was licensed under Apache 2.0 as well:
-
-```
-Copyright (C) 2014-2016 Yuya Tanaka
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/docs/_extra/donate.md b/docs/_extra/donate.md
deleted file mode 100644
index 3400e886..00000000
--- a/docs/_extra/donate.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-layout: page
-title: "Donate"
-order: 2
----
-
-Transcoder is maintained and, for the most part, developed by Mattia Iavarone ([contact me!](contact)). If you like the project,
-use it with profit, or simply want to thank back, please consider
-[sponsoring me](https://github.com/sponsors/natario1) through the GitHub Sponsors program!
-
-I offer private support hours through the sponsorship program and I'm open to help your
-company with features that are not currently supported by the open source project.
-
-Thank you for any contribution!
-
-
diff --git a/docs/_docs/advanced-options.md b/docs/advanced-options.mdx
similarity index 73%
rename from docs/_docs/advanced-options.md
rename to docs/advanced-options.mdx
index 0902d23b..0da292d4 100644
--- a/docs/_docs/advanced-options.md
+++ b/docs/advanced-options.mdx
@@ -1,49 +1,46 @@
---
-layout: page
-title: "Advanced Options"
-description: "Advanced transcoding options"
-order: 7
-disqus: 1
+title: Advanced Options
---
-### Video rotation
+# Advanced Options
+
+## Video rotation
You can set the output video rotation with the `setRotation(int)` method. This will apply a clockwise
rotation to the input video frames. Accepted values are `0`, `90`, `180`, `270`:
-```java
+```kotlin
Transcoder.into(filePath)
- .setVideoRotation(rotation) // 0, 90, 180, 270
- // ...
+ .setVideoRotation(rotation) // 0, 90, 180, 270
+ // ...
```
-### Time interpolation
+## Time interpolation
We offer APIs to change the timestamp of each video and audio frame. You can pass a `TimeInterpolator`
to the transcoder builder to be able to receive the frame timestamp as input, and return a new one
as output.
-```java
+```kotlin
Transcoder.into(filePath)
- .setTimeInterpolator(timeInterpolator)
- // ...
+ .setTimeInterpolator(timeInterpolator)
+ // ...
```
As an example, this is the implementation of the default interpolator, called `DefaultTimeInterpolator`,
that will just return the input time unchanged:
-```java
-@Override
-public long interpolate(@NonNull TrackType type, long time) {
+```kotlin
+override fun interpolate(type: TrackType, time: Long): Long {
// Receive input time in microseconds and return a possibly different one.
- return time;
+ return time
}
```
It should be obvious that returning invalid times can make the process crash at any point, or at least
the transcoding operation fail.
-### Video speed
+## Video speed
We also offer a special time interpolator called `SpeedTimeInterpolator` that accepts a `float` parameter
and will modify the video speed.
@@ -52,26 +49,26 @@ and will modify the video speed.
- A speed factor < 1 will slow the video down
- A speed factor > 1 will accelerate the video
-This interpolator can be set using `setTimeInterpolator(TimeInterpolator)`, or, as a shorthand,
+This interpolator can be set using `setTimeInterpolator(TimeInterpolator)`, or, as a shorthand,
using `setSpeed(float)`:
-```java
+```kotlin
Transcoder.into(filePath)
- .setSpeed(0.5F) // 0.5x
- .setSpeed(1F) // Unchanged
- .setSpeed(2F) // Twice as fast
- // ...
+ .setSpeed(0.5F) // 0.5x
+ .setSpeed(1F) // Unchanged
+ .setSpeed(2F) // Twice as fast
+ // ...
```
-### Audio stretching
+## Audio stretching
When a time interpolator alters the frames and samples timestamps, you can either remove audio or
stretch the audio samples to the new length. This is done through the `AudioStretcher` interface:
-```java
+```kotlin
Transcoder.into(filePath)
- .setAudioStretcher(audioStretcher)
- // ...
+ .setAudioStretcher(audioStretcher)
+ // ...
```
The default audio stretcher, `DefaultAudioStretcher`, will:
@@ -81,19 +78,19 @@ The default audio stretcher, `DefaultAudioStretcher`, will:
Please take a look at the implementation and read class documentation.
-### Audio resampling
+## Audio resampling
When a sample rate different than the input is specified (by the `TrackStrategy`, or, when using the
-default audio strategy, by `DefaultAudioStategy.Builder.sampleRate()`), this library will automatically
-perform sample rate conversion for you.
+default audio strategy, by `DefaultAudioStrategy.Builder.sampleRate()`), this library will automatically
+perform sample rate conversion for you.
This operation is performed by a class called `AudioResampler`. We offer the option to pass your
own resamplers through the transcoder builder:
-```java
+```kotlin
Transcoder.into(filePath)
- .setAudioResampler(audioResampler)
- // ...
+ .setAudioResampler(audioResampler)
+ // ...
```
The default audio resampler, `DefaultAudioResampler`, will perform both upsampling and downsampling
@@ -101,5 +98,4 @@ with very basic algorithms (drop samples when downsampling, repeat samples when
Upsampling is generally discouraged - implementing a real upsampling algorithm is probably out of
the scope of this library.
-Please take a look at the implementation and read class documentation.
-
+Please take a look at the implementation and read class documentation.
\ No newline at end of file
diff --git a/docs/_about/changelog.md b/docs/changelog.mdx
similarity index 54%
rename from docs/_about/changelog.md
rename to docs/changelog.mdx
index 006ae4b3..6b4dc3fe 100644
--- a/docs/_about/changelog.md
+++ b/docs/changelog.mdx
@@ -1,52 +1,51 @@
---
-layout: page
-title: "Changelog"
-order: 3
+title: Changelog
---
-New versions are released through GitHub, so the reference page is the [GitHub Releases](https://github.com/natario1/Transcoder/releases) page.
+# Changelog
-> Starting from 0.7.0, you can now [support development](https://github.com/sponsors/natario1) through the GitHub Sponsors program.
-Companies can share a tiny part of their revenue and get private support hours in return. Thanks!
+New versions are released through GitHub, so the reference page is the [GitHub Releases](https://github.com/deepmedia/Transcoder/releases) page.
-### v0.10.5
+## 0.10.X
+
+### 0.10.5
- Fix: Honor buffer.hasRemaining() and otherwise release the buffer. ([#182][182])
-- Fix: Call progress even when not advenced. ([#170][170])
+- Fix: Call progress even when not advanced. ([#170][170])
- Fix: FilePathDataSource crash before initialize. ([#160][160])
-
+[Compare 0.10.4...0.10.5](https://github.com/deepmedia/Transcoder/compare/v0.10.4...v0.10.5).
-### v0.10.4
+### 0.10.4
- Fix: fixed crash in specific conditions ([#140][140])
- New: AssetFileDescriptorDataSource, can be used to transcode from AssetFileDescriptors ([#140][140])
-
+[Compare 0.10.3...0.10.4](https://github.com/deepmedia/Transcoder/compare/v0.10.3...v0.10.4).
-### v0.10.3
+### 0.10.3
- Fix: error when merging many files, thanks to [@DamonChen117][DamonChen117] ([#134][134])
- Fix: more concatenation issues
-
+[Compare 0.10.2...0.10.3](https://github.com/deepmedia/Transcoder/compare/v0.10.2...v0.10.3).
-### v0.10.2
+### 0.10.2
- Fix: error when merging many files ([#132][132])
-
+[Compare 0.10.1...0.10.2](https://github.com/deepmedia/Transcoder/compare/v0.10.1...v0.10.2).
-### v0.10.1
+### 0.10.1
- Fix: thumbnails upside down ([#125][125])
- Fix: clip/trim issues ([#127][127])
- Fix: seeking issues ([#128][128])
- Fix: concatenation failure ([#130][130])
-
+[Compare 0.10.0...0.10.1](https://github.com/deepmedia/Transcoder/compare/v0.10.0...v0.10.1).
-## v0.10.0
+### 0.10.0
> Transcoder is now distributed through Maven Central. Snapshot releases are available as well.
@@ -54,23 +53,27 @@ Companies can share a tiny part of their revenue and get private support hours i
- Improvement: rewritten transcoding pipeline ([#118][118])
- Fix: many bugs fixed while rewriting the pipeline ([#118][118])
-
+[Compare 0.9.1...0.10.0](https://github.com/deepmedia/Transcoder/compare/v0.9.1...v0.10.0).
+
+## 0.9.X
-### v0.9.1
+### 0.9.1
- Improvement: `DefaultDataSink` new constructor with support for FileDescriptor. ([#87][87])
-
+[Compare 0.9.0...0.9.1](https://github.com/deepmedia/Transcoder/compare/v0.9.0...v0.9.1).
-### v0.9.0
+### 0.9.0
-- New: `BlankAudioDataSource` can be used to add muted audio to a video-only track, thanks to [@mudar][mudar] ([#64][64])
-- Enhancement: you can now concatenate multiple files even if some of them have no audio, thanks to [@mudar][mudar] ([#64][64])
+- New: `BlankAudioDataSource` can be used to add muted audio to a video-only track, thanks to [@mudar][mudar] ([#64][64])
+- Enhancement: you can now concatenate multiple files even if some of them have no audio, thanks to [@mudar][mudar] ([#64][64])
- Enhancement: you can now concatenate multiple files without audio track, thanks to [@cbernier2][cbernier2] ([#61][61])
-
+[Compare 0.8.0...0.9.0](https://github.com/deepmedia/Transcoder/compare/v0.8.0...v0.9.0).
+
+## 0.8.X
-### v0.8.0
+### 0.8.0
- New: `TrimDataSource` to trim segments. Use it to wrap your original source. Thanks to [@mudar][mudar] ([#50][50])
- New: `ClipDataSource`, just likes `TrimDataSource` but selects trim values with respect to video start ([#54][54])
@@ -78,37 +81,39 @@ Companies can share a tiny part of their revenue and get private support hours i
> Transcoder will trim video segments only at the closest video sync frame. If your video has few sync
frames, the trim timestamp might be different than what was selected.
-
+[Compare 0.7.4...0.8.0](https://github.com/deepmedia/Transcoder/compare/v0.7.4...v0.8.0).
-##### v0.7.4
+## Older versions
+
+### 0.7.4
- Fix: fixed Xamarin incompatibility, thanks to [@aweck][aweck] ([#41][41])
- Fix: fixed small bugs with specific API versions / media files ([#47][47])
- Fix: fixed issues with specific media files, ensure consistent onProgress callback ([#48][48])
-
+[Compare 0.7.3...0.7.4](https://github.com/deepmedia/Transcoder/compare/v0.7.3...v0.7.4).
-##### v0.7.3
+### 0.7.3
- Fix: fixed bug with files that do not have an audio track, thanks to [@pawegio][pawegio] ([#31][31])
- Fix: fixed possible issues with FilePathDataSource ([#32][32])
-
+[Compare 0.7.2...0.7.3](https://github.com/deepmedia/Transcoder/compare/v0.7.2...v0.7.3).
-##### v0.7.2
+### 0.7.2
- Improvement: better input format detection. Fixes bugs with certain files ([#29][29])
- Improvement: added `DefaultAudioStrategy.Builder.bitRate()` option ([#29][29])
-
+[Compare 0.7.1...0.7.2](https://github.com/deepmedia/Transcoder/compare/v0.7.1...v0.7.2).
-##### v0.7.1
+### 0.7.1
- Improvement: update the underlying OpenGL library ([#20][20])
-
+[Compare 0.7.0...0.7.1](https://github.com/deepmedia/Transcoder/compare/v0.7.0...v0.7.1).
-### v0.7.0
+### 0.7.0
- New: video concatenation to stitch together multiple media ([#14][14])
- New: select a specific track type (`VIDEO` or `AUDIO`) for sources ([#14][14])
@@ -122,18 +127,18 @@ frames, the trim timestamp might be different than what was selected.
- Improvement: when concatenating multiple sources, automatically clip the longer track (audio or video) ([#17][17])
- Improvement: various bug fixed ([#18][18])
-
+[Compare 0.6.0...0.7.0](https://github.com/deepmedia/Transcoder/compare/v0.6.0...v0.7.0).
-### v0.6.0
+### 0.6.0
- New: ability to change video/audio speed and change each frame timestamp ([#10][10])
- New: ability to set the video output rotation ([#8][8])
- Improvement: new frame dropping algorithm, thanks to [@Saqrag][Saqrag] ([#9][9])
- Improvement: avoid format validation on tracks coming from PassThroughTrackTranscoder, thanks to [@Saqrag][Saqrag] ([#11][11])
-
+[Compare 0.5.0...0.6.0](https://github.com/deepmedia/Transcoder/compare/v0.5.0...v0.6.0).
-### v0.5.0
+### 0.5.0
- New: video cropping to any dimension. Encoder will crop the exceeding size. ([#6][6])
- New: `AspectRatioResizer` to crop to a given aspect ratio. ([#6][6])
@@ -150,37 +155,39 @@ frames, the trim timestamp might be different than what was selected.
[cbernier2]: https://github.com/cbernier2
[DamonChen117]: https://github.com/DamonChen117
-[4]: https://github.com/natario1/Transcoder/pull/4
-[5]: https://github.com/natario1/Transcoder/pull/5
-[6]: https://github.com/natario1/Transcoder/pull/6
-[8]: https://github.com/natario1/Transcoder/pull/8
-[9]: https://github.com/natario1/Transcoder/pull/9
-[10]: https://github.com/natario1/Transcoder/pull/10
-[14]: https://github.com/natario1/Transcoder/pull/14
-[16]: https://github.com/natario1/Transcoder/pull/16
-[17]: https://github.com/natario1/Transcoder/pull/17
-[18]: https://github.com/natario1/Transcoder/pull/18
-[20]: https://github.com/natario1/Transcoder/pull/20
-[29]: https://github.com/natario1/Transcoder/pull/29
-[31]: https://github.com/natario1/Transcoder/pull/31
-[32]: https://github.com/natario1/Transcoder/pull/32
-[41]: https://github.com/natario1/Transcoder/pull/41
-[47]: https://github.com/natario1/Transcoder/pull/47
-[48]: https://github.com/natario1/Transcoder/pull/48
-[50]: https://github.com/natario1/Transcoder/pull/50
-[54]: https://github.com/natario1/Transcoder/pull/54
-[61]: https://github.com/natario1/Transcoder/pull/61
-[64]: https://github.com/natario1/Transcoder/pull/64
-[87]: https://github.com/natario1/Transcoder/pull/87
-[118]: https://github.com/natario1/Transcoder/pull/118
-[119]: https://github.com/natario1/Transcoder/pull/119
-[125]: https://github.com/natario1/Transcoder/pull/125
-[127]: https://github.com/natario1/Transcoder/pull/127
-[128]: https://github.com/natario1/Transcoder/pull/128
-[130]: https://github.com/natario1/Transcoder/pull/130
-[132]: https://github.com/natario1/Transcoder/pull/132
-[134]: https://github.com/natario1/Transcoder/pull/134
-[140]: https://github.com/natario1/Transcoder/pull/140
-[160]: https://github.com/natario1/Transcoder/pull/160
-[170]: https://github.com/natario1/Transcoder/pull/170
-[182]: https://github.com/natario1/Transcoder/pull/182
+[4]: https://github.com/deepmedia/Transcoder/pull/4
+[5]: https://github.com/deepmedia/Transcoder/pull/5
+[6]: https://github.com/deepmedia/Transcoder/pull/6
+[8]: https://github.com/deepmedia/Transcoder/pull/8
+[9]: https://github.com/deepmedia/Transcoder/pull/9
+[10]: https://github.com/deepmedia/Transcoder/pull/10
+[11]: https://github.com/deepmedia/Transcoder/pull/11
+[14]: https://github.com/deepmedia/Transcoder/pull/14
+[16]: https://github.com/deepmedia/Transcoder/pull/16
+[17]: https://github.com/deepmedia/Transcoder/pull/17
+[18]: https://github.com/deepmedia/Transcoder/pull/18
+[20]: https://github.com/deepmedia/Transcoder/pull/20
+[29]: https://github.com/deepmedia/Transcoder/pull/29
+[31]: https://github.com/deepmedia/Transcoder/pull/31
+[32]: https://github.com/deepmedia/Transcoder/pull/32
+[41]: https://github.com/deepmedia/Transcoder/pull/41
+[47]: https://github.com/deepmedia/Transcoder/pull/47
+[48]: https://github.com/deepmedia/Transcoder/pull/48
+[50]: https://github.com/deepmedia/Transcoder/pull/50
+[54]: https://github.com/deepmedia/Transcoder/pull/54
+[61]: https://github.com/deepmedia/Transcoder/pull/61
+[64]: https://github.com/deepmedia/Transcoder/pull/64
+[87]: https://github.com/deepmedia/Transcoder/pull/87
+[118]: https://github.com/deepmedia/Transcoder/pull/118
+[119]: https://github.com/deepmedia/Transcoder/pull/119
+[125]: https://github.com/deepmedia/Transcoder/pull/125
+[127]: https://github.com/deepmedia/Transcoder/pull/127
+[128]: https://github.com/deepmedia/Transcoder/pull/128
+[130]: https://github.com/deepmedia/Transcoder/pull/130
+[132]: https://github.com/deepmedia/Transcoder/pull/132
+[134]: https://github.com/deepmedia/Transcoder/pull/134
+[140]: https://github.com/deepmedia/Transcoder/pull/140
+[160]: https://github.com/deepmedia/Transcoder/pull/160
+[170]: https://github.com/deepmedia/Transcoder/pull/170
+[182]: https://github.com/deepmedia/Transcoder/pull/182
+
diff --git a/docs/_docs/clipping.md b/docs/clipping.mdx
similarity index 59%
rename from docs/_docs/clipping.md
rename to docs/clipping.mdx
index 783129d1..d2fa03c7 100644
--- a/docs/_docs/clipping.md
+++ b/docs/clipping.mdx
@@ -1,11 +1,9 @@
---
-layout: page
-title: "Clipping and trimming"
-description: "How to clip each segment individually on both ends"
-order: 2
-disqus: 1
+title: Clip & Trim
---
+# Clip & Trim
+
Starting from `v0.8.0`, Transcoder offers the option to clip or trim video segments, on one or
both ends. This is done by using special `DataSource` objects that wrap you original source,
so that, in case of [concatenation](concatenation) of multiple media files, the trimming values
@@ -17,43 +15,42 @@ include video decoding / re-encoding, the clipping position will be moved to the
This means that the clipped output duration might be different than expected,
depending on the frequency of sync frames in your original file.
-### TrimDataSource
+## TrimDataSource
The `TrimDataSource` class lets you trim segments by specifying the amount of time to be trimmed
-at both ends. For example, the code below will trim the file by 1 second at the beginning, and
+at both ends. For example, the code below will trim the file by 1 second at the beginning, and
2 seconds at the end:
-```java
-DataSource source = new UriDataSource(context, uri);
-DataSource trim = new TrimDataSource(source, 1000 * 1000, 2 * 1000 * 1000);
+```kotlin
+let source: DataSource = UriDataSource(context, uri)
+let trim: DataSource = TrimDataSource(source, 1000 * 1000, 2 * 1000 * 1000)
Transcoder.into(filePath)
- .addDataSource(trim)
- .transcode()
+ .addDataSource(trim)
+ .transcode()
```
It is recommended to always check `source.getDurationUs()` to compute the correct values.
-
-### ClipDataSource
-The `ClipDataSource` class lets you clip segments by specifying a time window. For example,
+## ClipDataSource
+
+The `ClipDataSource` class lets you clip segments by specifying a time window. For example,
the code below clip the file from second 1 until second 5:
-```java
-DataSource source = new UriDataSource(context, uri);
-DataSource clip = new ClipDataSource(source, 1000 * 1000, 5 * 1000 * 1000);
+```kotlin
+let source: DataSource = UriDataSource(context, uri)
+let clip: DataSource = ClipDataSource(source, 1000 * 1000, 5 * 1000 * 1000)
Transcoder.into(filePath)
- .addDataSource(clip)
- .transcode()
+ .addDataSource(clip)
+ .transcode()
```
It is recommended to always check `source.getDurationUs()` to compute the correct values.
-
-### Related APIs
+
+## Related APIs
|Method|Description|
|------|-----------|
-|`new TrimDataSource(source, long)`|Creates a new data source trimmed on start.|
-|`new TrimDataSource(source, long, long)`|Creates a new data source trimmed on both ends.|
-|`new ClipDataSource(source, long)`|Creates a new data source clipped on start.|
-|`new ClipDataSource(source, long, long)`|Creates a new data source clipped on both ends.|
-
+|`TrimDataSource(source, long)`|Creates a new data source trimmed on start.|
+|`TrimDataSource(source, long, long)`|Creates a new data source trimmed on both ends.|
+|`ClipDataSource(source, long)`|Creates a new data source clipped on start.|
+|`ClipDataSource(source, long, long)`|Creates a new data source clipped on both ends.|
\ No newline at end of file
diff --git a/docs/_docs/concatenation.md b/docs/concatenation.mdx
similarity index 60%
rename from docs/_docs/concatenation.md
rename to docs/concatenation.mdx
index d311e90a..559cb38d 100644
--- a/docs/_docs/concatenation.md
+++ b/docs/concatenation.mdx
@@ -1,20 +1,20 @@
---
-layout: page
-title: "Concatenation"
-description: "How to concatenate video segments"
-order: 3
-disqus: 1
+title: Concatenation
---
-As you might have guessed from the previous section, you can use `addDataSource(source)` multiple times.
+# Concatenation
+
+## Appending sources
+
+As you might have guessed from the previous section, you can use `addDataSource(source)` multiple times.
All the source files will be stitched together:
-```java
+```kotlin
Transcoder.into(filePath)
- .addDataSource(source1)
- .addDataSource(source2)
- .addDataSource(source3)
- // ...
+ .addDataSource(source1)
+ .addDataSource(source2)
+ .addDataSource(source3)
+ // ...
```
In the above example, the three videos will be stitched together in the order they are added
@@ -23,25 +23,25 @@ of applying consistent parameters (frame rate, bit rate, sample rate) during the
This is a powerful tool since it can be used per-track:
-```java
+```kotlin
Transcoder.into(filePath)
- .addDataSource(source1) // Audio & Video, 20 seconds
- .addDataSource(TrackType.VIDEO, source2) // Video, 5 seconds
- .addDataSource(TrackType.VIDEO, source3) // Video, 5 seconds
- .addDataSource(TrackType.AUDIO, source4) // Audio, 10 sceonds
- // ...
+ .addDataSource(source1) // Audio & Video, 20 seconds
+ .addDataSource(TrackType.VIDEO, source2) // Video, 5 seconds
+ .addDataSource(TrackType.VIDEO, source3) // Video, 5 seconds
+ .addDataSource(TrackType.AUDIO, source4) // Audio, 10 sceonds
+ // ...
```
In the above example, the output file will be 30 seconds long:
```
-Video: | •••••••••••••••••• source1 •••••••••••••••••• | •••• source2 •••• | •••• source3 •••• |
-Audio: | •••••••••••••••••• source1 •••••••••••••••••• | •••••••••••••• source4 •••••••••••••• |
+Video: | •••••••••••••••••• source1 •••••••••••••••••• | •••• source2 •••• | •••• source3 •••• |
+Audio: | •••••••••••••••••• source1 •••••••••••••••••• | •••••••••••••• source4 •••••••••••••• |
```
And that's all you need to do.
-### Automatic clipping
+## Automatic clipping
When concatenating data from multiple sources and on different tracks, it's common to have
a total audio length that is different than the total video length.
@@ -49,13 +49,12 @@ a total audio length that is different than the total video length.
In this case, `Transcoder` will automatically clip the longest track to match the shorter.
For example:
-```java
+```kotlin
Transcoder.into(filePath)
- .addDataSource(TrackType.VIDEO, video1) // Video, 30 seconds
- .addDataSource(TrackType.VIDEO, video2) // Video, 30 seconds
- .addDataSource(TrackType.AUDIO, music) // Audio, 3 minutes
- // ...
+ .addDataSource(TrackType.VIDEO, video1) // Video, 30 seconds
+ .addDataSource(TrackType.VIDEO, video2) // Video, 30 seconds
+ .addDataSource(TrackType.AUDIO, music) // Audio, 3 minutes
+ // ...
```
-In the situation above, we won't use the full music track, but only the first minute of it.
-
+In the situation above, we won't use the full music track, but only the first minute of it.
\ No newline at end of file
diff --git a/docs/_docs/data-sources.md b/docs/data-sources.mdx
similarity index 62%
rename from docs/_docs/data-sources.md
rename to docs/data-sources.mdx
index ee45591a..a32b6146 100644
--- a/docs/_docs/data-sources.md
+++ b/docs/data-sources.mdx
@@ -1,55 +1,55 @@
---
-layout: page
-title: "Data Sources"
-description: "Sources of media data"
-order: 1
-disqus: 1
+title: Data Sources
---
+# Data Sources
+
Starting a transcoding operation will require a source for our data, which is not necessarily
a `File`. The `DataSource` objects will automatically take care about releasing streams / resources,
which is convenient but it means that they can not be used twice.
-```java
+```kotlin
Transcoder.into(filePath)
- .addDataSource(source1)
- .transcode()
+ .addDataSource(source1)
+ .transcode()
```
-##### UriDataSource
+## Source Types
+
+#### UriDataSource
-The Android friendly source can be created with `new UriDataSource(context, uri)` or simply
+The Android friendly source can be created with `UriDataSource(context, uri)` or simply
using `addDataSource(context, uri)` in the transcoding builder.
-##### FileDescriptorDataSource
+#### FileDescriptorDataSource
-A data source backed by a file descriptor. Use `new FileDescriptorDataSource(descriptor)` or
+A data source backed by a file descriptor. Use `FileDescriptorDataSource(descriptor)` or
simply `addDataSource(descriptor)` in the transcoding builder. Note that it is the caller
responsibility to close the file descriptor.
-##### FilePathDataSource
+#### FilePathDataSource
-A data source backed by a file absolute path. Use `new FilePathDataSource(path)` or
+A data source backed by a file absolute path. Use `FilePathDataSource(path)` or
simply `addDataSource(path)` in the transcoding builder.
-##### AssetFileDescriptorDataSource
+#### AssetFileDescriptorDataSource
-A data source backed by Android's AssetFileDescriptor. Use `new AssetFileDescriptorDataSource(descriptor)`
+A data source backed by Android's AssetFileDescriptor. Use `AssetFileDescriptorDataSource(descriptor)`
or simply `addDataSource(descriptor)` in the transcoding builder. Note that it is the caller
responsibility to close the file descriptor.
-### Track specific sources
+## Track specific sources
Although a media source can have both audio and video, you can select a specific track
for transcoding and exclude the other(s). For example, to select the video track only:
-
+
```java
Transcoder.into(filePath)
- .addDataSource(TrackType.VIDEO, source)
- .transcode()
+ .addDataSource(TrackType.VIDEO, source)
+ .transcode()
```
-
-### Related APIs
+
+## Related APIs
|Method|Description|
|------|-----------|
@@ -57,5 +57,4 @@ Transcoder.into(filePath)
|`addDataSource(FileDescriptor)`|Adds a new source for the given FileDescriptor.|
|`addDataSource(String)`|Adds a new source for the given file path.|
|`addDataSource(DataSource)`|Adds a new source.|
-|`addDataSource(TrackType, DataSource)`|Adds a new source restricted to the given TrackType.|
-
+|`addDataSource(TrackType, DataSource)`|Adds a new source restricted to the given TrackType.|
\ No newline at end of file
diff --git a/docs/_docs/events.md b/docs/events.mdx
similarity index 69%
rename from docs/_docs/events.md
rename to docs/events.mdx
index a2f79b9f..995a7715 100644
--- a/docs/_docs/events.md
+++ b/docs/events.mdx
@@ -1,25 +1,22 @@
---
-layout: page
-title: "Transcoding Events"
-description: "Listening to transcoding events"
-order: 4
-disqus: 1
+title: Events
---
+# Events
Transcoding will happen on a background thread, but we will send updates through the `TranscoderListener`
interface, which can be applied when building the request:
-```java
+```kotlin
Transcoder.into(filePath)
- .setListenerHandler(handler)
- .setListener(new TranscoderListener() {
- public void onTranscodeProgress(double progress) {}
- public void onTranscodeCompleted(int successCode) {}
- public void onTranscodeCanceled() {}
- public void onTranscodeFailed(@NonNull Throwable exception) {}
- })
- // ...
+ .setListenerHandler(handler)
+ .setListener(object: TranscoderListener {
+ override fun onTranscodeProgress(progress: Double) = Unit
+ override fun onTranscodeCompleted(successCode: Int) = Unit
+ override fun onTranscodeCanceled() = Unit
+ override fun onTranscodeFailed(exception: Throwable) = Unit
+ })
+ // ...
```
All of the listener callbacks are called:
@@ -28,19 +25,19 @@ All of the listener callbacks are called:
- If it has a handler, on the thread that started the `transcode()` call
- As a last resort, on the UI thread
-##### onTranscodeProgress
+### onTranscodeProgress
This simply sends a double indicating the current progress. The value is typically between 0 and 1,
but can be a negative value to indicate that we are not able to compute progress (yet?).
This is the right place to update a ProgressBar, for example.
-##### onTranscodeCanceled
+### onTranscodeCanceled
The transcoding operation was canceled. This can happen when the `Future` returned by `transcode()`
is cancelled by the user.
-##### onTranscodeFailed
+### onTranscodeFailed
This can happen in a number of cases and is typically out of our control. Input options might be
wrong, write permissions might be missing, codec might be absent, input file might be not supported
@@ -48,7 +45,7 @@ or simply corrupted.
You can take a look at the `Throwable` being passed to know more about the exception.
-##### onTranscodeCompleted
+### onTranscodeCompleted
Transcoding operation did succeed. The success code can be:
@@ -56,6 +53,3 @@ Transcoding operation did succeed. The success code can be:
|----|-------|
|`Transcoder.SUCCESS_TRANSCODED`|Transcoding was executed successfully. Transcoded file was written to the output path.|
|`Transcoder.SUCCESS_NOT_NEEDED`|Transcoding was not executed because it was considered **not needed** by the `Validator`.|
-
-[Keep reading](validators) to know about `Validator`s.
-
diff --git a/docs/home.md b/docs/home.md
deleted file mode 100644
index d5ad2786..00000000
--- a/docs/home.md
+++ /dev/null
@@ -1,49 +0,0 @@
----
-layout: main
-title: "Transcoder"
----
-
-# Transcoder
-
-Transcoder is a well documented Android library providing hardware-accelerated video transcoding,
-using MediaCodec APIs instead of native code (no FFMPEG patent issues).
-
-
-
-
-
-- Fast transcoding to AAC/AVC
-- Hardware accelerated
-- Multithreaded
-- Convenient, fluent API
-- Concatenate multiple video and audio tracks [[docs]](docs/concatenation)
-- Clip or trim video segments [[docs]](docs/clipping)
-- Choose output size, with automatic cropping [[docs]](docs/track-strategies#video-size)
-- Choose output rotation [[docs]](docs/advanced-options#video-rotation)
-- Choose output speed [[docs]](docs/advanced-options#video-speed)
-- Choose output frame rate [[docs]](docs/track-strategies#other-options)
-- Choose output audio channels [[docs]](docs/track-strategies#audio-strategies)
-- Choose output audio sample rate [[docs]](docs/track-strategies#audio-strategies)
-- Override frames timestamp, e.g. to slow down the middle part of the video [[docs]](docs/advanced-options#time-interpolation)
-- Error handling [[docs]](docs/events)
-- Configurable validators to e.g. avoid transcoding if the source is already compressed enough [[docs]](docs/validators)
-- Configurable video and audio strategies [[docs]](docs/track-strategies)
-
-### Get started
-
-Get started with [install info](about/install), [quick setup](about/getting-started), or
-start reading the in-depth [documentation](docs/data-sources).
-
-### Notes
-
-This project started as a fork of [ypresto/android-transcoder](https://github.com/ypresto/android-transcoder).
-With respect to the source project, which misses most of the functionality listed above,
-we have also fixed a huge number of bugs and are much less conservative when choosing options
-that might not be supported. The source project will always throw - for example, accepting only 16:9,
-AVC Baseline Profile videos - we prefer to try and let the codec fail if it wants to.
-
-### Support
-
-If you like the project, use it with profit, and want to thank back, please consider [donating or
-becoming a supporter](extra/donate).
-
diff --git a/docs/index.md b/docs/index.md
deleted file mode 100644
index ecfd1b98..00000000
--- a/docs/index.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-layout: landing
-title: "Transcoder"
----
-
-Accelerated video transcoding on Android using MediaCodec APIs, without native code (no FFMPEG patent issues). Supports cropping to any dimension, concatenation, audio processing and much more.
\ No newline at end of file
diff --git a/docs/index.mdx b/docs/index.mdx
new file mode 100644
index 00000000..fe762288
--- /dev/null
+++ b/docs/index.mdx
@@ -0,0 +1,81 @@
+---
+title: Intro
+docs:
+ - install
+ - changelog
+ - data-sources
+ - clipping
+ - concatenation
+ - events
+ - validators
+ - track-strategies
+ - advanced-options
+---
+
+# Intro
+
+The Transcoder library transcodes and compresses video files into the MP4 format, with audio support, using hardware-accelerated
+Android codecs available on the device. Works on API 19+ and supports the following set of features:
+
+- Fast transcoding to AAC/AVC
+- Hardware accelerated
+- Convenient, fluent API
+- Thumbnails support
+- [Concatenate](concatenation) multiple video and audio tracks
+- [Clip or trim](clipping) video segments
+- Configure [output size](track-strategies#video-size), with automatic cropping
+- Configure [output rotation](advanced-options#video-rotation)
+- Configure [output speed](advanced-options#video-speed)
+- Configure [output frame rate](track-strategies#other-options)
+- Configure [output audio channels](track-strategies#audio-strategies) and sample rate
+- [Override timestamp](advanced-options#time-interpolation) of frames, for example to slow down parts of the video
+- [Error handling](events)
+- Configurable [validators](validators) to e.g. avoid transcoding if the source is already compressed enough
+- Configurable video and audio [strategies](track-strategies)
+
+> This project started as a fork of [ypresto/android-transcoder](https://github.com/ypresto/android-transcoder).
+With respect to the source project, which misses most of the functionality listed above,
+we have also fixed a huge number of bugs and are much less conservative when choosing options
+that might not be supported. The source project will always throw - for example, accepting only 16:9,
+AVC Baseline Profile videos - we prefer to try and let the codec fail if it wants to.
+
+## Minimal example
+
+```kotlin
+Transcoder.into(filePath)
+ .addDataSource(context, uri) // or...
+ .addDataSource(filePath) // or...
+ .addDataSource(fileDescriptor) // or...
+ .addDataSource(dataSource)
+ .setListener(object : TranscoderListener {
+ override fun onTranscodeProgress(progress: Double) = Unit
+ override fun onTranscodeCompleted(successCode: Int) = Unit
+ override fun onTranscodeCanceled() = Unit
+ override fun onTranscodeFailed(exception: Throwable) = Unit
+ }).transcode()
+```
+
+Please keep reading the documentation to learn about [install instructions](install), configuration options and APIs.
+
+
+## License
+
+This project is licensed under Apache 2.0. It consists of improvements over
+the [ypresto/android-transcoder](https://github.com/ypresto/android-transcoder)
+project which was licensed under Apache 2.0 as well:
+
+```
+Copyright (C) 2014-2016 Yuya Tanaka
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+```
\ No newline at end of file
diff --git a/docs/install.mdx b/docs/install.mdx
new file mode 100644
index 00000000..14cbf649
--- /dev/null
+++ b/docs/install.mdx
@@ -0,0 +1,37 @@
+---
+title: Install
+---
+
+# Installation
+
+Transcoder is publicly hosted on the [Maven Central](https://repo1.maven.org/maven2/com/otaliastudios/)
+repository, where you can download the AAR package. To fetch with Gradle, assuming that `mavenCentral()` is already
+one of your repository sources, simply declare a new dependency:
+
+```kotlin
+dependencies {
+ api("com.otaliastudios:transcoder:LATEST_VERSION")
+}
+```
+
+Replace `LATEST_VERSION` with the latest version number, {version}.
+
+## Snapshots
+
+We regularly push development snapshots of the library at `https://s01.oss.sonatype.org/content/repositories/snapshots/`
+on each push to main. To use snapshots, add the url as a maven repository and depend on `latest-SNAPSHOT`:
+
+```kotlin
+// settings.gradle.kts
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
+ }
+}
+
+// build.gradle.kts
+dependencies {
+ implementation("com.otaliastudios:transcoder:latest-SNAPSHOT")
+}
+```
\ No newline at end of file
diff --git a/docs/_docs/track-strategies.md b/docs/track-strategies.mdx
similarity index 61%
rename from docs/_docs/track-strategies.md
rename to docs/track-strategies.mdx
index b78fbeb0..d9e24716 100644
--- a/docs/_docs/track-strategies.md
+++ b/docs/track-strategies.mdx
@@ -1,95 +1,92 @@
---
-layout: page
-title: "Track Strategies"
-description: "Per-track transcoding options"
-order: 6
-disqus: 1
+title: Track Strategies
---
+# Track Strategies
Track strategies return options for each track (audio or video) for the engine to understand **how**
and **if** this track should be transcoded, and whether the whole process should be aborted.
-```java
+```kotlin
Transcoder.into(filePath)
- .setVideoTrackStrategy(videoStrategy)
- .setAudioTrackStrategy(audioStrategy)
- // ...
+ .setVideoTrackStrategy(videoStrategy)
+ .setAudioTrackStrategy(audioStrategy)
+ // ...
```
The point of `TrackStrategy` is to inspect the input `android.media.MediaFormat` and return
the output `android.media.MediaFormat`, filled with required options.
+## Basic Strategies
+
This library offers track specific strategies that help with audio and video options (see
[Audio Strategies](#audio-strategies) and [Video Strategies](#video-strategies)).
In addition, we have a few built-in strategies that can work for both audio and video:
-##### PassThroughTrackStrategy
+### PassThroughTrackStrategy
A TrackStrategy that asks the encoder to keep this track as is, by returning the same input
format. Note that this is risky, as the input track format might not be supported my the MP4 container.
This will set the `TrackStatus` to `TrackStatus.PASS_THROUGH`.
-##### RemoveTrackStrategy
+### RemoveTrackStrategy
A TrackStrategy that asks the encoder to remove this track from the output container, by returning null.
For instance, this can be used as an audio strategy to remove audio from video/audio streams.
This will set the `TrackStatus` to `TrackStatus.REMOVING`.
-### Audio Strategies
+## Audio Strategies
The default internal strategy for audio is a `DefaultAudioStrategy`, which converts the
audio stream to AAC format with the specified number of channels and [sample rate](advanced-options).
-```java
-DefaultAudioStrategy strategy = DefaultAudioStrategy.builder()
- .channels(DefaultAudioStrategy.CHANNELS_AS_INPUT)
- .channels(1)
- .channels(2)
- .sampleRate(DefaultAudioStrategy.SAMPLE_RATE_AS_INPUT)
- .sampleRate(44100)
- .sampleRate(30000)
- .bitRate(DefaultAudioStrategy.BITRATE_UNKNOWN)
- .bitRate(bitRate)
- .build();
+```kotlin
+val strategy: DefaultAudioStrategy = DefaultAudioStrategy.builder()
+ .channels(DefaultAudioStrategy.CHANNELS_AS_INPUT)
+ .channels(1)
+ .channels(2)
+ .sampleRate(DefaultAudioStrategy.SAMPLE_RATE_AS_INPUT)
+ .sampleRate(44100)
+ .sampleRate(30000)
+ .bitRate(DefaultAudioStrategy.BITRATE_UNKNOWN)
+ .bitRate(bitRate)
+ .build()
Transcoder.into(filePath)
- .setAudioTrackStrategy(strategy)
- // ...
+ .setAudioTrackStrategy(strategy)
+ // ...
```
Take a look at the source code to understand how to manage the `android.media.MediaFormat` object.
-### Video Strategies
+## Video Strategies
The default internal strategy for video is a `DefaultVideoStrategy`, which converts the
video stream to AVC format and is very configurable. The class helps in defining an output size.
If the output size does not match the aspect ratio of the input stream size, `Transcoder` will
crop part of the input so it matches the final ratio.
-##### Video Size
+### Video Size
We provide helpers for common tasks:
-```java
-DefaultVideoStrategy strategy;
-
+```kotlin
// Sets an exact size. If aspect ratio does not match, cropping will take place.
-strategy = DefaultVideoStrategy.exact(1080, 720).build();
+val strategy = DefaultVideoStrategy.exact(1080, 720).build()
// Keeps the aspect ratio, but scales down the input size with the given fraction.
-strategy = DefaultVideoStrategy.fraction(0.5F).build();
+val strategy = DefaultVideoStrategy.fraction(0.5F).build()
// Ensures that each video size is at most the given value - scales down otherwise.
-strategy = DefaultVideoStrategy.atMost(1000).build();
+val strategy = DefaultVideoStrategy.atMost(1000).build()
// Ensures that minor and major dimension are at most the given values - scales down otherwise.
-strategy = DefaultVideoStrategy.atMost(500, 1000).build();
+val strategy = DefaultVideoStrategy.atMost(500, 1000).build()
```
-In fact, all of these will simply call `new DefaultVideoStrategy.Builder(resizer)` with a special
+In fact, all of these will simply call `DefaultVideoStrategy.Builder(resizer)` with a special
resizer. We offer handy resizers:
|Name|Description|
@@ -102,39 +99,39 @@ resizer. We offer handy resizers:
You can also group resizers through `MultiResizer`, which applies resizers in chain:
-```java
+```kotlin
// First scales down, then ensures size is at most 1000. Order matters!
-Resizer resizer = new MultiResizer();
-resizer.addResizer(new FractionResizer(0.5F));
-resizer.addResizer(new AtMostResizer(1000));
+val resizer: Resizer = MultiResizer()
+resizer.addResizer(FractionResizer(0.5F))
+resizer.addResizer(AtMostResizer(1000))
// First makes it 16:9, then ensures size is at most 1000. Order matters!
-Resizer resizer = new MultiResizer();
-resizer.addResizer(new AspectRatioResizer(16F / 9F));
-resizer.addResizer(new AtMostResizer(1000));
+val resizer: Resizer = MultiResizer()
+resizer.addResizer(AspectRatioResizer(16F / 9F))
+resizer.addResizer(AtMostResizer(1000))
```
This option is already available through the DefaultVideoStrategy builder, so you can do:
-```java
-DefaultVideoStrategy strategy = new DefaultVideoStrategy.Builder()
- .addResizer(new AspectRatioResizer(16F / 9F))
- .addResizer(new FractionResizer(0.5F))
- .addResizer(new AtMostResizer(1000))
- .build();
+```kotlin
+val strategy: DefaultVideoStrategy = DefaultVideoStrategy.Builder()
+ .addResizer(AspectRatioResizer(16F / 9F))
+ .addResizer(FractionResizer(0.5F))
+ .addResizer(AtMostResizer(1000))
+ .build()
```
-##### Other options
+### Other options
You can configure the `DefaultVideoStrategy` with other options unrelated to the video size:
-```java
-DefaultVideoStrategy strategy = new DefaultVideoStrategy.Builder()
- .bitRate(bitRate)
- .bitRate(DefaultVideoStrategy.BITRATE_UNKNOWN) // tries to estimate
- .frameRate(frameRate) // will be capped to the input frameRate
- .keyFrameInterval(interval) // interval between key-frames in seconds
- .build();
+```kotlin
+val strategy: DefaultVideoStrategy = DefaultVideoStrategy.Builder()
+ .bitRate(bitRate)
+ .bitRate(DefaultVideoStrategy.BITRATE_UNKNOWN) // tries to estimate
+ .frameRate(frameRate) // will be capped to the input frameRate
+ .keyFrameInterval(interval) // interval between key-frames in seconds
+ .build()
```
### Compatibility
@@ -143,14 +140,14 @@ As stated pretty much everywhere, **not all codecs/devices/manufacturers support
This is a complex issue which is especially important for video strategies, as a wrong size can lead
to a transcoding error or corrupted file.
-Android platform specifies requirements for manufacturers through the [CTS (Compatibility test suite)](https://source.android.com/compatibility/cts).
+Android platform specifies requirements for manufacturers through the [Compatibility test suite](https://source.android.com/compatibility/cts) (CTS).
Only a few codecs and sizes are **strictly** required to work.
We collect common presets in the `DefaultVideoStrategies` class:
-```java
+```kotlin
Transcoder.into(filePath)
- .setVideoTrackStrategy(DefaultVideoStrategies.for720x1280()) // 16:9
- .setVideoTrackStrategy(DefaultVideoStrategies.for360x480()) // 4:3
- // ...
+ .setVideoTrackStrategy(DefaultVideoStrategies.for720x1280()) // 16:9
+ .setVideoTrackStrategy(DefaultVideoStrategies.for360x480()) // 4:3
+ // ...
```
\ No newline at end of file
diff --git a/docs/_docs/validators.md b/docs/validators.mdx
similarity index 88%
rename from docs/_docs/validators.md
rename to docs/validators.mdx
index f28eb3a0..0ee78c4d 100644
--- a/docs/_docs/validators.md
+++ b/docs/validators.mdx
@@ -1,18 +1,16 @@
---
-layout: page
-title: "Validators"
-description: "Validate or abort the transcoding process"
-order: 5
-disqus: 1
+title: Validators
---
+# Validators
+
Validators tell the engine whether the transcoding process should start or not based on the status
of the audio and video track.
-```java
+```kotlin
Transcoder.into(filePath)
- .setValidator(validator)
- // ...
+ .setValidator(validator)
+ // ...
```
This can be used, for example, to:
@@ -35,19 +33,18 @@ The TrackStatus enum contains the following values:
The `TrackStatus` value depends on the [track strategy](track-strategies) that was used.
We provide a few validators that can be injected for typical usage.
-##### DefaultValidator
+### DefaultValidator
This is the default validator and it returns true when any of the track is `COMPRESSING` or `REMOVING`.
In the other cases, transcoding is typically not needed so we abort the operation.
-##### WriteAlwaysValidator
+### WriteAlwaysValidator
This validator always returns true and as such will always write to target file, no matter the track status,
presence of tracks and so on. For instance, the output container file might have no tracks.
-##### WriteVideoValidator
+### WriteVideoValidator
A Validator that gives priority to the video track. Transcoding will not happen if the video track does not need it,
even if the audio track might need it. If reducing file size is your only concern, this can avoid compressing
-files that would not benefit so much from compressing the audio track only.
-
+files that would not benefit so much from compressing the audio track only.
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index d97d827a..4cd7d5bf 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,23 +1,6 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-
-android.enableJetifier=true
android.useAndroidX=true
-org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
-# ^ https://github.com/Kotlin/dokka/issues/1405
\ No newline at end of file
+org.gradle.caching=true
+org.gradle.caching.debug=false
+org.gradle.parallel=true
+org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 26adea71..254dc618 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts
index efe27254..533e7902 100644
--- a/lib/build.gradle.kts
+++ b/lib/build.gradle.kts
@@ -1,62 +1,102 @@
-import io.deepmedia.tools.publisher.common.GithubScm
-import io.deepmedia.tools.publisher.common.License
-import io.deepmedia.tools.publisher.common.Release
-import io.deepmedia.tools.publisher.sonatype.Sonatype
-
plugins {
id("com.android.library")
- id("kotlin-android")
- id("io.deepmedia.tools.publisher")
+ kotlin("android")
+ id("io.deepmedia.tools.deployer") version "0.14.0-alpha1"
+ id("org.jetbrains.dokka") version "1.9.20"
}
android {
- setCompileSdkVersion(property("compileSdkVersion") as Int)
+ namespace = "com.otaliastudios.transcoder"
+ compileSdk = 34
defaultConfig {
- minSdk = property("minSdkVersion") as Int
- targetSdk = property("targetSdkVersion") as Int
+ minSdk = 21
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
- buildTypes["release"].isMinifyEnabled = false
+ testOptions {
+ targetSdk = 23
+ }
+ publishing {
+ singleVariant("release")
+ }
}
+kotlin {
+ jvmToolchain(17)
+}
dependencies {
api("com.otaliastudios.opengl:egloo:0.6.1")
- api("androidx.annotation:annotation:1.2.0")
+ api("androidx.annotation:annotation:1.8.1")
- androidTestImplementation("androidx.test:runner:1.4.0")
- androidTestImplementation("androidx.test:rules:1.4.0")
- androidTestImplementation("androidx.test.ext:junit:1.1.3")
+ androidTestImplementation("androidx.test:runner:1.6.1")
+ androidTestImplementation("androidx.test:rules:1.6.1")
+ androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("org.mockito:mockito-android:2.28.2")
+
+ dokkaPlugin("org.jetbrains.dokka:android-documentation-plugin:1.9.20")
}
-publisher {
- project.description = "Accelerated video transcoding using Android MediaCodec API without native code (no LGPL/patent issues)."
- project.artifact = "transcoder"
- project.group = "com.otaliastudios"
- project.url = "https://github.com/natario1/Transcoder"
- project.scm = GithubScm("natario1", "Transcoder")
- project.addLicense(License.APACHE_2_0)
- project.addDeveloper("natario1", "mat.iavarone@gmail.com")
- release.sources = Release.SOURCES_AUTO
- release.docs = Release.DOCS_AUTO
- release.version = "0.10.5"
-
- directory()
-
- sonatype {
- auth.user = "SONATYPE_USER"
- auth.password = "SONATYPE_PASSWORD"
- signing.key = "SIGNING_KEY"
- signing.password = "SIGNING_PASSWORD"
- }
-
- sonatype("snapshot") {
- repository = Sonatype.OSSRH_SNAPSHOT_1
+val javadocs = tasks.register("dokkaJavadocJar") {
+ dependsOn(tasks.dokkaJavadoc)
+ from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
+ archiveClassifier.set("javadoc")
+}
+
+deployer {
+ verbose = true
+
+ content {
+ component {
+ fromSoftwareComponent("release")
+ kotlinSources()
+ docs(javadocs)
+ }
+ }
+
+ projectInfo {
+ groupId = "com.otaliastudios"
+ artifactId = "transcoder"
+ release.version = "0.10.5"
+ release.tag = "v0.10.5"
+ description = "Accelerated video compression and transcoding on Android using MediaCodec APIs (no FFMPEG/LGPL licensing issues). Supports cropping to any dimension, concatenation, audio processing and much more."
+ url = "https://github.com/deepmedia/Transcoder"
+ scm.fromGithub("deepmedia", "Transcoder")
+ license(apache2)
+ developer("natario1", "mattia@deepmedia.io", "DeepMedia", "https://deepmedia.io")
+ }
+
+ signing {
+ key = secret("SIGNING_KEY")
+ password = secret("SIGNING_PASSWORD")
+ }
+
+ // use "deployLocal" to deploy to local maven repository
+ localSpec {
+ directory.set(rootProject.layout.buildDirectory.get().dir("inspect"))
+ }
+
+ // use "deployNexus" to deploy to OSSRH / maven central
+ nexusSpec {
+ auth.user = secret("SONATYPE_USER")
+ auth.password = secret("SONATYPE_PASSWORD")
+ syncToMavenCentral = true
+ }
+
+ // use "deployNexusSnapshot" to deploy to sonatype snapshots repo
+ nexusSpec("snapshot") {
+ auth.user = secret("SONATYPE_USER")
+ auth.password = secret("SONATYPE_PASSWORD")
+ repositoryUrl = ossrhSnapshots1
release.version = "latest-SNAPSHOT"
- auth.user = "SONATYPE_USER"
- auth.password = "SONATYPE_PASSWORD"
- signing.key = "SIGNING_KEY"
- signing.password = "SIGNING_PASSWORD"
+ }
+
+ // use "deployGithub" to deploy to github packages
+ githubSpec {
+ repository = "Transcoder"
+ owner = "deepmedia"
+ auth {
+ user = secret("GHUB_USER")
+ token = secret("GHUB_PERSONAL_ACCESS_TOKEN")
+ }
}
}
diff --git a/lib/src/main/AndroidManifest.xml b/lib/src/main/AndroidManifest.xml
index f62d05a4..48652056 100644
--- a/lib/src/main/AndroidManifest.xml
+++ b/lib/src/main/AndroidManifest.xml
@@ -1,6 +1,3 @@
-
-
+
-
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ea9f578b..b3b62bfb 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1 +1,18 @@
-include(":lib", ":demo")
+pluginManagement {
+ repositories {
+ mavenLocal()
+ google()
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+dependencyResolutionManagement {
+ repositories {
+ mavenCentral()
+ google()
+ }
+}
+
+include(":lib")
+include(":demo")