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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th January 2020, 22:17   #1  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
BestAudioSource

Imagine if FFAudioSource actually worked and was accurate (but a bit slow). That's what I'm going for here. Also no indexing required...

Usage:
Code:
BestAudioSource(filename, track=-1)
or
vs.core.bas.Source(filename, track=-1)

Full argument list:
[source]s[track]i[adjustdelay]i[exactsamples]b[enable_drefs]b[use_absolute_path]b[drc_scale]f[varprefix]s
Positive track numbers refer to the FFmpeg given stream number. Negative numbers refer to the nth audio track with -1 being the first.

Github release page

For you poor avisynth users it sets two variables: BASCHANNEL_LAYOUT and BASVALID_BITS that can also be prefixed if needed.

TODO:
Delay adjustment relative to other tracks is missing. This is the only feature missing relative FFMS2.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 15th September 2021 at 19:35. Reason: New version
Myrsloik is offline   Reply With Quote
Old 8th January 2020, 11:18   #2  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
Many thanks !

First test: Maybe I understood channel mapping wrong...
Decoding a spoken 6ch (5.1) .wmv test file seems to deliver one single channel's source content mapped onto all 6 outputs.

AvsPmod waveform() shows it as such.
MPC-BE64 1.5.4.4969 plays the script back and returns "Right surround" on all 6 outputs.
MPC-HC64 1.9.0 plays the script back and returns "Right surround" on all 6 outputs.
Built-in LAV Audio Decoder Status shows 6 sychronous channels.

Same content as .aiff: same result.
Same content as .ac3: same result.
track=-1 and track=0 deliver the same.

After switching the same script, same sources over to LWLibavAudioSource:
Testing .wmv, ac3, aiff: All audio channels mapped correctly.
__________________
"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..."

Last edited by Emulgator; 8th January 2020 at 11:26.
Emulgator is offline   Reply With Quote
Old 8th January 2020, 13:29   #3  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Nicely tested. New build with fixed output uploaded. There's also a new argument called exactsamples you can set to true if you want opening files to be really slow but for some reason need a completely sample exact length.

