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 8th April 2024, 08:47   #1581  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
v1194 seems work now with wav files.

BTW LSMASHAudioSource don't work for all raw audio, for instance raw eac3 or aac can't be read. Use only for "MP4, MOV, [ISO Base Media] and its derived file formats."

Use always LWLibavAudioSource to decode audio.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 10th April 2024, 11:43   #1582  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 53
Quote:
Originally Posted by Selur View Post
@rgr: you might want your source, since that does seem to work fine here.
??? I don't understand.
rgr is offline   Reply With Quote
Old 10th April 2024, 14:02   #1583  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 53
Should I have double indexing?

Code:
Creating lwi index file 100%
Creating lwi index file 12%
Code:
v=LWLibavVideoSource("test.mp4",fpsnum=50)
AudioDub(v, LWLibavAudioSource("test.mp4"))
rgr is offline   Reply With Quote
Old 11th April 2024, 04:26   #1584  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Quote:
you might want your source, since that does seem to work fine here
=>
you might want to share your source, since that does seem to work fine here
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 11th April 2024, 06:47   #1585  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
Yes, if you index the video and then the audio, first it does the video, then it does the audio, hence you see two lines.
If you look at the lwi file, it gets bigger as it gets updated.
Once it's done, it won't index it again.

By the way, if you wanna see instances in which it may index things twice by mistake (not this case) you can just stare at the lwi index. If it gets overwritten and shrinks in size before raising again then something is wrong, but if it just grows then everything is fine.
In this case I'm sure it just grows as you're indexing the audio too, so everything is fine.
FranceBB is offline   Reply With Quote
Old 11th April 2024, 08:28   #1586  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,545
I am developing a snippet to automate audio decoding across a choice of audio decoders, here to control DRC (lower, deactivate/discard, invert) for decoding purposes.
Test source is a BD .m2ts with Track 1: 2.0 .ac3 + Track 2: 5.1 .dts.
Manually giving "5.1"or "0x3f" or "FL+FR+FC+LFE+SL+SR" decodes nicely, but I need to leave the channel layout default to LWLibavAudioSource, because the script can not know whats inside the source.
"Apply" needs to hand over all parameters up to the wanted one (drc_scale) in sequence. All the other parameters seem to work, so I can hand these over.
Now layout is parsed before drc_scale, so I am searching for the LWLibavAudioSource default layout parameter to hand this over too.
The 1194 readme says "", but this won't give any audio. "-1" does not and "0" does not and "0x0" does not help either. (BTW, bool indexingpr = true is missing in readme example line, but listed in explanations.)
Code:
#...we assume last() containing video already
audsrc="LWLibavAudioSource" #Asd-g versions only, here 1194
Libavaudtrk=2 #int stream_index = -1 #-1: default stream
Libavaudcache=true #bool cache = true
Libavaudcachefile=String(audfolder)+String(audfile)+String(audpid)+String(audext)+".lwi"#string cachefile = source +".lwi"
Libavaudavsync=false #bool av_sync = false
Libavaudlayout=""#"5.1"#"0x3f"#"FL+FR+FC+LFE+SL+SR" #string layout = ""  | CN ? No Audio |  5.1 -> "5.1" or "FL+FR+FC+LFE+SL+SR" or "0x3f"
Libavaudrate=0 #int rate = 0
Libavauddecoder="" #string decoder = ""
Libavaudffloglevel=0 #int ff_loglevel = 0
Libavaudcachedir="" #string cachedir = ""
Libavindexingpr=true #bool indexingpr = true
Libavauddrcscale=0.0 #float drc_scale = 1.0 #0.0 deactivates DRC, -values invert the DRC processing
Libavaudffopts="" #string ff_options = ""
Exist(String(avfolder)+String(avfile0)+String(avext0)) ? Apply(vidsrc,String(avfolder)+String(avfile0)+String(avext0))\
: Assert(false, "! NO SUCH AV FILE -> " + String(avfolder)+String(avfile0)+String(avext0) + "<- NO SUCH AV FILE !")
try {AudioDub(last,Apply(audsrc,String(audfolder)+String(audfile)+String(audpid)+String(audext),Libavaudtrk,Libavaudcache,Libavaudcachefile,Libavaudavsync,Libavaudlayout,Libavaudrate,Libavauddecoder,Libavaudffloglevel,Libavaudcachedir,Libavindexingpr,Libavauddrcscale,Libavaudffopts))}
catch (err) {last}
If I comment the try/catch lines out and run only
Code:
AudioDub(last,Apply(audsrc,String(audfolder)+String(audfile)+String(audpid)+String(audext),Libavaudtrk,Libavaudcache,Libavaudcachefile,Libavaudavsync,Libavaudlayout,Libavaudrate,Libavauddecoder,Libavaudffloglevel,Libavaudcachedir,Libavindexingpr,Libavauddrcscale,Libavaudffopts))
I get: "LWLibavAudioSource: Failed to open resampler."

