plugdata icon indicating copy to clipboard operation
plugdata copied to clipboard

Cannot use plugdata compiled lv2 plugin in ecasound and ffmpeg

Open hellocatfood opened this issue 1 year ago • 5 comments

I am trying to do some batch processing using an lv2 plugin generated by plugdata via both ffmpeg and ecasound. Both of these are capable of running lv2 plugins. See details here:

https://ffmpeg.org/ffmpeg-all.html#lv2 https://ecasound.seul.org/ecasound/Documentation/examples.html#lv2

To test this I generated a simple plugin that just has an [adc~] connected to [dac~]

lv2test.zip

And generated this plugin

lv2test.lv2.zip

In ffmpeg when I ran ffmpeg -y -i in.wav -af 'lv2=p=urn\\:hvcc\\:lv2test' out.wav it gave me the following output

ffmpeg version 7.0.2-3ubuntu1 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14 (Ubuntu 14.2.0-2ubuntu1)
  configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared --enable-version3 --disable-doc --disable-programs --disable-static --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[aist#0:0/pcm_s16le @ 0x621db7d797c0] Guessed Channel Layout: stereo
Input #0, wav, from 'in.wav':
  Metadata:
	encoder         : Lavf60.3.100 (libsndfile-1.0.31)
	Software        : Lavf60.3.100
  Duration: 00:00:02.00, 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
Options feature missing, cannot continue!
[lv2 @ 0x7dfa48004a40] Failed to instantiate <urn:hvcc:lv2test>
[Parsed_lv2_0 @ 0x7dfa48004940] Failed to configure output pad on Parsed_lv2_0
[af#0:0 @ 0x621db7d28300] Error reinitializing filters!
[af#0:0 @ 0x621db7d28300] Task finished with error code: -22 (Invalid argument)
[af#0:0 @ 0x621db7d28300] Terminating thread with return code -22 (Invalid argument)
[aost#0:0/pcm_s16le @ 0x621db7d27e40] Could not open encoder before EOF
[aost#0:0/pcm_s16le @ 0x621db7d27e40] Task finished with error code: -22 (Invalid argument)
[aost#0:0/pcm_s16le @ 0x621db7d27e40] Terminating thread with return code -22 (Invalid argument)
[out#0/wav @ 0x621db7d27700] Nothing was written into output file, because at least one of its streams received no packets.
size=       0KiB time=N/A bitrate=N/A speed=N/A    
Conversion failed!

In ecasound I ran the following command ecasound -i in.wav -o out.wav -elv2:urn:hvcc:lv2test which gave me this output error

**************************************************************************
* ecasound v2.9.3 (C) 1997-2020 Kai Vehmanen and others    
**************************************************************************
(eca-object-factory) ERROR: Unable to find LV2 plugin "urn:hvcc:lv2test"
(eca-chainsetup-parser) WARNING: Only 2+0 of the expected 4 parameters were
... recognized successfully.
(eca-chainsetup) Chainsetup "untitled-chainsetup"
---
ecasound: ERROR: [ECA-SESSION] : "Invalid argument, unable to parse: "-elv2:urn:hvcc:lv2test""

(I also tried escaping the :'s in that same command.

hellocatfood avatar Jan 07 '25 17:01 hellocatfood

First off:

This is not a bug with plugdata, we only provide this integrated toolchain but it is not part of the plugdata code-base.

Bug reports should ideally be reported upstream as that is where bugs would be fixed. In this case "upstream" is the hvcc project: https://github.com/Wasted-Audio/hvcc

Second:

I'm able to reproduce, but I've never used LV2 plugins with ffmpeg or ecasound. Have you used this feature before?

Seems rather obscure, but I see that ffmpeg uses lilv2 for it's LV2 hosting and jalv.gtk (the standard lilv test tool for LV2 plugins) can load it just fine.

There isn't really any error that gives us a clue of what is going wrong here. Also I get exactly the same result with other LV2 plugins, so I'm inclined to say the problem is with ffmpeg.

dromer avatar Jan 07 '25 18:01 dromer

Apologies, I didn't realise hvcc was responsible for compiling the plugins. I'll be sure to report there if there are any other issues.

Yes, I have used the function with both ecasound and ffmpeg. These two work for me:

ffmpeg -y -i in.wav -af 'lv2=p=http\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5' out.wav This was modified from the ffmpeg examples on their website

and the same plugin in ecasound

ecasound -i in.wav -elv2:http://calf.sourceforge.net/plugins/Vinyl,0,1,1,0.2,0.5 -o out.wav

hellocatfood avatar Jan 07 '25 20:01 hellocatfood

Yeah I was able to use the command with some plugins, but many others failed the same. So I'm not sure what ffmpeg requires to fully function using this ..

dromer avatar Jan 07 '25 21:01 dromer

Ok, thanks. I'll report this on ffmpeg's issue tracker.

Did you have success or thoughts about ecasound?

hellocatfood avatar Jan 07 '25 22:01 hellocatfood

Sorry I have no experience with ecasound.

The fact that it says "Invalid argument, unable to parse" seems to indicate that the argument is incorrect.

dromer avatar Jan 08 '25 07:01 dromer