View Full Version : avs2pipemod for Linux?
MysteryX
13th July 2022, 00:02
I'm currently working on modernizing a .NET library that, among other things, allows you to run an Avisynth script through FFmpeg.
That feature is using avs2pipemod.
Now I'm making this library cross-platform.
Is there such a thing in Linux? How do you feed an Avisynth script through FFmpeg?
MysteryX
13th July 2022, 00:24
As a bonus question, although not directly Avisynth. Running this on Linux gives me this...
x264 --preset ultrafast -o "Out.mp4" "Feline Power Muxed.mp4"
raw [error]: raw input requires a resolution.
x264 [error]: could not open input file `Feline Power Muxed.mp4' via any method!
mp4 [error]: failed to finish movie.
Why?
poisondeathray
13th July 2022, 00:28
As a bonus question, although not directly Avisynth. Running this on Linux gives me this...
x264 --preset ultrafast -o "Out.mp4" "Feline Power Muxed.mp4"
raw [error]: raw input requires a resolution.
x264 [error]: could not open input file `Feline Power Muxed.mp4' via any method!
mp4 [error]: failed to finish movie.
Why?
Your x264 binary needs to be compiled with lavf or ffms2 support
--demuxer lavf
Is there such a thing in Linux? How do you feed an Avisynth script through FFmpeg?
I though avisynth works on linux now ? Can linux ffmpeg binaries be complied with avs support ? Windows ffmpeg binaries often do
MysteryX
13th July 2022, 00:51
I could try installing x264-git from the AUR (on Arch-based linux), but a LOT of applications depend on x264, and when I try to install it...
╰─λ paru -S x264-git --noconfirm
:: Resolving dependencies...
:: Calculating conflicts...
:: Calculating inner conflicts...
:: Conflicts found:
x264-git: x264 (libx264) x264 x264 (libx264)
:: Conflicting packages will have to be confirmed manually
error: can not install conflicting packages with --noconfirm
As I'm testing the code on Linux, Vapoursynth to FFmpeg just works; whereas Avisynth and x264 will need some tweaking to breathe.
qyot27
13th July 2022, 01:59
Install AviSynth+. Use --enable-avisynth when configuring FFmpeg. Or since you're using Arch, just install the avisynthplus (https://archlinux.org/packages/community/x86_64/avisynthplus/) (and devil (https://archlinux.org/packages/community/x86_64/devil/)) and ffmpeg (https://archlinux.org/packages/extra/x86_64/ffmpeg/) packages from the Community and Extra repositories. Most of the ported plugins are in the AUR. (https://repology.org/projects/?search=avisynth)
avs2yuv (https://github.com/DJATOM/avs2yuv) runs natively as well too, which matters more when doing benchmarks, or getting around the circular deadlock when using a source filter that depends on a shared version of FFmpeg's libraries. Yes, this means that the optimal course of action for FFMS2 or LSMASHSource on Linux is to build a minimal, static version of the FFmpeg libraries and install them to a local prefix, and then link [FFMS2|LSMASHSource] to that copy with LDFLAGS="-Wl,-Bsymbolic".
MysteryX
13th July 2022, 03:26
avs2yuv is not in the AUR
Default FFMPEG does open the Avisynth file though!
but if I want to use x264 or x265 instead, then I'll need avs2yuv.
and avsmeter; does that thing work in Linux?
qyot27
13th July 2022, 09:17
You have to build avs2yuv yourself, just like you'd need to build x264 or x265-Yuuki yourself.
MysteryX
13th July 2022, 14:59
or someone would have to add avs2yuv and x264-full to the AUR (could add x265-Yuuki at the same time)
There was the case of mpv vs mpv-full; when I install mpv-full, it replaces mpv and all dependencies work fine. Not sure if x264-git AUR is configured wrong or something?
MysteryX
13th July 2022, 15:12
hum... terminated by signal SIGSEGV (Address boundary error)
"ffmpeg" -y -i "Avisynth.avs" -vcodec libx264 -an -preset ultrafast "AvisynthToFFmpeg Avisynth.mp4"
ffmpeg version n5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp
--enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype--enable-libfribidi --enable-libgsm
--enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug--enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora
-enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
--enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avisynth, from 'Avisynth.avs':
Duration: 00:00:04.17, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480, 24 fps, 24 tbr, 24 tbn
Stream #0:1: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55d73af1f240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d73af1f240] profile Constrained Baseline, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x55d73af1f240] 264 - core 164 r3081 19856cc - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1
deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1
chroma_qp_offset=0 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
keyint_min=24 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'AvisynthToFFmpeg Avisynth.mp4':
Metadata:
encoder : Lavf59.16.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 640x480, q=2-31, 24 fps, 12288 tbn
Metadata:
encoder : Lavc59.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 100 fps=0.0 q=-1.0 Lsize= 4kB time=00:00:04.12 bitrate= 7.5kbits/s speed= 123x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 47.157574%
[libx264 @ 0x55d73af1f240] frame I:1 Avg QP:20.00 size: 932
[libx264 @ 0x55d73af1f240] frame P:99 Avg QP:12.02 size: 11
[libx264 @ 0x55d73af1f240] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x55d73af1f240] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0%
[libx264 @ 0x55d73af1f240] coded y,uvDC,uvAC intra: 0.0% 0.1% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x55d73af1f240] i16 v,h,dc,p: 97% 0% 3% 0%
[libx264 @ 0x55d73af1f240] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 @ 0x55d73af1f240] kb/s:3.88
fish: Job 1, '"ffmpeg" -y -i "Avisynth.avs" -…' terminated by signal SIGSEGV (Address boundary error)
MysteryX
14th July 2022, 23:57
OK finished refactoring the library for .NET (https://github.com/mysteryx93/HanumanInstitute.FFmpeg)
All tests work in Windows; some tests do not run yet on Linux since I didn't go into custom-building the required tools. avs2yuv isn't available in the AUR, x264 needs to be compiled with additional options, and ffmpeg is giving a weird error when encoding an Avisynth script (looks like a bug since it parses the script info?)
Note that on Linux, even if I custom-build a dependency for an app, that's not a solution because when I deploy, those dependencies will also need to be custom-built for the user machine. So as it stands -- Avisynth remains unsuitable for a cross-platform app.
MysteryX
15th July 2022, 22:59
As for the FFmpeg problem, it's really a bug on the FFmpeg side so I opened a ticket there. (https://trac.ffmpeg.org/ticket/9832#ticket)
qyot27
16th July 2022, 00:42
What is the script?
MysteryX
16th July 2022, 05:52
What is the script?
BlankClip(pixel_type="YUV420", length=100, color = $AA0000)
qyot27
16th July 2022, 11:55
I can't reproduce this here, using a virtually identical build of FFmpeg n5.0.1. I also can't reproduce it with my normal build of FFmpeg from git. You could be looking at an operating system level issue with how the dependencies were built, or something like using musl instead of glibc.
MysteryX
16th July 2022, 16:21
I updated the ticket with my inxi system information (https://trac.ffmpeg.org/ticket/9832#comment:2).
Note that the output file DOES get created; but the process ends with an error.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.