Asd-g, what do I have to pass as default here ? Or is it a bug ?
__________________
"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; 12th April 2024 at 16:39.
Emulgator is offline   Reply With Quote
Old 11th April 2024, 10:55   #1587  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 53
Quote:
Originally Posted by Selur View Post
=>
you might want to share your source, since that does seem to work fine here
Yes of course. But it's private, so I can only send it to the plugin author.
rgr is offline   Reply With Quote
Old 11th April 2024, 10:57   #1588  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 53
Quote:
Originally Posted by FranceBB View Post
Yes, if you index the video and then the audio, first it does the video, then it does the audio, hence you see two lines.
If you look at the lwi file, it gets bigger as it gets updated.
Once it's done, it won't index it again.
Thanks.
So it would be good to introduce the "LWLibavSource" command like ffms2 or BS
rgr is offline   Reply With Quote
Old 12th April 2024, 16:52   #1589  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by rgr View Post
Thanks.
So it would be good to introduce the "LWLibavSource" command like ffms2 or BS
I've been meaning to update this function for a long time, probably years, so it'll work with the latest L-SMASH Source.
I've only given it a quick check. It should be fine, but let me know if you find any issues.

Code:
# ===============================================================================
#            LibavSource2
# ===============================================================================
#
#  Similar to the original LibavSource2, but audio is enabled by default.
#  Both video and audio can be disabled.
#  Audio-only and video-only files can be opened without first having to
#  disable the audio or video accordingly to prevent an error message.
#
# ===============================================================================

function LibavSource2(string Source, int "VTrack", int "ATrack", int "Threads", \
bool "Cache", string "CacheFile", int "Seek_Mode", int "Seek_Threshold", bool "DR", \
int "FPSNum", int "FPSDen", bool "Repeat", int "Dominance", string "Format", \
string "VDecoder", string "ADecoder", int "Prefer_HW", int "FF_LogLevel", \
string "CacheDir", string "FF_Options", bool "AV_Sync", string "Layout", int "Rate") {

VTrack = default(VTrack, -1)
ATrack = default(ATrack, -1)
Threads = default(Threads, 0)
Cache = default(Cache, true)
CacheFile = default(CacheFile, Source + ".lwi")
Seek_Mode = default(Seek_Mode, 0)
Seek_Threshold = default(Seek_Threshold, 10)
DR = default(DR, false)
FPSNum = default(FPSNum, 0)
FPSDen = default(FPSDen,  1)
Repeat = default(Repeat, false)
Dominance = default(Dominance, 0)
Format = default(Format, "")
VDecoder = default(VDecoder, "")
ADecoder = default(ADecoder, "")
Prefer_HW = default(Prefer_HW, 0)
FF_LogLevel = default(FF_LogLevel, 0)
CacheDir = default(CacheDir, "")
FF_Options = default(FF_Options, "")
AV_Sync = default(AV_Sync, false)

VideoEnabled = (VTrack > -2)
AudioEnabled = (ATrack > -2)
VideoNotFound = false
AudioNotFound = false
IsVideo = false
IsAudio = false
LS2 = " LibavSource2 " + chr(10)
VideoError = ""
AudioError = ""

assert(VideoEnabled || AudioEnabled, LS2 + " Both video and audio are disabled " + chr(10))

# -------------------------------------------------------------------------------

AudioEnabled ? Eval("""

try{

Audio = LWLibavAudioSource(Source, stream_index=ATrack, \
cache=Cache, cachefile=CacheFile, av_sync=AV_Sync, layout=Layout, rate=Rate, \
decoder=ADecoder, ff_loglevel=FF_LogLevel, cachedir=CacheDir, ff_options=FF_Options)

IsAudio = true

}catch(err_msg){

AudioError = " LWLibavAudioSource " + chr(10) + " " + err_msg + " " + chr(10)
AudioNotFound = (FindStr(LCase(err_msg), "failed to get the audio track") > 0)
NotAudio = (FindStr(LCase(err_msg), "not an audio track") > 0)
assert(!NotAudio, LS2 + " The specified audio track is not an audio track " + chr(10))
assert(AudioNotFound || NotAudio, AudioError)

} """) : nop()

# -------------------------------------------------------------------------------

VideoEnabled ? Eval("""

try{

Video = LWLibavVideoSource(Source, stream_index=VTrack, threads=Threads, \
cache=Cache, cachefile=CacheFile, seek_mode=Seek_Mode, seek_threshold=Seek_Threshold, dr=DR, \
fpsnum=FPSNum, fpsden=FPSDen, repeat=Repeat, dominance=Dominance, format=Format, decoder=VDecoder, \
prefer_hw=Prefer_HW, ff_loglevel=FF_LogLevel, cachedir=CacheDir, ff_options=FF_Options)

IsVideo = true

}catch(err_msg){

VideoError = " LWLibavVideoSource " + chr(10) + " " + err_msg + " " + chr(10)
VideoNotFound = (FindStr(LCase(err_msg), "failed to get the video track") > 0)
NotVideo = (FindStr(LCase(err_msg), "not a video track") > 0)
assert(!NotVideo, LS2 + " The specified video track is not a video track " + chr(10))
assert(VideoNotFound || NotVideo, VideoError)

} """) : nop()

# -------------------------------------------------------------------------------

assert(!VideoNotFound || AudioEnabled, LS2 + " No video found & audio is disabled " + chr(10))
assert(!AudioNotFound || VideoEnabled, LS2 + " No audio found & video is disabled " + chr(10))

IsAudio = AudioEnabled && IsAudio
IsVideo = VideoEnabled && IsVideo

return IsAudio && IsVideo ? AudioDub(Video, Audio) : IsAudio ? Audio : Video }

