View Full Version : L-SMASH Source
flossy_cake
30th November 2023, 04:10
From what I can tell though the required d2v index file cannot be created within an Avisynth script
I stand corrected - it looks like RT_Call (http://avisynth.nl/index.php/RT_Stats#Utility_Functions) and DGIndex CLI (https://www.rationalqm.us/dgmpgdec/DGIndexManual.html#AppendixB) may be able to achieve that.
Assuming RT_Call waits until the command is complete before allowing the next Avisynth filter in the chain (MPEG2Source) to be called - can you clarify StainlessS? @StainlessS :thanks:
StainlessS
30th November 2023, 15:26
Flossy, no, but see CallCmd(Synchronous=7), [EDIT: Using Open command]
https://forum.doom9.org/showthread.php?t=166063
CallCmd(clip,string "Command"="", string "Frames"="",string "Insert"="",int "Digits"=6,bool "Once"=true,int "Offset"=0,
bool "Hide"=false,bool "Debug"=false,string "Open"="",string "Close"="",int "Synchronous"=7)
Synchronous (default 7, range 0 - 7)
The Synchronous arg is a group of 3 bitflags,
bit 0 if set means wait for process to terminate before returning from the 'Open' command.
bit 1 if set means wait for process to terminate before returning from the 'Frames' commands.
bit 2 if set means wait for process to terminate before returning from the 'Close' command.
0 = All Asynchronous, ie dont wait at all.
1 = Wait only on 'Open' command.
2 = Wait only on 'Frames' commands.
3 = Wait on 'Open' and 'Frames' commands.
4 = Wait on 'Close' command.
5 = Wait on 'Open' and 'Close' commands.
6 = Wait on 'Frames' and 'Close' commands.
7 = Wait on ALL commands (default).
Beware, if you dont wait it is very possible that any future reliance upon output of command may fail due to the
output file being in use. Also, if debug true and waiting for process to complete, then will also show the process return
code on successful process creation (and completion) in DebugView, cannot do this if NOT waiting completion.
EDIT: OOps, actually, I think not, you have to provide already Opened source clip, and CallCmd command executed on first frame
during frameserve stage. [EDIT: Actually on CallCmd filter construction, during filter graph creation and BEFORE frameserving starts]
Maybe you could call eg RT_Sleep(10.0), and pole for existing index file, else loop.
EDIT: If using DGIndex Template, then created AVS file is created last after indexing. [Using DGIndex GUI, dont know about CMD line ver$]
EDIT: Gone t' pub.
kedautinh12
30th November 2023, 18:09
Wow, sound good :D
flossy_cake
1st December 2023, 05:44
Here's a test version for auto-indexing. This is for 64-bit DGDecode.dll (MPEG2). Currently Avisynth only. Make sure that the included DGIndex.exe is in the same directory as DGDecode.dll. The revised DGIndex.exe's only change is to print a message in CLI mode saying that indexing is taking place. Please advise your test results.
https://rationalqm.us/misc/DGDecode64_test.rar
We should take discussion away from this thread. How about here:
https://www.rationalqm.us/board/viewtopic.php?f=7&p=18807#p18807
Thanks for this. I couldn't get it to create d2v from within an Avisynth script, only from its GUI. I'll reply on your forum...
kedautinh12
1st December 2023, 10:46
I think you can create a new thread about DGDecode on doom9 forum
tebasuna51
5th December 2023, 12:59
WARNING: the sintax in last L-SMASH-Works-r1156.0.0.0 have a important change:
the recommended parameter for LWLibavAudioSource/LSMASHAudioSource(..., drc_scale=0,...) not work now, must be:
(..., ff_options = "drc_scale=0", ...)
StainlessS
5th December 2023, 13:40
I stand corrected - it looks like RT_Call (http://avisynth.nl/index.php/RT_Stats#Utility_Functions) and DGIndex CLI (https://www.rationalqm.us/dgmpgdec/DGIndexManual.html#AppendixB) may be able to achieve that.
Assuming RT_Call waits until the command is complete before allowing the next Avisynth filter in the chain (MPEG2Source) to be called - can you clarify
Flossy, no, but see CallCmd(Synchronous=7), [EDIT: Using Open command]
https://forum.doom9.org/showthread.php?t=166063
CallCmd(clip,string "Command"="", string "Frames"="",string "Insert"="",int "Digits"=6,bool "Once"=true,int "Offset"=0,
bool "Hide"=false,bool "Debug"=false,string "Open"="",string "Close"="",int "Synchronous"=7)
Synchronous (default 7, range 0 - 7)
The Synchronous arg is a group of 3 bitflags,
bit 0 if set means wait for process to terminate before returning from the 'Open' command.
bit 1 if set means wait for process to terminate before returning from the 'Frames' commands.
bit 2 if set means wait for process to terminate before returning from the 'Close' command.
0 = All Asynchronous, ie dont wait at all.
1 = Wait only on 'Open' command.
2 = Wait only on 'Frames' commands.
3 = Wait on 'Open' and 'Frames' commands.
4 = Wait on 'Close' command.
5 = Wait on 'Open' and 'Close' commands.
6 = Wait on 'Frames' and 'Close' commands.
7 = Wait on ALL commands (default).
Beware, if you dont wait it is very possible that any future reliance upon output of command may fail due to the
output file being in use. Also, if debug true and waiting for process to complete, then will also show the process return
code on successful process creation (and completion) in DebugView, cannot do this if NOT waiting completion.
EDIT: OOps, actually, I think not, you have to provide already Opened source clip, and CallCmd command executed on first frame
during frameserve stage. [EDIT: Actually on CallCmd filter construction, during filter graph creation and BEFORE frameserving starts]
Maybe you could call eg RT_Sleep(10.0), and pole for existing index file, else loop.
EDIT: If using DGIndex Template, then created AVS file is created last after indexing. [Using DGIndex GUI, dont know about CMD line ver$]
EDIT: Gone t' pub.
You could perhaps use CallCmd() to execute Open command on dummy clip eg BlankClip(length=1).CallCmd(Open="...",Syncronous=7), to create an index for the actual target file,
then just use index as per normal. [object being to use Callcmd with Syncronous=7 to wait until target file index is actually created]
[Open="..." being the command line to call the indexer on target file. Also, see BLUE EDIT line in above quote]
But it looks like the problem is solved anyway.
flossy_cake
7th December 2023, 07:36
But it looks like the problem is solved anyway.
Yes, DG released auto indexer for DGDecode but it's not compatible with mkv's (I remuxed all my physical copy DVD's to mkv using MakeMKV and plan to continue using that application for various reasons).
FFMS2 is also a good option now too, it seems. So I'm quite spoiled for choice when it comes to accurate DVD playback, and DGDecode is still nice to have as a backup option (just need to give it .vob files from eg. DVD Decrypter or DVD Shrink).
flossy_cake
7th December 2023, 07:38
In the interest of improving LWLibAV compability, here is an mkv which FFMpegSource2 can play but LWLibAV cannot:
https://drive.google.com/u/0/uc?id=1Pm2V6bbrrcTJezbta7HWjW3VEa5GBz7E&export=download
It is MPEG2 video remuxed from DVD using MakeMKV.
FFVideoSource("C:\S01E01.mkv", rffmode=1) # works
LWLibavVideoSource("C:\S01E01.mkv", repeat=true) # doesn't work
https://i.ibb.co/TbvG14J/debug-avs-snapshot-00-01-500.png
Curiously, if I trim 2 seconds off the end of it with:
"c:\program files\ffmpeg\bin\ffmpeg.exe" -ss 00:00:00 -to 00:23:52 -i "C:\S01E01.mkv" -c copy -map 0 "C:\S01E01_trimmed.mkv"
the file then plays fine with LWLibAV.
So the offending data appears to be within the last couple of seconds of the clip - hopefully that offers a clue as to why LWLibAV doesn't like it.
It may very well be that the last 2 seconds is somehow incorrectly encoded and FFMS2 should refuse to play it as well, but that is a decision for the authors of the source filters to decide how "fault tolerant" they should be.
kedautinh12
7th December 2023, 07:45
You neeed create issue here
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/issues
flossy_cake
7th December 2023, 08:00
You neeed create issue here
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/issues
Done, thanks.
StainlessS
9th December 2023, 13:27
WARNING: the sintax in last L-SMASH-Works-r1156.0.0.0 have a important change:
the recommended parameter for LWLibavAudioSource/LSMASHAudioSource(..., drc_scale=0,...) not work now, must be:
(..., ff_options = "drc_scale=0", ...)
Thanks Teb,
I've just myself discovered that problem and was about to report it.
I guess that I've got a lot of scripts to change,
would have been nice if old args could remain as was,
and any changes coped with within the LSmash dll,
ie create dll internal ff_options string from eg LSmashAudioSource(..., drc_scale=0).
It should be fairly easily 'do-able' -
EDIT: From the doc file,
LSMASHVideoSource(string source, int track = 0, int threads = 0, int seek_mode = 0, int seek_threshold = 10,
bool dr = false, int fpsnum = 0, int fpsden = 1, string format = "", string decoder = "",
int prefer_hw = 0, int ff_loglevel = 0, string ff_options = "")
# ...
+ ff_options (default : "")
Set the decoder options in FFmpeg.
The format is `key=value` separated by " ". (e.g. "drc_scale=0 auto_convert=0").
and for all other video audio filters, eg
LSMASHAudioSource(string source, int track = 0, bool skip_priming = true, string layout = "", int rate = 0,
string decoder = "", int ff_loglevel = 0, string ff_options = "")
# ...
+ ff_options (defalut: "")
Same as 'ff_options' of LSMASHVideoSource().
EDIT: I guess that if there are likely to be many more ffmpeg options added, then would be easiest to just leave it as is,
and change all existing scripts instead :eek:
flossy_cake
10th December 2023, 08:33
Why not have both? The drc_scale param can be removed from documentation so that new users start using ff_options, while old scripts maintain forwards compatibility.
flossy_cake
10th December 2023, 08:40
Oh it's just been added back: https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/issues/51
If `ff_options="drc_scale=x"` is used, `drc_scale` is ignored.
That's perfect imo.
Selur
10th December 2023, 09:46
Oh it's just been added back
but the build action failed: https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/actions/runs/7154104282
kedautinh12
10th December 2023, 09:49
He will release if it's ready. He need fix some issues from Selur and flossy_cake
flossy_cake
10th December 2023, 10:25
I wasn't even aware drc_scale was supported as it isn't mentioned at the avisynth.nl page (only in readme.md on github).
I am interested in using it, but can't really test it out as I can't seem to find a filter or other tool that can report on whether the AC-3 track has DRC encoding. Can anyone suggest a tool for getting DRC info from video files with ac-3 tracks? MediaInfo doesn't seem to say, I think possibly as it's not flagged as metadata but is somehow baked into the packets inside the audio stream.
tebasuna51
10th December 2023, 11:54
... other tool that can report on whether the AC-3 track has DRC encoding...
You need extract the tracks and use LeeAudBi (https://forum.doom9.org/showthread.php?p=424067#post424067) to read all the frames (MediaInfo can't read all the frames)
The metadata are in the Audio Block, a value for each block, normally a frame have 6 blocks
File: test.ac3
Size: 961536 bytes
----------------------------------------- First Frame Info
SampleRate ..................: 0 (48000 Hz)
BitRate .....................: 14 (384 Kb/s)
FrameSize....................: 1536 bytes
...
Dynamic Range gain ..........: 5.89 dB (first block)
----------------------------------------- Revised full AC3 Info
Dyn. Range min/max : -11.51/5.89 dB
...
------------------------------------------------- End Info
flossy_cake
10th December 2023, 14:42
You need extract the tracks and use LeeAudBi (https://forum.doom9.org/showthread.php?p=424067#post424067)
:thanks:
kedautinh12
15th December 2023, 03:19
L-SMASH-works 20231214 1160.0.0.0
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases
Dogway
17th December 2023, 14:28
I know FFMS2 can't but does LSMASH support image batch loading? something like IMG_%04d.JPG?
The only image loader that I know that does this is ImageSource, but that one converts the images to RGB internally.
kedautinh12
17th December 2023, 17:03
You can try ImageSequence
http://avisynth.nl/index.php/ImageSequence
Dogway
17th December 2023, 17:36
CoronaSequence outputs RGB, I tried RawSequence() but it gives an error:
Error requesting frame 0
Cache: Filter returned invalid response to
CACHE_GETCHILD_AUDIO_MODE.10
Anyway, for today I solved it using batch scripts, but would be good to have a nice image sequence loader for next times.
kedautinh12
17th December 2023, 17:59
You can try JpegSource too
http://avisynth.nl/index.php/JpegSource
Dogway
20th December 2023, 23:17
JpegSource can load image sequences? Anyway it's an outdated (x86) closed source plugin, it's the best jpeg decoder quality wise but no help there.
qyot27
21st December 2023, 03:25
I know FFMS2 can't but does LSMASH support image batch loading? something like IMG_%04d.JPG?
The only image loader that I know that does this is ImageSource, but that one converts the images to RGB internally.
To answer this original question, yes it does (at least on Linux, but as filename handling should be internal to the plugin, I would assume that's also true on Windows).
I output a sequence of PNG files as well as a sequence of JPGs, and LwLibavVideoSource was totally cool opening the entire sequence using:
LwLibavVideoSource("output_%02d.jpg") # or output_%02d.png
The PNG sequence remained bgr24, the JPG sequence remained yuv420p.
StainlessS
21st December 2023, 14:31
at least on Linux
On W10 [EDIT: x64],
create_RGB.avs
# Export "Image Sequence" to ".\PIC_RGB" existing directory via VDUB2, png with basename="RGBIMAGE_" and 6 digits
Colorbars(Pixel_Type="RGB24")
ShowFrameNumber
Trim(0,-100)
RgbIn.avs
LwLibavVideoSource(".\PIC_RGB\RGBIMAGE_%06d.png") # "PIC_RGB" directory within the current directory.
Works OK,
###########
create_YUV.avs
# Export "Image Sequence" to ".\PIC_YUV" existing directory via VDUB2, jpeg with basename="YUVIMAGE_" and 6 digits
Colorbars(Pixel_Type="YV12")
ShowFrameNumber
Trim(0,-100)
YuvIn.avs
LwLibavVideoSource(".\PIC_YUV\YUVIMAGE_%06d.jpg") # "PIC_YUV" directory within the current directory.
Avisynth open failure.
[Fatal]: Failed to avformat_open_input.
EDIT: Oops, WORKS (returned as YV24, pre save source was YV12 [VDUB may have changed for save])
YuvIn.avs
LwLibavVideoSource(".\PIC_YUV\YUVIMAGE_%06d.jpeg") # VDub2 exported with 'jpeg' extension
Reel.Deel
22nd December 2023, 00:44
JpegSource can load image sequences?
It cannot. SEt had it on his todo list (https://forum.doom9.org/showthread.php?p=1709220#post1709220) but never happened.
LwLibavVideoSource was totally cool opening the entire sequence using:
LwLibavVideoSource("output_%02d.jpg") # or output_%02d.png
The PNG sequence remained bgr24, the JPG sequence remained yuv420p.
Nice tip, I had no idea LwLibavVideoSource was able to do that.
-------------
Another method of opening up image sequences is ImageSourceNV (https://forum.doom9.org/showthread.php?t=184825) but requires an NVidia GPU and it converts YUV images to 4:4:4.
flossy_cake
22nd December 2023, 00:45
I am confused about drc_scale (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/blob/master/AviSynth/README.md):
0.0 : DRC disabled. Produces full range audio.
# ok I understand this
0.0 < drc_scale <= 1.0 : DRC enabled. Applies a fraction of the stream DRC value. Audio reproduction is between full range and full compression.
# ok so 0.5 gives half compression, 1.0 gives full compression, understood
> 1.0 : DRC enabled. Applies drc_scale asymmetrically. Loud sounds are fully compressed. Soft sounds are enhanced.
# I thought 1.0 was already fully compressed? What is meant by "asymmetrically"?
:thanks:
tebasuna51
22nd December 2023, 10:52
You can read this thread about DRC (https://forum.doom9.org/showthread.php?t=56020) and see the attached image with the volume amplify/ attenuation values (the most common is Film Standard) applied to the audio.
With drc=0 the 'None' curve is applied, with drc=1 the showed curve is applied and with drc>1 a more agresive (plane) curve must be applied with all sounds at same volume.
Of course apply drc is only recommended at play time, never when you want recode or recover the original audio.
flossy_cake
23rd December 2023, 05:38
You can read this thread about DRC (https://forum.doom9.org/showthread.php?t=56020) and see the attached image with the volume amplify/ attenuation values (the most common is Film Standard) applied to the audio.
With drc=0 the 'None' curve is applied, with drc=1 the showed curve is applied and with drc>1 a more agresive (plane) curve must be applied with all sounds at same volume.
Of course apply drc is only recommended at play time, never when you want recode or recover the original audio.
Very useful, thanks.
I can now try to emulate these in soxfilter as well - great!
:thanks:
tebasuna51
24th December 2023, 00:47
I can now try to emulate these in soxfilter as well - great!
Maybe like this? (https://forum.doom9.org/showthread.php?p=779165#post779165)
kedautinh12
24th December 2023, 04:05
L-SMASH-Works 1161.0.0.0 (info in this link, just click. If you confused, don't use it)
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases
FranceBB
24th December 2023, 11:58
Thanks for the Christmas present, asd-g! :)
flossy_cake
25th December 2023, 05:59
Maybe like this? (https://forum.doom9.org/showthread.php?p=779165#post779165)
Hell yes that's just what I wanted :thanks:
Dogway
26th January 2024, 20:17
On W10 [EDIT: x64],
create_YUV.avs
# Export "Image Sequence" to ".\PIC_YUV" existing directory via VDUB2, jpeg with basename="YUVIMAGE_" and 6 digits
Colorbars(Pixel_Type="YV12")
ShowFrameNumber
Trim(0,-100)
YuvIn.avs
LwLibavVideoSource(".\PIC_YUV\YUVIMAGE_%06d.jpg") # "PIC_YUV" directory within the current directory.
Avisynth open failure.
[Fatal]: Failed to avformat_open_input.
EDIT: Oops, WORKS (returned as YV24, pre save source was YV12 [VDUB may have changed for save])
YuvIn.avs
LwLibavVideoSource(".\PIC_YUV\YUVIMAGE_%06d.jpeg") # VDub2 exported with 'jpeg' extension
That's the error I get for an image sequence of P1000054.JPG, P1000070.JPG, P1000074.JPG, etc.
Explicitly loading by the filename opens it but the sprint syntax calls that error. Tried with "P1000%03d.JPG", on Win11 x64.
poisondeathray
27th January 2024, 03:20
That's the error I get for an image sequence of P1000054.JPG, P1000070.JPG, P1000074.JPG, etc.
Explicitly loading by the filename opens it but the sprint syntax calls that error. Tried with "P1000%03d.JPG", on Win11 x64.
Is that the right numbering ?
If "gap" / "gapless" isn't supported maybe you can request that feature
What should it return ? Black "placeholder" frames inbetween ? Or just the frames present ?
StainlessS
27th January 2024, 17:12
Tried with "P1000%03d.JPG", on Win11 x64.
Try "P1%06d.JPG" (or for Vdub2 output "P1%06d.JPEG")
EDIT: Maybe the literal "000" of "P1000%03d.JPG" is confusing the code, somehow.
EDIT: Also if prob try,
".\P1%06d.JPG" or ".\P1%06d.JPEG",
or full path in place of current directory relative ".\".
EDIT: OK, maybe I misunderstood, looks like PDR got it.
EDIT: LWLibavVideoSource seems not to have equivalent to ImageSource("...",end=100)
LWLibavVideoSource(string source, int stream_index = -1, int threads = 0, bool cache = true, string cachefile = source + ".lwi",
int seek_mode = 0, int seek_threshold = 10, bool dr = false, int fpsnum = 0, int fpsden = 1,
bool repeat = unspecified, int dominance = 0, string format = "", string decoder = "", int prefer_hw = 0,
int ff_loglevel = 0, string cachedir = "", string ff_options = "")
Dogway
28th January 2024, 00:09
Thanks StainlessS, tried P1%06d.JPG, no dice.
Is that the right numbering ?
If "gap" / "gapless" isn't supported maybe you can request that feature
What should it return ? Black "placeholder" frames inbetween ? Or just the frames present ?
Frames present. These are the photos I selected from the set, and want to bulk filter them (resize, etc) with AVS+ tools.
I just tested renaming them to P1000000.JPG and P1000001.JPG and they load (both) fine. Also starting from P1000001, and so on. So the only problem it has is the numbering gaps. I can rename them to sequential temporally but could great to have this feature embedded.
StainlessS
28th January 2024, 14:28
Doggy, loads all files matching, "P1??????.JPG|JPEG" # "P1" + 6 characters (hopefully Digits) + "." + ("JPG" OR "JPEG")
Untested.
IN_FILES = "P1??????.JPG|JPEG" # "P1" + 6 characters (hopefully Digits) + "." + ("JPG" OR "JPEG")
OUT_FILE = "FILE.List"
result = RT_WriteFileList(IN_FILES,OUT_FILE) # Create a listing file of Pic filenames
Assert((result!=0), "No files found")
FILELIST = RT_ReadTxtFromFile(OUT_FILE) # Get list of files
#RT_FileDelete(OUT_FILE) # we are done with the temp file
NFILES = RT_TxtQueryLines(FILELIST) # Query Number of lines in String ie number of files.
RT_Debug("Found files = " + String(NFILES))
C=0 # Dummy clip
For(i=0,NFILES-1) {
FN=RT_TxtGetLine(FILELIST,i) # Filename
tmpC = ImageSource(FN,end=0)
# tmpC = LwLibavVideoSource(FN)
C = (C.IsInt) ? TmpC : C + TmpC # All clips must be same size.
}
C # EDIT: OOps, forgot this
EDITED: still untested.
StainlessS
28th January 2024, 17:05
Doggy, Further to above post,
########
# RT_FSelOpen() by StainlessS
#
# Function RT_FSelOpen(string "title"="Open",string "dir"="",string "filt",string "fn="",bool "multi"=false,bool "debug"=false)
#
# Function to select EXISTING filename using GUI FileSelector.
#
# Title = Title bar text.
# Dir = Directory, "" = Current
# Filt = Lots, eg "All Files (*.*)|*.*"
# [Displayed text | wildcard] [| more pairs of Displayed text and wildcard, in pairs ONLY].
# first one is default.
# fn = Initially presented filename (if any).
# multi = Multiply Select filenames. Allows selection of more than one filename.
# debug = Send error info to DebugView window.
#
# Returns
# int, 0, user CANCELLED.
# int, non zero is error (error sent to DebugView window).
# String, Filename selected, Chr(10) separated multiline string if MULTI==true (and multiple files selected).
#
# Example, to prompt for an AVI file and play it.
# avi=RT_FSelOpen("I MUST have an AVI",filt="Avi files|*.avi")
# Assert(avi.IsString,"RT_FSelOpen: Error="+String(avi))
# AviSource(avi)
#
########
# Images, Have to be same size
TITLE = "Tell me what you want, what you really really want"
DIR = ".\"
FILT = "Image files (*.bmp;*.jpg;*.jpe;*.jpeg;*.png;*.tga;*.tif;*.gif;*.tiff)|*.bmp;*.jpg;*.jpe;*.jpeg;*.png;*.tga;*.tif;*.gif;*.tiff"
FN = ""
MULTI = True
FILELIST = RT_FSelOpen(title=TITLE,dir=DIR,Filt=FILT,fn=FN,multi=MULTI)
Assert(!(FILELIST.IsInt && FILELIST==0),"User Cancelled")
Assert(FILELIST.IsString,"RT_FSelOpen: Error="+String(FILELIST))
NFILES = RT_TxtQueryLines(FILELIST) # Query Number of lines in String ie number of files.
RT_Debug("Found files = " + String(NFILES))
C=0 # Dummy clip
For(i=0,NFILES-1) {
FN=RT_TxtGetLine(FILELIST,i) # Filename
RT_DebugF("%d] %s",i,FN,name="ShowFilename: ")
tmpC = ImageSource(FN,end=0)
# tmpC = LwLibavVideoSource(FN)
C = (C.IsInt) ? TmpC : C + TmpC # All images must be same size.
}
C
RT_DebugF("DONE",name="FINISHED: ")
Return last
Allows selection of [EDIT: multiple] image files using GUI file selector. [must be all same size]
Dogway
3rd February 2024, 17:20
Thanks StainlessS. The first example did the job.
I made another for loop to write images out, I hope I got it right. I don't know if the same is possible with your last example as you are not writing the filenames to any file.
EDIT: My previous code was wrong, this is my current one with ImageWriter
DIR = "D:\Fotos\Fotos 28\"
IN_FILES = DIR+"P1??????.JPG|JPEG" # "P1" + 6 characters (hopefully Digits) + "." + ("JPG" OR "JPEG")
OUT_FILE = DIR+"FILE.List"
result = RT_WriteFileList(IN_FILES,OUT_FILE) # Create a listing file of Pic filenames
Assert((result!=0), "No files found")
FILELIST = RT_ReadTxtFromFile(OUT_FILE) # Get list of files
RT_FileDelete(OUT_FILE) # we are done with the temp file
NFILES = RT_TxtQueryLines(FILELIST) # Query Number of lines in String ie number of files.
RT_Debug("Found files = " + String(NFILES))
C=0 # Dummy clip
For(i=0,NFILES-1) {
FN=RT_TxtGetLine(FILELIST,i) # Filename
tmpC = LwLibavVideoSource(FN)
# Filtering
UV=deep_resize(tmpC,0.5,0.25,edge="Zopti",show=false) # 422 to 420
U=ExtractU(UV)
V=ExtractV(UV)
RES=deep_resize(tmpC,0.25,edge="SSIM2",show=false)
RES=CombinePlanes(ExtractY(RES),U,V, planes="YUV", pixel_type="YUV444")
RES=z_ConvertFormat(RES,pixel_type="RGBP16",colorspace_op ="470BG:auto:470BG:f=>rgb:same:same:f",resample_filter="spline16")
STRL=StrLen(FN)-4
STR=LeftStr(FN,STRL)+".PNG"
RES=ImageWriter(STR,FN,type="PNG")
C = (C.IsInt) ? RES : C + RES # All clips must be same size
RT_FileDelete(FN+".lwi") # we are done with the index file
}
C
StainlessS
4th February 2024, 12:52
as you are not writing the filenames to any file
Can use this, same as your current script (with separate loop or same loop).
#For(i=0,NFILES-1) { # If separate loop
FN=RT_TxtGetLine(FILELIST,i)
Your
STRL=StrLen(FN)-4
STR=LeftStr(FN,STRL)+".PNG"
only works with "JPG" not "JPEG", use
STR = RT_FilenameSplit(FN,get=7) # 7 = Drive + Dir + Name
RT_FilenameSplit(string filename,int "get"=15)
Splits the un-named filename string into component parts selected by 'get' bit flags arg and returns the
parts joined together.
'Get' (default 15, 1 -> 15), If set, Bit 0=DRIVE, 1=Dir, 2=Name, 4=Extension.
Add 1 for Drive (bit 0), add 2 for Dir (bit 1), add 4 for Name (bit 2), add 8 for Extension (bit 3).
Some combinations do not make sense, eg Drive + Extension (1+8=9). Below sensible options.
1 = Drive (includes trailing ':')
2 = Dir (includes trailing '\')
3 = Drive + Dir
4 = Name
6 = Dir + Name
7 = Drive + Dir + Name
8 = Extension (includes leading '.')
12 = Name + Extension
14 = Dir + Name + Extension
15 = Drive + Dir + Name + Extension
Assuming a current working directory of eg "D:\avs\avi\", 'filename'="test.avi" and 'get'=15, returns "D:\avs\avi\test.avi",
so given a relative filename and default 'get'=15, is equivalent to RT_GetFullPathName(filename).
EDIT: FILELIST is a multiline string of file names in both of my examples.
FranceBB
4th March 2024, 18:12
Hey guys, asd released a new version of LWLibav Link (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/) however I'm now getting a weird behavior.
It seems that when I use LWLibavVideoSource() and LWLibavAudioSource(), the index is recreated every time even when it's already in the same directory.
Can you test it too and see if that's indeed the case or if something else changed in my systems?
It seems like an odd behavior... (I'm using AVSPmod mod 2.7.7.0 FYI).
Hey guys, asd released a new version of LWLibav Link (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/) however I'm now getting a weird behavior.
It seems that when I use LWLibavVideoSource() and LWLibavAudioSource(), the index is recreated every time even when it's already in the same directory.
Can you test it too and see if that's indeed the case or if something else changed in my systems?
It seems like an odd behavior... (I'm using AVSPmod mod 2.7.7.0 FYI).
Are there national characters (other than English) in the folder/file name?
FranceBB
4th March 2024, 19:55
Nope, it was a pretty standard script:
video=LWLibavVideoSource("V:\fs0\clip.dir\UDX38745.mxf")
ch12=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=1)
ch34=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=2)
ch56=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=3)
ch78=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=4)
audio=MergeChannels(ch12, ch34, ch56, ch78)
AudioDub(video, audio)
AssumeTFF()
Bob()
AssRender("V:\fs0\clip.dir\UDX38745.ass")
assumeTFF()
separatefields()
selectevery(4,0,3)
weave()
and as soon as I uncommented a filter and re-run it, it started recreating the .lwi file again for a third time:
https://i.imgur.com/151Vkzc.png
it's currently 7:46PM, so it literally just started, it will grow again until it reaches 13 MB and then if I change something in the script, it will start creating it again... O_O
kedautinh12
5th March 2024, 03:27
Report to Asd-g
StvG
5th March 2024, 05:03
Nope, it was a pretty standard script:
and as soon as I uncommented a filter and re-run it, it started recreating the .lwi file again for a third time:
https://i.imgur.com/151Vkzc.png
it's currently 7:46PM, so it literally just started, it will grow again until it reaches 13 MB and then if I change something in the script, it will start creating it again... O_O
Does some old version work without recreating the index file for this script?
The safest way is to specify individual index file for every LWLibav... call.
video=LWLibavVideoSource("V:\fs0\clip.dir\UDX38745.mxf", cachefile="V:\fs0\clip.dir\UDX38745.mxfVideo.lwi")
ch12=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=1, cachefile="V:\fs0\clip.dir\UDX38745.mxfAudio1.lwi")
ch34=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=2, cachefile="V:\fs0\clip.dir\UDX38745.mxfAudio2.lwi")
ch56=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=3, cachefile="V:\fs0\clip.dir\UDX38745.mxfAudio3.lwi")
ch78=LWLibavAudioSource("V:\fs0\clip.dir\UDX38745.mxf", stream_index=4, cachefile="V:\fs0\clip.dir\UDX38745.mxfAudio4.lwi")
gispos
5th March 2024, 17:39
Hey guys, asd released a new version of LWLibav Link (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/) however I'm now getting a weird behavior.
It seems that when I use LWLibavVideoSource() and LWLibavAudioSource(), the index is recreated every time even when it's already in the same directory.
Can you test it too and see if that's indeed the case or if something else changed in my systems?
It seems like an odd behavior... (I'm using AVSPmod mod 2.7.7.0 FYI).
I have tested it with a 40 GB mkv video file. Indexing 15 minutes.
Then sharpen(0.4) on and off. With **/avsp_split**/ approx. 0.1 seconds.
video=LWLibavVideoSource(SourceFile, indexingpr=False, cache=True, prefer_hw=1)
audio=LWLibavAudioSource(SourceFile, cache=True, av_sync=False)
audioDub(video, audio)
/**avsp_split**/
sharpen(0.4)
Without /**avsp_split**/ approx. 18 seconds, so all good for me.
--------------------
I have another problem with LWLibav and AV1 video.
My graphics card can decode AV1, but LWLibav apparently only uses software decoding.
LWLibav prefer_hw=0 or prefer_hw=1 = 15 fps
DirectShowSource = 32 fps
Here I have uploaded the used video for testing.
https://drive.google.com/drive/folders/1Q4ikSHegEgHyL3MfaXfmfHMCV4pzBQzH?usp=drive_link
Can anyone confirm this?
StvG
5th March 2024, 19:03
I have tested it with a 40 GB mkv video file. Indexing 15 minutes.
Then sharpen(0.4) on and off. With **/avsp_split**/ approx. 0.1 seconds.
video=LWLibavVideoSource(SourceFile, indexingpr=False, cache=True, prefer_hw=1)
audio=LWLibavAudioSource(SourceFile, cache=True, av_sync=False)
audioDub(video, audio)
/**avsp_split**/
sharpen(0.4)
Without /**avsp_split**/ approx. 18 seconds, so all good for me.
This script isn't the same as the FranceBB one because his script is using 2 audio streams - once the index file indicates one audio steam and after the same index file should indicate another audio stream -> so the index file is changed.
I have another problem with LWLibav and AV1 video.
My graphics card can decode AV1, but LWLibav apparently only uses software decoding.
LWLibav prefer_hw=0 or prefer_hw=1 = 15 fps
DirectShowSource = 32 fps
Here I have uploaded the used video for testing.
https://drive.google.com/drive/folde...usp=drive_link
Can anyone confirm this?
When you're comparing the speed of LWLibav and DirectShowSource, did you compare if DirectShowSource is frame accurate when seeking?
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.