From 27596adef758de908df0926fe5502ea4b17196df Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Mon, 27 May 2024 20:41:15 +0300 Subject: [PATCH] downgrade ffmpeg (fixes segfault & mono <-> stereo conversion bugs) --- Dockerfile | 7 ++++--- README.md | 4 ++-- src/transcoder.rs | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index bf7db89..fba4437 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,9 +23,10 @@ RUN apk add --no-cache \ gnutls-dev && \ mkdir -p /ffmpeg/{ffmpeg_build,bin} && \ cd /ffmpeg && \ - wget -O ffmpeg-7.0.1.tar.bz2 https://ffmpeg.org/releases/ffmpeg-7.0.1.tar.bz2 && \ - tar xjvf ffmpeg-7.0.1.tar.bz2 && \ - cd ffmpeg-7.0.1 && \ + export FFMPEG_VERSION=6.1.1 && \ + wget -O ffmpeg-$FFMPEG_VERSION.tar.bz2 https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 && \ + tar xjvf ffmpeg-$FFMPEG_VERSION.tar.bz2 && \ + cd ffmpeg-$FFMPEG_VERSION && \ PKG_CONFIG_PATH="/ffmpeg/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="/ffmpeg/ffmpeg_build" \ --pkg-config-flags="--static" \ diff --git a/README.md b/README.md index de82ef4..570cb25 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,9 @@ You can change configuration using this environment variables: - [x] Remove old conversion results and input files that are older than 1 hour. - [x] Remove input file after transcoding it. - [x] Do not upload files directly, add download route with streaming instead. +- [x] Conversion from OGG Opus mono to HE-AAC v1 Stereo outputs high-pitched crackling audio. +- [x] Conversion from OGG Opus mono to AAC sometimes crashes the app with SIGSEGV (this can be seen more often with very short audio). - [ ] If FFmpeg fails, `send_error` won't be called - fix that. - [ ] Default errors are returned in plain text. Change it to the JSON. -- [ ] Conversion from OGG Opus mono to HE-AAC v1 Stereo outputs high-pitched crackling audio. -- [ ] Conversion from OGG Opus mono to AAC sometimes crashes the app with SIGSEGV (this can be seen more often with very short audio). - [ ] Docker image for `amd64` and `arm64` (currently only `amd64` is supported because `arm64` cross-compilation with QEMU is sloooooooooooowwwww...). - [ ] Tests! \ No newline at end of file diff --git a/src/transcoder.rs b/src/transcoder.rs index 6a5348e..610be79 100644 --- a/src/transcoder.rs +++ b/src/transcoder.rs @@ -70,6 +70,9 @@ impl Transcoder { encoder.set_rate(sample_rate); encoder.set_channel_layout(params.channel_layout); + #[cfg(not(feature = "ffmpeg_7_0"))] + encoder.set_channels(params.channel_layout.channels()); + encoder.set_format( codec .formats()