Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot load plugin using ffmpeg ladspa #11

Closed
adaviding opened this issue May 9, 2019 · 7 comments
Closed

cannot load plugin using ffmpeg ladspa #11

adaviding opened this issue May 9, 2019 · 7 comments

Comments

@adaviding
Copy link

Basically I am trying to filter a file like this:

INPUT=sample_car.wav
OUTPUT=sample_car.nsfv.wav
ffmpeg -hide_banner -i $INPUT -af ladspa=file=librnnoise_ladspa.so=plugin=noise_suppressor_stereo $OUTPUT

And I get Failed to load 'librnnoise_ladspa.so=plugin=noise_suppressor_stereo':

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from '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
[Parsed_ladspa_0 @ 0x556302712680] Failed to load 'librnnoise_ladspa.so=plugin=noise_suppressor_stereo'
[AVFilterGraph @ 0x5563026e6020] Error initializing filter 'ladspa' with args 'file=librnnoise_ladspa.so=plugin=noise_suppressor_stereo'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

Here are the instructions that I followed to build and install the plugin:

Created the folder for ladspa plugins

export LADSPA_PATH=/usr/share/ladspa-plugins
sudo mkdir -p $LADSPA_PATH
sudo chmod -R a+rx $LADSPA_PATH

Built and deployed the plugin

git clone https://github.com/werman/noise-suppression-for-voice.git
cd noise-suppression-for-voice
mkdir build
cd build
cmake build ..
make
sudo cp bin/ladspa/* $LADSPA_PATH

I am using the standard ffmpeg version 3.4.6-0ubuntu0.18.04.1 built for my distro which is Linux Mint 19.1 (basically equivalent to Ubuntu 18.04); and it was built with --enable-ladspa.

@werman
Copy link
Owner

werman commented May 10, 2019

I'll try to check later what's going wrong there.

@adaviding
Copy link
Author

adaviding commented May 10, 2019

Also, I have never really deployed a LADSPA plugin before, and it is possible that I have done it incorrectly. I got rid of the LADSPA_PATH and I put a single file from your build output here: /usr/local/lib/ladspa/librnnoise_ladspa.so (which is apparently the default place to look).

That doesn't work either. Maybe I am missing a configuration step or something.

@richardpl
Copy link

Your command incarnation is simply wrong, : separates options.
Correct syntax is:
-af ladspa=file=librnnoise_ladspa.so:plugin=noise_suppressor_stereo

@adaviding
Copy link
Author

@richardpl Thank you for your suggestion. Unfortunately I tried using the colon and I got the same error.

[Parsed_ladspa_0 @ 0x564afdf5f0c0] Failed to load 'librnnoise_ladspa.so'
[AVFilterGraph @ 0x564afdf17bc0] Error initializing filter 'ladspa' with args 'file=librnnoise_ladspa.so:plugin=noise_suppressor_stereo'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

I am providing docker instructions for perfect reproducability.

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

# --------------------------------
# ladspa noise_suppressor_* plugins
# --------------------------------
RUN mkdir -p /github/werman/noise-suppression-for-voice
WORKDIR /github/werman/noise-suppression-for-voice
RUN chmod -R a+rwx . \
 && git clone https://github.com/werman/noise-suppression-for-voice.git .

RUN mkdir build
WORKDIR build
RUN cmake build .. \
 && make

RUN mkdir -p /usr/local/lib/ladspa \
 && chmod -R a+rx /usr/local/lib/ladspa \
 && cp bin/ladspa/librnnoise_ladspa.so /usr/local/lib/ladspa

# --------------------------------
# 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

RUN apt-get install --yes lilv-utils

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

WORKDIR /data

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

Here is how I built it:

docker build --tag denoise:latest .

Here is how I ran it:

INPUT=/data/sample_car.wav
OUTPUT=/data/sample_car.nsfv.wav
docker run \
  --mount type=bind,src=$(pwd),dst=/data \
  denoise \
  "ffmpeg -hide_banner -i $INPUT -af ladspa=file=librnnoise_ladspa.so:plugin=noise_suppressor_stereo $OUTPUT"

@richardpl
Copy link

Remove ".so" it is not needed.

Also if you are on x64 you need to use proper suffix.

@werman
Copy link
Owner

werman commented May 21, 2019

Remove ".so" it is not needed.

Also if you are on x64 you need to use proper suffix.

Yep, .so is not needed, I've tested and without it ffmpeg sees plugin and does its work.

@adaviding
Copy link
Author

Removing the *.so file extension worked. I did not follow the meaning of your instruction to use the proper suffix for x64. I am on x64 and the following worked for me.

INPUT=/data/sample_car.wav
OUTPUT=/data/sample_car.nsfv.wav
docker run \
  --mount type=bind,src=$(pwd),dst=/data \
  denoise \
  "ffmpeg -hide_banner -i $INPUT -af ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_stereo $OUTPUT"

And for the benefit of others who are not going through a docker container, the command would be.

ffmpeg -hide_banner -i $INPUT -af ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_stereo $OUTPUT

Thank you all for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants