HomeOfAviSynthPlusEvolution / L-SMASH-Works

Forked from VFR-maniac/L-SMASH-Works; hydra3333/L-SMASH-Works; l33tmeatwad/L-SMASH-Works; HolyWu/L-SMASH-Works; AkarinVS/L-SMASH-Works.
89 stars 15 forks source link

20240304 1170.0.0.0 regression - the lwi file is always recreated instead of using the cache #58

Closed FranceBB closed 8 months ago

FranceBB commented 8 months ago

Starting with version 20240304 1170.0.0.0 there's a regression about using the lwi files. The version before the latest release was checking whether there was an lwi file in the same directory as the file and if it was written with the same version of LWLibav. If it was written with an older version, then it would recreate the lwi index, otherwise it would use the one it found. In this new version, however, it recreates the lwi file every single time, not just with AVSPmod mod but also with ffmpeg and any other application. For instance, in this very same unchanged script, we have two different command lines calling ffmpeg and it's recreating the index files both times:

video=LWLibavVideoSource("V:\fs0\clip.dir\HSM00342.mxf", cache=true)
ch12=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=1, cache=true)
ch34=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=2, cache=true)
ch56=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=3, cache=true)
ch78=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=4, cache=true)
audio=MergeChannels(ch12, ch34, ch56, ch78)
AudioDub(video, audio)

image

Setting cache=true doesn't affect it as it keeps recreating it anyway and it's set to true by default anyway even when it's left unspecified. I tried with cachefile but it is still recreating it:

video=LWLibavVideoSource("V:\fs0\clip.dir\HSM00342.mxf", cache=true, cachefile="V:\fs0\clip.dir\HSM00342.mxf.lwi")
ch12=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=1, cache=true, cachefile="V:\fs0\clip.dir\HSM00342.mxf.lwi")
ch34=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=2, cache=true, cachefile="V:\fs0\clip.dir\HSM00342.mxf.lwi")
ch56=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=3, cache=true, cachefile="V:\fs0\clip.dir\HSM00342.mxf.lwi")
ch78=LWLibavAudioSource("V:\fs0\clip.dir\HSM00342.mxf", stream_index=4, cache=true, cachefile="V:\fs0\clip.dir\HSM00342.mxf.lwi")
audio=MergeChannels(ch12, ch34, ch56, ch78)
AudioDub(video, audio)

Even changing the disk didn't change a thing:

video=LWLibavVideoSource("A:\Ingest\MEDIA\temp\HSM00342.mxf", cache=true, cachefile="A:\Ingest\MEDIA\temp\HSM00342.mxf.lwi")
ch12=LWLibavAudioSource("A:\Ingest\MEDIA\temp\HSM00342.mxf", stream_index=1, cache=true, cachefile="A:\Ingest\MEDIA\temp\HSM00342.mxf.lwi")
ch34=LWLibavAudioSource("A:\Ingest\MEDIA\temp\HSM00342.mxf", stream_index=2, cache=true, cachefile="A:\Ingest\MEDIA\temp\HSM00342.mxf.lwi")
ch56=LWLibavAudioSource("A:\Ingest\MEDIA\temp\HSM00342.mxf", stream_index=3, cache=true, cachefile="A:\Ingest\MEDIA\temp\HSM00342.mxf.lwi")
ch78=LWLibavAudioSource("A:\Ingest\MEDIA\temp\HSM00342.mxf", stream_index=4, cache=true, cachefile="A:\Ingest\MEDIA\temp\HSM00342.mxf.lwi")
audio=MergeChannels(ch12, ch34, ch56, ch78)
AudioDub(video, audio)

image

adding a simple:

tweak(sat=1.31, dither=true)

as an example, makes it recreate the .lwi

image

flossy83 commented 8 months ago

I am unable to test right now but can you confirm the issue does NOT occur with 20240112 1167.0.0.0 as I would like to rule that out.
Thanks

Asd-g commented 8 months ago

Try the attached version.

LSMASHSource_1177.zip

FranceBB commented 8 months ago

Amazing, thank you so much asd, as always. The fix worked like a charm, I just tested it.

tuanden0 commented 3 months ago

@Asd-g:

This issue still exists on build 1194.0.0.0

It's always re-create LWI file and not use the exists LWI

For example my AVS:

a=LWLibavAudioSource("source.mkv", 1) c=LWLibavVideoSource("source.mkv", format="YUV420P8", prefer_hw=1) a=AssumeFPS(a, 24000, 1001) c=AssumeFPS(c, 24000, 1001) AudioDub(c, a)

I already had existsed LWI file but it still re-create it

image

Asd-g commented 3 months ago

Try the script with AVSMeter - running few times avsmeter64 scripts.avs -o -timelimit=2 should create lwi index file only for the first time. Or if you prefer ffmpeg - run few time ffmpeg -i script.avs -c copy -f null -.

tuanden0 commented 3 months ago

@Asd-g

I re-check with your CLI and confirm that the LWI file not be re-created

Then, I check my encode flow and found out First, I review the video source file with this AVS script on AvsPmod:

LWLibavVideoSource("E:\Download\z\source.mkv", prefer_hw=1) AssumeFPS(24000, 1001)

Then, it created new LWI file.

After that I encoded with this AVS script:

a=LWLibavAudioSource("source.mkv", 1) c=LWLibavVideoSource("source.mkv", format="YUV420P8", prefer_hw=1) a=AssumeFPS(a, 24000, 1001) c=AssumeFPS(c, 24000, 1001) AudioDub(c, a)

And it recreated LWI file.

I am not sure this is issue or this is feature of L-SMASH.

msg7086 commented 3 months ago

Can you check if you are using the same dll binary? Like maybe one of the app is 32 bit and the other is 64 bit?

tuanden0 commented 3 months ago

@msg7086 @Asd-g

I checked that I only install 64 bit version of AVS+ and 64 bit L-SMASH

Just to make sure, I empty folder plugins and plugins+ and it still happend

Step to reproduce:

  1. Create s.avs and s2.avs: s.avs:

LWLibavVideoSource("source.mkv", prefer_hw=1) AssumeFPS(24000, 1001)

s2.avs:

c=LWLibavVideoSource("source.mkv", prefer_hw=1) c=AssumeFPS(c, 24000, 1001) a=LWLibavAudioSource("source.mkv", 1) a=AssumeFPS(a, 24000, 1001) AudioDub(c, a)

  1. Run avsmeter s.avs -o -timelimit=2 first and avsmeter s2.avs -o -timelimit=2 after that

Result: it still create LWI file

image

Asd-g commented 3 months ago

It's expected behavior. With script s.avs you create index file with no active audio stream. With script s2.avs you create index file with active audio stream.

Compare the index files from both files to see the diff.

tuanden0 commented 3 months ago

@Asd-g

I understood, thank for your help