# ===============================================================================
Edit: LSMASHSource2 version. Tested even less.

Code:
# ===============================================================================
#            LSMASHSource2
# ===============================================================================
#
#  Similar to the original LSMASHSource2, but audio is enabled by default.
#  Both video and audio can be disabled.
#  Audio-only and video-only files can be opened without first having to
#  disable the audio or video accordingly to prevent an error message.
#
# ===============================================================================

function LSMASHSource2(string Source, int "VTrack", int "ATrack", int "Threads", \
int "Seek_Mode", int "Seek_Threshold", bool "DR", int "FPSNum", int "FPSDen", \
string "Format", string "VDecoder", string "ADecoder", int "Prefer_HW", \
int "FF_LogLevel", string "FF_Options", bool "Skip_Priming", string "Layout", int "Rate") {

VTrack = default(VTrack, -1)
VTrack = (VTrack == -1) ? 0 : VTrack
ATrack = default(ATrack, -1)
ATrack = (ATrack == -1) ? 0 : ATrack
Threads = default(Threads, 0)
Seek_Mode = default(Seek_Mode, 0)
Seek_Threshold = default(Seek_Threshold, 10)
DR = default(DR, false)
FPSNum = default(FPSNum, 0)
FPSDen = default(FPSDen,  1)
Format = default(Format, "")
VDecoder = default(VDecoder, "")
ADecoder = default(ADecoder, "")
Prefer_HW = default(Prefer_HW, 0)
FF_LogLevel = default(FF_LogLevel, 0)
FF_Options = default(FF_Options, "")
Skip_Priming = default(Skip_Priming, true)

VideoEnabled = (VTrack > -2)
AudioEnabled = (ATrack > -2)
VideoNotFound = false
AudioNotFound = false
IsVideo = false
IsAudio = false
LS2 = " LSMASHSource2 " + chr(10)
VideoError = ""
AudioError = ""

assert(VideoEnabled || AudioEnabled, LS2 + " Both video and audio are disabled " + chr(10))

# -------------------------------------------------------------------------------

AudioEnabled ? Eval("""

try{

Audio = LSMASHAudioSource(Source, track=ATrack, skip_priming=Skip_Priming, \
layout=Layout, rate=Rate, decoder=ADecoder, ff_loglevel=FF_LogLevel, ff_options=FF_Options)

IsAudio = true

}catch(err_msg){

AudioError = " LSMASHAudioSource " + chr(10) + " " + err_msg + " " + chr(10)
AudioNotFound = (FindStr(LCase(err_msg), "failed to find audio track") > 0)
NotAudio = (FindStr(LCase(err_msg), "not an audio track") > 0)
assert(!NotAudio, LS2 + " The specified audio track is not an audio track " + chr(10))
assert(AudioNotFound || NotAudio, AudioError)

} """) : nop()

# -------------------------------------------------------------------------------

VideoEnabled ? Eval("""

try{

Video = LSMASHVideoSource(Source, track=VTrack, threads=Threads, seek_mode=Seek_Mode, \
seek_threshold=Seek_Threshold, dr=DR, fpsnum=FPSNum, fpsden=FPSDen, format=Format, \
decoder=VDecoder, prefer_hw=Prefer_HW, ff_loglevel=FF_LogLevel, ff_options=FF_Options)

IsVideo = true

}catch(err_msg){

VideoError = " LSMASHVideoSource " + chr(10) + " " + err_msg + " " + chr(10)
VideoNotFound = (FindStr(LCase(err_msg), "failed to find video track") > 0)
NotVideo = (FindStr(LCase(err_msg), "not a video track") > 0)
assert(!NotVideo, LS2 + " The specified video track is not a video track " + chr(10))
assert(VideoNotFound || NotVideo, VideoError)

} """) : nop()

# -------------------------------------------------------------------------------

assert(!VideoNotFound || AudioEnabled, LS2 + " No video found & audio is disabled " + chr(10))
assert(!AudioNotFound || VideoEnabled, LS2 + " No audio found & video is disabled " + chr(10))

IsAudio = AudioEnabled && IsAudio
IsVideo = VideoEnabled && IsVideo

return IsAudio && IsVideo ? AudioDub(Video, Audio) : IsAudio ? Audio : Video }

# ===============================================================================

Last edited by hello_hello; 12th April 2024 at 17:29.
hello_hello 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 23:38.


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