Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
21st March 2021, 09:40 | #1 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
AviSynth not working on Linux
Hi, people.
Just a short history before my question. I have been using AviSynth/AviSynth+ on Windows quite heavily with Audacity being my sound editor and VirtualDub - a renderer. At some point I fully switched to Linux (currently it's ArchLinux). Then I discovered there is AviSynth+ fork for Linux! But it does not work for me apart from a basic test... Among piles of stuff on the web I found, for example, this guide: https://github.com/AviSynth/AviSynth...ting/posix.rst. I use ArchLinux, so I got all the packages (didn't need to compile anything manually). My ffmpeg configuration includes --enable-avisynth flag. Version() works when I do "ffplay script.avs" As for FFMS2, trying "FFVideoSource('file')" produced only -- Script error: There is no function named 'FFVideoSource'. And with with the recent install of avisynthplus I get: Cannot load file '/usr/lib/avisynth/libimageseq.so' when I run "ffplay -i test.avs". The .so file actually exists... Thanks for any help in advance. |
22nd March 2021, 13:50 | #2 | Link | |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Quote:
This assumes you have a FFVideoSource plugin compiled. Cu Selur |
|
23rd March 2021, 08:23 | #3 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
Perhaps, I need a different AVISYNTH+ package...
I tried various combinations of: AddAutoloadDir("...") LoadPlugin(".../libimageseq.so") It tries the right file (judging by the path -- I actually tried copying the .so file around), but the output is always the same (except for the path on the "Cannot load file" line): [verbose] Initialized opengl renderer. [NULL @ 0x7f001c000bc0] [debug] Opening 'film-test-linux.avs' for reading [file @ 0x7f001c0017c0] [debug] Setting default whitelist 'file,crypto,data' [avisynth @ 0x7f001c000bc0] [debug] Format avisynth probed with size=2048 and score=50 [avisynth @ 0x7f001c000bc0] [error] Cannot load file '/usr/lib/avisynth/libimageseq.so'. (film-test-linux.avs, line 4) [AVIOContext @ 0x7f001c009b80] [verbose] Statistics: 1596 bytes read, 0 seeks [error] film-test-linux.avs: Unknown error occurred Last edited by forgetfool; 23rd March 2021 at 08:28. |
23rd March 2021, 13:42 | #4 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
ImageSeq requires DevIL, which apparently is only listed as an optional dependency.
Code:
pacman -S community/devil |
23rd March 2021, 18:29 | #5 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
THANKS! DevIL moved me further. Now I get
[verbose] Initialized opengl renderer. [NULL @ 0x7ff65c000bc0] [debug] Opening 'film-test-linux.avs' for reading [file @ 0x7ff65c0017c0] [debug] Setting default whitelist 'file,crypto,data' [avisynth @ 0x7ff65c000bc0] [debug] Format avisynth probed with size=2048 and score=50 [info] nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 ...and it hangs forever. Is this the deadlock you've mentioned? Btw, before your message I gave up and tried AUR avisynthplus-git and fmms2-git. That got me the same result as now (i.e. with latest + DevIL) |
24th March 2021, 04:07 | #6 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
Yup.
https://github.com/FFMS/ffms2/issues/369 You can test that you really get video by invoking ImageSource (since DevIL is installed now, so ImageSeq will work) to open a JPG or PNG. Essentially, FFmpeg is built as shared. FFMS2 links to it, so it's going to use FFmpeg's shared libraries. FFmpeg loads AviSynth+, which (when using FFMS2) loads FFMS2. So FFmpeg is confronted with both itself linked to its own libraries and dlopened FFMS2 linking to those same libraries, and the process stalls (sometimes; see my response there and in the issue on AviSynth+'s issues tracker that I reference). The most direct way to avoid that conflict is to make sure the FFmpeg libraries FFMS2 uses don't overlap with the system libraries, which is both good and (kind of) bad. Good, because in reality FFMS2 doesn't *need* a lot of those things enabled in FFmpeg, so using a build of FFmpeg for FFMS2 that only enables what it needs results in a much faster build process and a smaller FFMS2. Bad, because static linking is usually viewed as a huge no-no due to the maintenance burden of having to rebuild the entire thing when the underlying libraries need to update (although you'd still have to build FFmpeg again anyway, and FFMS2 is very small). Further, if you don't want that static version of FFMS2 conflicting with the version from the repo, you can build it but not install it to the system. AviSynth+ accepts both ~/.avisynth and ~/.local/lib/avisynth as directories to stash user-specific plugins in, although I haven't really tested to see whether those take absolute precedence over the presence of a symlink to the system FFMS2 in /usr/lib/avisynth. As I mentioned, though, avs2yuv can work fine with the Community packages of all of these; the only downside is that you have to pipe rather than opening in FFmpeg or mpv directly (it wouldn't be such a problem if we had a NUT-producing pipe tool in the AviSynth+ tree). |
24th March 2021, 14:55 | #7 | Link | |
Guest
Posts: n/a
|
Quote:
Code:
#Ubuntu PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig \ CPPFLAGS="-I/usr/local/include/avisynth" \ ./autogen.sh --enable-shared --enable-avisynth && \ make -j$(nproc) && \ sudo checkinstall --pkgname=ffms2 --pkgversion="1:$(./version.sh)-git" \ --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --stripso=yes \ --addso=yes --fstrans=no --default Code:
#Ubuntu ./configure --prefix=$HOME/ffmpeg_build --enable-gpl --enable-version3 \ --disable-doc --disable-debug --enable-pic --enable-avisynth && \ make -j$(nproc) && \ make install |
|
24th March 2021, 16:02 | #8 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
It's not entirely the way I wrote the guide. The guide assumes you're building FFmpeg for a distro that doesn't actually use --enable-avisynth, so it's a fully functional build of FFmpeg (albeit lacking many of the external libraries it can use). But because the FFmpeg is built static, that's the more important part as far as FFMS2 is concerned. The 'minimal' FFmpeg I'm referring to in the case of something specifically for FFMS2 (or L-SMASH-Works, same deal) is this:
Code:
cd ffmpeg && \ mkdir ffmpeg-build-for-ffms2 && \ cd ffmpeg-build-for-ffms2 && \ ../../configure \ --prefix=$HOME/ffmpeg_build_for_ffms2 \ --enable-gpl \ --enable-version3 \ --disable-encoders \ --disable-muxers \ --disable-doc \ --disable-debug \ --disable-devices \ --disable-avdevice \ --enable-libdav1d \ --extra-cflags="-march=native" && \ make -j$(nproc) && \ make install At which point you'd simply change the PKG_CONFIG_PATH given to FFMS2 to $HOME/ffmpeg_build_for_ffms2/lib/pkgconfig. |
24th March 2021, 17:55 | #9 | Link |
Guest
Posts: n/a
|
Apologies! I was focusing on the "building ffms2 against an ffmpeg that is not installed to the system" part and overlooked that you had specified a minimal, static build. My bad.
EDIT: In addition to the above, I cleared the "Unknown error occurred" message by copying the .so files (symlinking would probably have done) from /use/lib/local/ to $HOME/.local/lib/avisynth ( $HOME/.avisynth did not work, probably because of needing root permissions), pointing AddAutoloadDir() to that, and specifying an absolute file-path: FFVideoSource("/home/user/file.mkv"). Last edited by Richard1485; 26th March 2021 at 11:43. |
26th March 2021, 18:16 | #10 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
So I've built FFmpeg as mentioned by qyot27. Then I've built ffms2 (just did make install, as I don't have checkinstall). Even did all the stuff mentioned in the last message by Richard1485 (I only copied one file libfmms2.so, as nothing else I have is applicable I think).
On ffplay my avs script all I get is [verbose] Initialized opengl renderer. [NULL @ 0x7f4600000bc0] [debug] Opening 'film-test-linux.avs' for reading [file @ 0x7f46000017c0] [debug] Setting default whitelist 'file,crypto,data' [avisynth @ 0x7f4600000bc0] [debug] Format avisynth probed with size=2048 and score=50 [AVIOContext @ 0x7f4600009b80] [verbose] Statistics: 1680 bytes read, 0 seeks [error] film-test-linux.avs: Unknown error occurred - and exit (not a hang this time). I get this even if I comment every single line of my avs script!!! Btw, I am having vapoursynth trouble with libffms2.so in this thread: https://forum.doom9.org/showthread.p...93#post1939093 Last edited by forgetfool; 26th March 2021 at 18:25. |
26th March 2021, 19:14 | #11 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
Ok, I was using the wrong ffplay. The one in /usr/bin, not the one just build in /usr/local/bin...
Now with restart of the shell I get the following output (my script is only running Version()): [verbose] Initialized opengl renderer. [NULL @ 0x7f5e6c000c80] [debug] Opening 'film-test-linux.avs' for reading [file @ 0x7f5e6c001980] [debug] Setting default whitelist 'file,crypto,data' [avs2 @ 0x7f5e6c000c80] [warning] Format avs2 detected only with low score of 1, misdetection possible! [avs2 @ 0x7f5e6c000c80] [debug] Before avformat_find_stream_info() pos: 0 bytes read:1693 seeks:0 nb_streams:1 [avs2 @ 0x7f5e6c000c80] [warning] Could not find codec parameters for stream 0 (Video: avs2, 1 reference frame, none): unspecified size Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [avs2 @ 0x7f5e6c000c80] [debug] After avformat_find_stream_info() pos: 1693 bytes read:1693 seeks:0 frames:1 [info] Input #0, avs2, from 'film-test-linux.avs': [info] Duration: N/A, bitrate: N/A [info] Stream #0:0, 1, 1/1200000: Video: avs2, 1 reference frame, none, 1200k tbr, 1200k tbn, 1200k tbc [warning] No decoder could be found for codec avs2 [fatal] Failed to open file 'film-test-linux.avs' or configure filtergraph [AVIOContext @ 0x7f5e6c009dc0] [verbose] Statistics: 1693 bytes read, 0 seeks |
26th March 2021, 20:41 | #12 | Link | |
Guest
Posts: n/a
|
Quote:
EDIT: ffplay might be mistaking the extension for a format, but that shouldn't happen if it is built with --enable-avisynth. I didn't know that mainstream ffmpeg even knew to look for avs2, but I guess it's been added. Last edited by Richard1485; 26th March 2021 at 21:58. |
|
27th March 2021, 06:40 | #13 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
Ok, I started all over. (Deleted all the old stuff.)
AviSynth+ --------- git clone git://github.com/AviSynth/AviSynthPlus.git cd AviSynthPlus mkdir avisynth-build cd avisynth-build cmake ../ -G Ninja ninja su ninja install FFmpeg ------ git clone git://git.ffmpeg.org/ffmpeg.git cd ffmpeg mkdir ffmpeg-build-for-ffms2 cd ffmpeg-build-for-ffms2 ../configure \ --prefix=$HOME/ffmpeg_build_for_ffms2 \ --enable-gpl \ --enable-version3 \ --disable-encoders \ --disable-muxers \ --disable-doc \ --disable-debug \ --disable-devices \ --disable-avdevice \ --enable-libdav1d \ --extra-cflags="-march=native" make -j$(nproc) su make install Test 1 ------- nano test.avs Version() ./ffplay -i test.avs [info] ffplay version N-101739-gcad3a5d715 Copyright (c) 2003-2021 the FFmpeg developers [info] built with gcc 10.2.0 (GCC) [info] configuration: --prefix=/home/user1/ffmpeg_build_for_ffms2 --enable-gpl --enable-version3 --disable-encoders --disable-muxers --disable-doc --disable-debug --disable-devices --disable-avdevice --enable-libdav1d --extra-cflags='-march=native' [info] libavutil 56. 72.100 / 56. 72.100 [info] libavcodec 58.135.100 / 58.135.100 [info] libavformat 58. 77.100 / 58. 77.100 [info] libavfilter 7.111.100 / 7.111.100 [info] libswscale 5. 10.100 / 5. 10.100 [info] libswresample 3. 10.100 / 3. 10.100 [info] libpostproc 55. 10.100 / 55. 10.100 [verbose] Initialized opengl renderer. [NULL @ 0x7ff1a8000c80] [debug] Opening 'test.avs' for reading [file @ 0x7ff1a8001980] [debug] Setting default whitelist 'file,crypto,data' [avs2 @ 0x7ff1a8000c80] [warning] Format avs2 detected only with low score of 1, misdetection possible! [avs2 @ 0x7ff1a8000c80] [debug] Before avformat_find_stream_info() pos: 0 bytes read:11 seeks:0 nb_streams:1 [avs2 @ 0x7ff1a8000c80] [warning] Could not find codec parameters for stream 0 (Video: avs2, 1 reference frame, none): unspecified size Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options [avs2 @ 0x7ff1a8000c80] [debug] After avformat_find_stream_info() pos: 11 bytes read:11 seeks:0 frames:1 [info] Input #0, avs2, from 'test.avs': [info] Duration: N/A, bitrate: N/A [info] Stream #0:0, 1, 1/1200000: Video: avs2, 1 reference frame, none, 1200k tbr, 1200k tbn, 1200k tbc [warning] No decoder could be found for codec avs2 [fatal] Failed to open file 'test.avs' or configure filtergraph [AVIOContext @ 0x7ff1a8009dc0] [verbose] Statistics: 11 bytes read, 0 seeks Any suggestion what to try? THANKS ! |
27th March 2021, 07:14 | #14 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
And if I follow this guide: https://github.com/AviSynth/AviSynth...ting/posix.rst, up to test installation with Version(), I get just this:
[info] ffplay version N-101739-gcad3a5d715 Copyright (c) 2003-2021 the FFmpeg developers [info] built with gcc 10.2.0 (GCC) [info] configuration: --enable-gpl --enable-version3 --disable-doc --disable-debug --enable-pic --enable-avisynth --cc=cc [info] libavutil 56. 72.100 / 56. 72.100 [info] libavcodec 58.135.100 / 58.135.100 [info] libavformat 58. 77.100 / 58. 77.100 [info] libavdevice 58. 14.100 / 58. 14.100 [info] libavfilter 7.111.100 / 7.111.100 [info] libswscale 5. 10.100 / 5. 10.100 [info] libswresample 3. 10.100 / 3. 10.100 [info] libpostproc 55. 10.100 / 55. 10.100 [verbose] Initialized opengl renderer. [NULL @ 0x7f9b14000c80] [debug] Opening 'test.avs' for reading [file @ 0x7f9b14001980] [debug] Setting default whitelist 'file,crypto,data' [avisynth @ 0x7f9b14000c80] [debug] Format avisynth probed with size=2048 and score=50 [AVIOContext @ 0x7f9b14009dc0] [verbose] Statistics: 11 bytes read, 0 seeks [error] test.avs: Unknown error occurred I don't think any AddAutoLoadDir() is needed for just Version(), right? So I went back to previous ../configure options. I think we didn't get something right in ffmpeg configure... Last edited by forgetfool; 27th March 2021 at 08:04. |
27th March 2021, 12:18 | #15 | Link | ||
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
Quote:
Quote:
Code:
ls -l /usr/local/lib/libavisynth* Or much more easily: 1) Install AviSynth+ and FFmpeg from the Community repo. 2) Build/install minimal FFmpeg as listed above 3) Build/install FFMS2, directing PKG_CONFIG_PATH to the minimal FFmpeg and installing it to $HOME/.local: Code:
PKG_CONFIG_PATH=$HOME/ffmpeg_build_for_ffms2/lib/pkgconfig \ CPPFLAGS="-I/usr/include/avisynth" \ ./autogen.sh --prefix=$HOME/.local --libdir=$HOME/.local/lib/avisynth --enable-shared --enable-avisynth && \ make -j$(nproc) make install You may or may not need to add $HOME/.local/bin to the $PATH in your user profile so you can use ffmsindex. Do not use root permissions when installing things to your $HOME directory. That is asking for trouble. |
||
21st June 2022, 18:21 | #17 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
Only two years have passed, and I back with a problem. For a while I was doing what qyot27 suggested (see the message below about updating FFMS2 and repeating steps 2 & 3), everything was working fine until lately, when I tried to rebuild things.
FFMPEG built, FFMS2 didn't with the following error: Code:
CXXLD src/core/libffms2.la /usr/bin/ld: /home/romashka/ffmpeg_build_for_ffms2/lib/libswscale.a(swscale.o): warning: relocation against `ff_M24B' in read-only section `.text' /usr/bin/ld: /home/romashka/ffmpeg_build_for_ffms2/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make: *** [Makefile:653: src/core/libffms2.la] Error 1 Code:
CXXLD src/core/libffms2.la CXXLD src/index/ffmsindex /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_toupper4' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_ac3_channel_layout_tab' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_bits_dc_luminance' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_val_ac_chrominance' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_val_dc' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mpeg4audio_sample_rates' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_val_ac_luminance' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_bits_ac_luminance' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mpa_freq_tab' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_bits_dc_chrominance' /usr/bin/ld: src/core/.libs/libffms2.so: undefined reference to `ff_mjpeg_bits_ac_chrominance' collect2: error: ld returned 1 exit status make: *** [Makefile:665: src/index/ffmsindex] Error 1 I then did the make install, as usually. BUT! When I run my avs script now, I get the following: Code:
Cannot load file '/home/romashka/.local/lib/avisynth/libffms2.so'. Reason: /home/romashka/.local/lib/avisynth/libffms2.so: undefined symbol: ff_mjpeg_val_ac_chrominance (film.avs, line 20) film.avs: Unknown error occurred Can someone please help? |
21st June 2022, 18:32 | #19 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,545
|
I would inspect that path '/home/romashka/.local/lib/avisynth/libffms2.so'
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." |
22nd June 2022, 00:41 | #20 | Link |
Registered User
Join Date: Aug 2020
Posts: 33
|
What do you mean by inspect? That's the path were I am building FFMS2 based on the minimal install of FFMPEG. That's how it all worked for me for a while. Perhaps, I am using a wrong version of something? Perhaps, the newest libavisynth.so.9 is the problem (before it all worked with libavisynth.so.8). Maybe I need to go back to older ffmpeg?
And the main avisynthplus still does not work causing a deadlock, as descibed earlier in this thread. Can it really be that no one is using avisynthplus on linux? |
Tags |
linux |
Thread Tools | Search this Thread |
Display Modes | |
|
|