A VS version will follow shortly after the worst bugs have been dealt with.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 8th January 2020, 14:52   #4  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
I just too lazy to install avisynth, so waiting for the fist VS build to test it out.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 8th January 2020, 22:46   #5  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Since sources now hosted on github, I've built doodle1 and bas on my end and tried to run some mp4 file with it. VSPipe simply refuse to initialize environment in portable mode. So I tried to replace dlls/pyd files and core folder. Now VSPipe silently crashing for audio nodes and errors out
Quote:
Script evaluation failed:
Python exception: 'NoneType' object has no attribute 'set_output'

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2233, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2234, in vapoursynth.vpy_evaluateScript
File "R:\test_audio.vpy", line 6, in <module>
clip.set_output()
AttributeError: 'NoneType' object has no attribute 'set_output'
for video nodes.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 9th January 2020, 01:03   #6  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
The issue I have, I have a 4 hour long video and I loaded it into the script to play on mpc. When I jump to the middle while playing, mpc just kept on loading and never play. I closed the player after 30 seconds.
lansing is offline   Reply With Quote
Old 9th January 2020, 01:26   #7  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Quote:
Originally Posted by lansing View Post
The issue I have, I have a 4 hour long video and I loaded it into the script to play on mpc. When I jump to the middle while playing, mpc just kept on loading and never play. I closed the player after 30 seconds.
It uses linear decoding to be sample accurate so it is quite slow when you do that. (quite a few caching tricks and multiple decoders are used to hide it when seeking but initially it'll always be sloooooow)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 9th January 2020, 13:17   #8  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
I just realized that I forgot to put embeddable python into my portable folder, now it at least initialize. NoneType error and silent exit from BAS still present.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 9th January 2020, 13:27   #9  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Quote:
Originally Posted by DJATOM View Post
I just realized that I forgot to put embeddable python into my portable folder, now it at least initialize. NoneType error and silent exit from BAS still present.
Completely uninteresting. As I said the VS audio support is only about 80% done so not ready to use at all. Don't scare away the avisynth monkeys this source actually works for.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 9th January 2020, 13:56   #10  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Ok, sorry. I didn't knew it's that immature.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 10th January 2020, 00:41   #11  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
BestAudioSource test2: Success !
.aiff, .wmv, .ac3: 6 channel 5.1 files are returned in their order.
.MTS: 2 channel 2.0 files do work as well
Only short files tested for now. Other rare formats to come soon.
Many thanks !
__________________
"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..."
Emulgator is offline   Reply With Quote
Old 10th January 2020, 14:05   #12  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Quote:
Originally Posted by Emulgator View Post
BestAudioSource test2: Success !
.aiff, .wmv, .ac3: 6 channel 5.1 files are returned in their order.
.MTS: 2 channel 2.0 files do work as well
Only short files tested for now. Other rare formats to come soon.
Many thanks !
I think the most interesting things to try are (in order):
1. Badly combined transport streams with timecode discontinuities. (as in, is the initial estimate of the number of frames actually accurate enough or completely off?)
2. Streams with audio format changes (audio format changes are handled by simply dropping the bits with where the format doesn't match the output)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 25th January 2020, 16:44   #13  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Updated version. Fixes the channel mask variable that was previously almost always wrong in Avisynth. Also adds VS support (for a soon to be released test build).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 10th April 2020, 04:14   #14  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
nevermind
EDIT: Sorry, I thought it is ready for Vapoursynth and on the top of that I did not notice I am in Avisynth forum.

Last edited by _Al_; 10th April 2020 at 05:19.
_Al_ is offline   Reply With Quote
Old 11th May 2020, 08:41   #15  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Hi Myrsloik,

Question, are the "adjustdelay" and "varprefix" parameters the same as FFMS2? I see "varprefix" is only for AviSynth.


From FFMS2 docs:
Quote:
int adjustdelay = -1

Controls how audio delay is handled, i.e. what happens if the first audio sample in the file doesn't have a timestamp of zero. The following arguments are valid:

-3: No adjustment is made; the first decodable audio sample becomes the first sample in the output.
-2: Samples are created (with silence) or discarded so that sample 0 in the decoded audio starts at time zero.
-1: Samples are created (with silence) or discarded so that sample 0 in the decoded audio starts at the same time as frame 0 of the first video track. This is the default, and probably what most people want.
Any integer >= 0: Same as -1, but adjust relative to the video track with the given track number instead. If the provided track number isn't a video track, an error is raised.

-2 obviously does the same thing as -1 if the first video frame of the first video track starts at time zero. In some containers this will always be the case, in others (most notably 188-byte MPEG TS) it will almost never happen.
Quote:
string varprefix = ""

A string that is added as a prefix to all exported Avisynth variables. This makes it possible to differentiate between variables from different clips.
Reel.Deel is offline   Reply With Quote
Old 11th May 2020, 09:02   #16  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Quote:
Originally Posted by Reel.Deel View Post
Hi Myrsloik,

Question, are the "adjustdelay" and "varprefix" parameters the same as FFMS2? I see "varprefix" is only for AviSynth.


From FFMS2 docs:
Yes, they're the same. With the important difference that adjustdelay isn't actually implemented yet.

Obviously varprefix is only needed when you dump it all into a global namespace...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th May 2020, 05:41   #17  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Thanks for the reply Myrsloik. I guess now we wait patiently till the next update
Reel.Deel is offline   Reply With Quote
Old 13th June 2020, 13:08   #18  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
New version posted. If you're nice forum monkeys and test my VapourSynth audio builds I may be convinced to add 24bit bit audio output for Avisynth as well as some other minor improvements.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th June 2020, 15:36   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Myrsloik View Post
I may be convinced to add 24bit bit audio output for Avisynth as well as some other minor improvements.
Arh but, will it be XP compatible ?
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 13th June 2020, 17:20   #20  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,547
Quote:
Originally Posted by StainlessS View Post
Arh but, will it be XP compatible ?
Hahahahaha.... no.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Reply

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 04:12.


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