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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st March 2021, 09:38   #1  |  Link
forgetfool
Registered User
 
Join Date: Aug 2020
Posts: 20
Sound Support for VapourSynth 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).

So I did my research and started using Vapoursynth. One thing I noticed at the time is that Vapoursynth did not have sound support (otherwise works like a charm). So I had to render all clips, then use ffmpeg to overlay them with the combined sound.

Recently I did my research again and on Vapoursynth site it mentions built-in sound support (via a plugin)! But... it seems it is for Windows only: https://forum.doom9.org/showthread.php?t=177623. Am I correct in this?

Trying to use vs.core.damb.Read() seems to have no effect, i.e. at does not attach sound to video, though does not fail either. What would be the reason for that?

Thanks for any help in advance.
forgetfool is offline   Reply With Quote
Old 21st March 2021, 12:45   #2  |  Link
fAy01
Registered User
 
Join Date: Jun 2010
Posts: 72
You should take a look at this thread: https://forum.doom9.org/showthread.php?t=177623
fAy01 is offline   Reply With Quote
Old 21st March 2021, 15:47   #3  |  Link
forgetfool
Registered User
 
Join Date: Aug 2020
Posts: 20
Thanks, but it does not answer either of my questions.

1) I suppose I can infer that BAS is only for Windows

2) I still don't understand why DAMB does not work
forgetfool is offline   Reply With Quote
Old 21st March 2021, 19:03   #4  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 730
Quote:
Originally Posted by forgetfool View Post
Thanks, but it does not answer either of my questions.

1) I suppose I can infer that BAS is only for Windows

2) I still don't understand why DAMB does not work
1) Maybe it's currently available only for Windows, but that should not be the case forever.

2) How do you determine that it doesn't work?
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 22nd March 2021, 19:40   #5  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 358
BAS can be compiled on Linux. I have tested it on my Debian 10 box and it worked.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 23rd March 2021, 17:44   #6  |  Link
forgetfool
Registered User
 
Join Date: Aug 2020
Posts: 20
Thanks! Do I compile it from here: https://github.com/vapoursynth/bestaudiosource? What is needed for it to compile? There are no instructions there :-)
forgetfool is offline   Reply With Quote
Old 24th March 2021, 15:54   #7  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 358
Hope I'm not missing anything
Quote:
pip3 install meson
cd bestaudiosource
meson build
ninja -C build
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 24th March 2021, 19:19   #8  |  Link
forgetfool
Registered User
 
Join Date: Aug 2020
Posts: 20
A couple of notes:

1) I found "VapourSynth4.h" (included in "vapoursynth.cpp") only in "doodle1" branch of "vapoursynth/vapoursynth" on git (and manually copied it into /usr/include/vapoursynth/)


2) The source then would not compile with an error:
"../src/vapoursynth.cpp:89:115: error: ‘nfMakeLinear’ was not declared in this scope"

Looking at VapourSynth.h vs VapourSynth4.h, I discovered the following:

typedef enum VSNodeFlags {
nfNoCache = 1,
nfIsCache = 2,
nfMakeLinear = 4 /* api 3.3 */
} VSNodeFlags;

vs

typedef enum VSNodeFlags {
nfNoCache = 1
} VSNodeFlags;

So I copied the corresponding line to "VapourSynth4.h"


3) And the main thing. "libbestsourceaudio.so" got built now, I copied it into /usr/lib/vapoursynth/, but still got a script error:
"No attribute with the name bas exists. Did you mistype a plugin namespace?"

So I tried to load the plugin explicilty by:
vs.core.std.LoadPlugin("/usr/lib/vapoursynth/libbestaudiosource.so")

And the response was "vapoursynth.Error: No entry point found in /usr/lib/vapoursynth/libbestaudiosource.so"


What do I try now?

Thanks
forgetfool is offline   Reply With Quote
Old 24th March 2021, 21:03   #9  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 358
Obviously you can't run APIv4 filter with APIv3 backend. Go all the way to compile doodle1 branch and install it. APIv3 plugins are backward compatible with APIv4 backend, not vice versa.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 25th March 2021, 17:55   #10  |  Link
forgetfool
Registered User
 
Join Date: Aug 2020
Posts: 20
Better and worse :-)


I still needed to add the line in bold for BAS to compile

typedef enum VSNodeFlags {
nfNoCache = 1,
nfMakeLinear = 4
} VSNodeFlags


BAS now loads, but I get:
File "src/cython/vapoursynth.pyx", line 2542, in vapoursynth.Function.__call__
vapoursynth.Error: Filter Source specified unknown flags


If I don't add the line above, I need to change bestaudiosource/vapoursource.cpp, line 89

from
vsapi->createAudioFilter(out, "Source", &D->AI, 1, BestAudioSourceGetFrame, BestAudioSourceFree, fmUnordered, nfMakeLinear, D, core);

to
vsapi->createAudioFilter(out, "Source", &D->AI, 1, BestAudioSourceGetFrame, BestAudioSourceFree, fmUnordered, nfNoCache, D, core);

since nfNoCache is the only flag available in V4.


Now it even starts rendering for a second, but then exists with the following:

[file] Reading from stdin...
(+) Video --vid=1 (rawvideo 1280x720 24.000fps)
VO: [gpu] 1280x720 yuv422p
V: 00:00:00 / 00:00:00 (67%) Cache: 0.0s

Exiting... (End of file)

(It is a segmentation fault.)



Is this a ffms2 problem now? (If I disable any audio stuff, the problem is still occurring)

Last edited by forgetfool; 26th March 2021 at 08:01.
forgetfool is offline   Reply With Quote
Reply

Tags
sound

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.