lucianodato / speech-denoiser

A speech denoise lv2 plugin based on RNNoise library
GNU Lesser General Public License v3.0
287 stars 29 forks source link

cannot load plugin using ffmpeg lv2 #16

Open adaviding opened 5 years ago

adaviding commented 5 years ago

I'm on Ubuntu 19.04, and I successfully built and installed your sdenoise.lv2 plugin from your master branch. I have also installed ffmpeg which can allegedly transform audio files using an installed lv2 filter.

Presumably the command to use your filter is ...

ffmpeg -i $INPUT -af lv2=plugin=https\\\\://github.com/lucianodato/speech-denoiser $OUTPUT

... but it gives me an Error initializing filter 'lv2' with args 'plugin=https://github.com/lucianodato/speech-denoiser' error:

ding@ding-linux-03:~/Desktop/denoise$ INPUT=/data/sample_car.wav
ding@ding-linux-03:~/Desktop/denoise$ OUTPUT=/data/sample_car.sdenoise.wav
ding@ding-linux-03:~/Desktop/denoise$ docker run \
> --mount type=bind,src=/home/ding/Desktop/denoise-data,dst=/data \
> denoise \
> "ffmpeg -i $INPUT -af lv2=plugin=https\\\\://github.com/lucianodato/speech-denoiser $OUTPUT"
ffmpeg version 4.1.3-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Ubuntu 8.3.0-6ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '/data/sample_car.wav':
  Metadata:
    encoder         : Lavf58.12.100
  Duration: 00:01:05.02, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
error: attempt to map invalid URI `https'
[lv2 @ 0x561771d961c0] Invalid plugin URI <https>
[AVFilterGraph @ 0x561771d4ebc0] Error initializing filter 'lv2' with args 'plugin=https://github.com/lucianodato/speech-denoiser'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

BTW, here is the Dockerfile that I used get this ffmpeg command ready.

FROM ubuntu:19.04

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
 && apt-get install --yes apt-utils \
 && apt-get install --yes ffmpeg build-essential cmake git python3 python3-pip ninja-build \
                          dh-autoreconf pkg-config lv2-dev

RUN pip3 install meson

# --------------------------------
# lv2 speech-denoiser
# --------------------------------
RUN mkdir -p /github/lucianodato/speech-denoiser
WORKDIR /github/lucianodato/speech-denoiser
RUN chmod -R a+rwx . \
 && git clone https://github.com/lucianodato/speech-denoiser.git .

RUN chmod +x install.sh \
 && ./install.sh

# --------------------------------
# data folder
# --------------------------------
RUN mkdir /data \
 && chmod -R a+rwx /data

WORKDIR /data

ENTRYPOINT ["/bin/bash", "-c"]

And here are the actual docker commands that I used:

docker build --tag denoise:latest .
INPUT=/data/sample_car.wav
OUTPUT=/data/sample_car.sdenoise.wav
docker run \
    --mount type=bind,src=/home/ding/Desktop/denoise-data,dst=/data \
    denoise \
    "ffmpeg -i $INPUT -af lv2=plugin=https\\\\://github.com/lucianodato/speech-denoiser $OUTPUT"
adaviding commented 5 years ago

Update: In my original post, the error was because of a command-line parsing bug with ffmpeg. After fixing that bug ...

ffmpeg -i $INPUT -af 'lv2=plugin=https\\://github.com/lucianodato/speech-denoiser' $OUTPUT

... I know have a new Plugin <https://github.com/lucianodato/speech-denoiser> not found error:

root@b88297120832:/data# ffmpeg -i $INPUT -af 'lv2=plugin=https\\://github.com/lucianodato/speech-denoiser' $OUTPUT
ffmpeg version 4.1.3-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Ubuntu 8.3.0-6ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '/data/sample_car.wav':
  Metadata:
    encoder         : Lavf58.12.100
  Duration: 00:01:05.02, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
File '/data/sample_car.sdenoise.wav' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[lv2 @ 0x55613f407300] Plugin <https://github.com/lucianodato/speech-denoiser> not found
[AVFilterGraph @ 0x55613f3e7140] Error initializing filter 'lv2' with args 'plugin=https\://github.com/lucianodato/speech-denoiser'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

Also, for completeness: The docker run command from my original post can be restated as follows.

INPUT=/data/sample_car.wav
OUTPUT=/data/sample_car.sdenoise.wav
docker run \
    --mount type=bind,src=$(pwd),dst=/data \
    denoise \
    "ffmpeg -i $INPUT -af 'lv2=plugin=https\\\\://github.com/lucianodato/speech-denoiser' $OUTPUT"
adaviding commented 5 years ago

BTW, I installed lilv-utils so I could execute lv2ls and it shows that I have no plugins installed on my system. But I can see the files there.

root@22f908a93c0b:/data# ll /usr/local/lib/lv2/sdenoise.lv2
total 160
drwxr-xr-x 2 root root   4096 May  9 21:55 ./
drwxr-xr-x 3 root root   4096 May  9 21:55 ../
-rwxr-xr-x 1 root root    229 May  9 21:55 manifest.ttl*
-rwxr-xr-x 1 root root 147216 May  9 21:55 sdenoise.so*
-rwxr-xr-x 1 root root   1991 May  9 21:55 sdenoise.ttl*

So perhaps there is something wrong with the manifest.ttl file?

lucianodato commented 5 years ago

Hi! thanks for reporting this issue. I'll look into it but right now I'm migrating both this plugin and noise repellent to distrho framework. This will make the installation process much more simple and it'll allow me to not only distribute lv2 but vsts as well and for all platforms. I'll be working on these in the next couple of weeks.

vchepeli commented 4 years ago

@adaviding you need to add environment variable also LV2_PATH in Dockerfile

FROM ubuntu:19.04

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive
ENV LV2_PATH=/usr/local/lib/lv2:/usr/lib/lv2

RUN apt-get update \
 && apt-get install --yes apt-utils \
 && apt-get install --yes ffmpeg build-essential cmake git python3 python3-pip ninja-build \
                          dh-autoreconf pkg-config lv2-dev

RUN pip3 install meson

# --------------------------------
# lv2 speech-denoiser
# --------------------------------
RUN mkdir -p /github/lucianodato/speech-denoiser
WORKDIR /github/lucianodato/speech-denoiser
RUN chmod -R a+rwx . \
 && git clone https://github.com/lucianodato/speech-denoiser.git .

RUN chmod +x install.sh \
 && ./install.sh

# --------------------------------
# data folder
# --------------------------------
RUN mkdir /data \
 && chmod -R a+rwx /data

WORKDIR /data

ENTRYPOINT ["/bin/bash", "-c"]

In this case lv2ls command should not be empty and returns plugin URL

root@354ae6dd9e5d:/workspace/data# lv2ls
https://github.com/lucianodato/speech-denoiser

Cheers,