diff --git a/.idea/misc.xml b/.idea/misc.xml index 53b7407a..2189e580 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/README.md b/README.md index eb9401df..4b553a52 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Android codecs available on the device. Works on API 21+. ```kotlin // build.gradle.kts dependencies { - implementation("io.deepmedia.community:transcoder-android:0.11.1") + implementation("io.deepmedia.community:transcoder-android:0.11.2") } ``` diff --git a/docs/changelog.mdx b/docs/changelog.mdx index a3fac8df..6defa6f1 100644 --- a/docs/changelog.mdx +++ b/docs/changelog.mdx @@ -8,6 +8,12 @@ New versions are released through GitHub, so the reference page is the [GitHub R ## 0.11.X +### 0.11.2 + +- Enhancement: support pass-through audio with more than 2 channels, thanks to [@natario1](https://github.com/natario1) ([#209](https://github.com/deepmedia/Transcoder/pull/209)) + +[Compare 0.11.1...0.11.2](https://github.com/deepmedia/Transcoder/compare/v0.11.1...v0.11.2). + ### 0.11.1 - Fix: add unbounded queue for drifted tracks during initialization, thanks to [@jumperson](https://github.com/jumperson) ([#166](https://github.com/deepmedia/Transcoder/pull/166)) diff --git a/lib-legacy/build.gradle.kts b/lib-legacy/build.gradle.kts index aae3c91c..e7b9a926 100644 --- a/lib-legacy/build.gradle.kts +++ b/lib-legacy/build.gradle.kts @@ -28,7 +28,7 @@ deployer { projectInfo { groupId = "com.otaliastudios" artifactId = "transcoder" - release.version = "0.11.1" // change :lib and README + release.version = "0.11.2" // change :lib and README 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://opensource.deepmedia.io/transcoder" scm.fromGithub("deepmedia", "Transcoder") diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 7770af4e..ecf39815 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -63,7 +63,7 @@ deployer { projectInfo { groupId = "io.deepmedia.community" artifactId = "transcoder-android" - release.version = "0.11.1" // change :lib-legacy and README + release.version = "0.11.2" // change :lib-legacy and README 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://opensource.deepmedia.io/transcoder" scm.fromGithub("deepmedia", "Transcoder") diff --git a/lib/src/androidTest/assets/issue_75/bbb_720p_30mb.mp4 b/lib/src/androidTest/assets/issue_75/bbb_720p_30mb.mp4 new file mode 100644 index 00000000..f29424ee Binary files /dev/null and b/lib/src/androidTest/assets/issue_75/bbb_720p_30mb.mp4 differ diff --git a/lib/src/androidTest/java/com/otaliastudios/transcoder/integration/IssuesTests.kt b/lib/src/androidTest/java/com/otaliastudios/transcoder/integration/IssuesTests.kt index 0cc3ffa9..1ed497a8 100644 --- a/lib/src/androidTest/java/com/otaliastudios/transcoder/integration/IssuesTests.kt +++ b/lib/src/androidTest/java/com/otaliastudios/transcoder/integration/IssuesTests.kt @@ -14,6 +14,7 @@ import com.otaliastudios.transcoder.source.AssetFileDescriptorDataSource import com.otaliastudios.transcoder.source.BlankAudioDataSource import com.otaliastudios.transcoder.source.ClipDataSource import com.otaliastudios.transcoder.source.FileDescriptorDataSource +import com.otaliastudios.transcoder.strategy.DefaultAudioStrategy import com.otaliastudios.transcoder.strategy.DefaultVideoStrategy import com.otaliastudios.transcoder.validator.WriteAlwaysValidator import org.junit.Assume @@ -135,4 +136,19 @@ class IssuesTests { } Unit } + + @Test(timeout = 16000) + fun issue75_workaround() = with(Helper(75)) { + transcode { + val vds = input("bbb_720p_30mb.mp4") + addDataSource(ClipDataSource(vds, 0, 500_000)) + setVideoTrackStrategy(DefaultVideoStrategy.exact(300, 300).build()) + // API 23: + // This video seems to have wrong number of channels in metadata (6) wrt MediaCodec decoder output (2) + // so when using DefaultAudioStrategy.CHANNELS_AS_INPUT we target 6 and try to upscale from 2 to 6, which fails + // The workaround below explicitly sets a number of channels different than CHANNELS_AS_INPUT to make it work + // setAudioTrackStrategy(DefaultAudioStrategy.builder().channels(1).build()) + } + Unit + } } \ No newline at end of file diff --git a/lib/src/main/java/com/otaliastudios/transcoder/internal/audio/remix/AudioRemixer.kt b/lib/src/main/java/com/otaliastudios/transcoder/internal/audio/remix/AudioRemixer.kt index 3458cd0e..1810d0a6 100644 --- a/lib/src/main/java/com/otaliastudios/transcoder/internal/audio/remix/AudioRemixer.kt +++ b/lib/src/main/java/com/otaliastudios/transcoder/internal/audio/remix/AudioRemixer.kt @@ -23,11 +23,11 @@ internal interface AudioRemixer { companion object { internal operator fun get(inputChannels: Int, outputChannels: Int): AudioRemixer = when { + inputChannels == outputChannels -> PassThroughAudioRemixer() inputChannels !in setOf(1, 2) -> error("Input channel count not supported: $inputChannels") - outputChannels !in setOf(1, 2) -> error("Output channel count not supported: $inputChannels") + outputChannels !in setOf(1, 2) -> error("Output channel count not supported: $outputChannels") inputChannels < outputChannels -> UpMixAudioRemixer() - inputChannels > outputChannels -> DownMixAudioRemixer() - else -> PassThroughAudioRemixer() + else -> DownMixAudioRemixer() } } } \ No newline at end of file