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 March 2024, 15:30   #1561  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by StvG View Post
Does some old version work without recreating the index file for this script?
Yes, the version before this one was working fine.
Effectively, it 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:

Quote:
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)



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:

Quote:
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:

Quote:
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)


adding a simple:

Quote:
tweak(sat=1.31, dither=true)
as an example, makes it recreate the .lwi


Last edited by FranceBB; 8th March 2024 at 16:26.
FranceBB is offline   Reply With Quote
Old 8th March 2024, 17:07   #1562  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Why you still don't create a new issue report to the home page? Asd-g reads messages from here rarely. If you want to fix faster, you need report to the home page better than here
kedautinh12 is offline   Reply With Quote
Old 8th March 2024, 17:25   #1563  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Who says I didn't? :P https://github.com/HomeOfAviSynthPlu...orks/issues/58
FranceBB is offline   Reply With Quote
Old 10th March 2024, 06:55   #1564  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by FranceBB View Post
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:

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
Doesn't L-Smash only index the video when indexing video, but when indexing audio, it indexes both?
FFMS2 is the same, as far as I know.

This
LWLibavVideoSource(Source, cachefile=IndexFile)
should create a smaller index file than this
LWLibavAudioSource(Source, cachefile=IndexFile)
assuming the source contains audio.

So this would be slower
v = LWLibavVideoSource(Source, cachefile=IndexFile)
a = LWLibavAudioSource(Source, cachefile=IndexFile)
AudioDub(v, a)

than this
a = LWLibavAudioSource(Source, cachefile=IndexFile)
v = LWLibavVideoSource(Source, cachefile=IndexFile)
AudioDub(v, a)

I haven't messed around with a file containing multiple audio streams myself, but what happens if you open the audio streams in reverse order, or you use the index file as the source? Unless that ability was removed at some stage, although it's working fine for r1164, which I think I'm using, at least for a file with a single audio stream.

LWLibavAudioSource(Source, cachefile=IndexFile)
a = LWLibavAudioSource(IndexFile)
v = LWLibavVideoSource(IndexFile)
AudioDub(v, a)

That's why I sometimes I use L-Smash in preference to FFMS2. You can batch index a bunch of files and open the index files directly later, without them having to be in the same folder as the source, much like indexing with DGIndex and then using the d2v file as the input for MPEG2Source. It was handy when I used to use MeGUI regularly, as it can run a batch of indexing jobs, and it understands lwi files can be used as the source.

Last edited by hello_hello; 10th March 2024 at 08:55.
hello_hello is offline   Reply With Quote
Old 11th March 2024, 08:43   #1565  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Bug acknowledged and fixed by asd-g.
Check this commit: https://github.com/HomeOfAviSynthPlu...790ff926986e22
Test build: https://github.com/HomeOfAviSynthPlu...ource_1177.zip

As always asd-g is amazing, he's always very committed in getting things to work and replies immediately.
Kudos to him for keeping LWLibav alive and kickin.
FranceBB is offline   Reply With Quote
Old 26th March 2024, 12:56   #1566  |  Link
leoenc
Registered User
 
Join Date: Mar 2007
Posts: 192
Linux newb here, trying to build this on Ubuntu 22.04 using the following commands:
Code:
git clone https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works
cd L-SMASH-Works/AviSynth/
mkdir build
meson . build/
ninja -C build
but compilation fails with errors about a missing lsmash.h file:
Code:
ninja: Entering directory `build/'
[1/21] Compiling C++ object liblsmashsource.so.p/libavsmash_source.cpp.o
FAILED: liblsmashsource.so.p/libavsmash_source.cpp.o
c++ -Iliblsmashsource.so.p -I. -I.. -I/usr/local/include/avisynth -I/home/leo/ffmpeg_build/include -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++14 -O3 -Wno-sign-compare -DXXH_INLINE_ALL -D_FILE_OFFSET_BITS=64 -mfpmath=sse -msse2 -fPIC -MD -MQ liblsmashsource.so.p/libavsmash_source.cpp.o -MF liblsmashsource.so.p/libavsmash_source.cpp.o.d -o liblsmashsource.so.p/libavsmash_source.cpp.o -c ../libavsmash_source.cpp
../libavsmash_source.cpp:29:10: fatal error: lsmash.h: No such file or directory
Any help appreciated.
leoenc is offline   Reply With Quote
Old 26th March 2024, 14:26   #1567  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
You have to build and install L-SMASH first. Which itself requires obuparse.

https://github.com/dwbuiten/obuparse

https://github.com/vimeo/l-smash

https://github.com/HomeOfAviSynthPlu.../L-SMASH-Works
qyot27 is offline   Reply With Quote
Old 26th March 2024, 16:05   #1568  |  Link
leoenc
Registered User
 
Join Date: Mar 2007
Posts: 192
@qyot27 thanks, I've built and installed obuparse and l-smash as you instructed and now getting the following error:
Code:
[21/21] Linking target liblsmashsource.so
FAILED: liblsmashsource.so
c++  -o liblsmashsource.so liblsmashsource.so.p/audio_output.cpp.o liblsmashsource.so.p/libavsmash_source.cpp.o liblsmashsource.so.p/lsmashsource.cpp.o liblsmashsource.so.p/lwlibav_source.cpp.o liblsmashsource.so.p/video_output.cpp.o liblsmashsource.so.p/.._common_audio_output.c.o liblsmashsource.so.p/.._common_decode.c.o liblsmashsource.so.p/.._common_libavsmash.c.o liblsmashsource.so.p/.._common_libavsmash_audio.c.o liblsmashsource.so.p/.._common_libavsmash_video.c.o liblsmashsource.so.p/.._common_lwindex.c.o liblsmashsource.so.p/.._common_lwlibav_audio.c.o liblsmashsource.so.p/.._common_lwlibav_dec.c.o liblsmashsource.so.p/.._common_lwlibav_video.c.o liblsmashsource.so.p/.._common_lwsimd.c.o liblsmashsource.so.p/.._common_osdep.c.o liblsmashsource.so.p/.._common_qsv.c.o liblsmashsource.so.p/.._common_resample.c.o liblsmashsource.so.p/.._common_utils.c.o liblsmashsource.so.p/.._common_video_output.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -Wl,-O1 -shared -fPIC -Wl,-rpath,/usr/local/lib -Wl,-rpath-link,/usr/local/lib -Wl,--start-group /usr/local/lib/liblsmash.a -lm /usr/local/lib/libobuparse.so /home/leo/ffmpeg_build/lib/libavcodec.a -pthread /usr/lib/gcc/x86_64-linux-gnu/11/libatomic.so /home/leo/ffmpeg_build/lib/libfdk-aac.a /home/leo/ffmpeg_build/lib/libx264.a -lpthread -ldl /home/leo/ffmpeg_build/lib/libx265.a /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so /usr/lib/gcc/x86_64-linux-gnu/11/libgcc_s.so /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a -lrt /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libnuma.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libz.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libva.so /home/leo/ffmpeg_build/lib/libswresample.a /home/leo/ffmpeg_build/lib/libavutil.a /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libva-drm.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libva-x11.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libvdpau.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libX11.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libdrm.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libxcb.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libXau.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libXdmcp.so /home/leo/ffmpeg_build/lib/libavformat.a /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libgnutls.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libgmp.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libunistring.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libhogweed.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libnettle.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libtasn1.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libidn2.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libp11-kit.so /home/leo/ffmpeg_build/lib/libswscale.a -Wl,--end-group
/usr/bin/ld: /usr/local/lib/liblsmash.a(box.o): warning: relocation against `isom_fiel_box_default' in read-only section `.text'
/usr/bin/ld: /home/leo/ffmpeg_build/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Any ideas?
leoenc is offline   Reply With Quote
Old 26th March 2024, 16:09   #1569  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
I figured that was going to be the next error. Linking static libraries (read: ffmpeg in a custom prefix, since most guides that do that build it as static) into a shared library (liblsmashsource) requires adding -Wl,-Bsymbolic to the LDFLAGS of the shared library when you configure it.

Code:
PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig LDFLAGS=-Wl,-Bsymbolic meson setup <build options>
qyot27 is offline   Reply With Quote
Old 26th March 2024, 16:34   #1570  |  Link
leoenc
Registered User
 
Join Date: Mar 2007
Posts: 192
@qyot27 I'm probably missing something as I ran the following and got the same error:

Code:
git clone https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works
cd L-SMASH-Works/AviSynth/
mkdir build
PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig LDFLAGS=-Wl,-Bsymbolic meson setup . build
ninja -C build/
leoenc is offline   Reply With Quote
Old 26th March 2024, 17:59   #1571  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
NVIDIA users:
Code:
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
sudo checkinstall --pkgname=nv-codec-headers --pkgversion="0:$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default
Intel users:
Code:
sudo apt-get install libvpl-dev
AV1 software decoding with libdav1d:
Code:
sudo apt-get install libdav1d-dev
FFmpeg-minimal:
  • Use --enable-libdav1d for AV1 software decoding
  • Use --enable-vpl to enable QSV hardware decoders
  • FFmpeg autodetects the nv-codec-headers, so the nvdec decoders should be automatically enabled
Code:
git clone https://git.videolan.org/git/ffmpeg.git
mkdir -p ffmpeg/ffmpeg-build
cd ffmpeg/ffmpeg-build
    ../configure --prefix=$HOME/ffmpeg_build_minimal \
    --enable-gpl --enable-version3 --disable-encoders \
    --disable-muxers --disable-doc --disable-debug --enable-libdav1d \
    --enable-libvpl --cpu=native --extra-cflags="-march=native" && \
make -j$(nproc) && \
make install
obuparse:
Code:
git clone https://github.com/dwbuiten/obuparse.git && \
cd obuparse && \
make && \
sudo make install
The install step might throw an error if the symlink to libobuparse.so already exists; that can be safely ignored.

l-smash:
Code:
git clone https://github.com/vimeo/l-smash.git
cd l-smash
./configure --extra-cflags="-march=native -fPIC" && \
make -j$(nproc) && \
sudo checkinstall --pkgname=lsmash --pkgversion="0:$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default
LSMASHSource:
Code:
git clone https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works.git && \
mkdir -p L-SMASH-Works/AviSynth/build && \
cd L-SMASH-Works/AviSynth/build && \
PKG_CONFIG_PATH=$HOME/ffmpeg_build_minimal/lib/pkgconfig LDFLAGS="-Wl,-Bsymbolic" meson setup .. && \
ninja && \
sudo checkinstall --pkgname=lsmashsource --pkgversion="1:$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --stripso=yes --addso=yes --fstrans=no --default ninja install
(Alternatively, instead of installing it to the system, just copy liblsmashsource.so to either ~/.avisynth or ~/.local/lib/avisynth)
qyot27 is offline   Reply With Quote
Old 26th March 2024, 19:24   #1572  |  Link
leoenc
Registered User
 
Join Date: Mar 2007
Posts: 192
Working great now, thanks!
leoenc is offline   Reply With Quote
Old Today, 09:16   #1573  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
I found a WMV which I want to convert, and in my experience, L-SMASH Works does that quite well, in general; but in this case I noticed that the audio gets async at the end of the clip. I can't check easily how much it is in the beginning, as there is only music, the interview starts after about 40 minutes, and here it is clearly out of sync in the Avisynth script. But when I play the WMV in a media player (MPC-HC with LAV Filters or ffplay), it is nicely in sync.

I wonder if the file is a result of concatenated smaller clips with originally audio streams exceeding the video streams, which are still contained in the resulting file, so an Avisynth source filter decodes them linearly, but they get skipped (or missing frames frozen) when a media player syncs to timestamps ... if that is even possible with this container.

I'll try to circumvent that for my conversion (e.g. remux to WMV with ffmpeg; remux to MKV with ffmpeg or mkvtoolnix; use DSS), yet I stay curious what might cause this difference.

Or are there possibly parameters for LwLibav(Video/Audio)Source I should test?
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; Today at 09:27.
LigH is offline   Reply With Quote
Old Today, 09:46   #1574  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,743
Could this wmv have been encoded in VFR mode ? Which might cause the async.
Music Fan is offline   Reply With Quote
Old Today, 09:56   #1575  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
MediaInfo reports VFR mode, but that is only related to the multiplexing format. I doubt that the frame actually varies. But I am not sure how to test that with certainty.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old Today, 10:41   #1576  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,743
I haven't done it for years but you can try directshowsource with convertfps=false. You should see directly if the number of frames is still the same (which does not mean that the sync will be perfect but maybe better).
Music Fan is offline   Reply With Quote
Old Today, 13:08   #1577  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
It is indeed. Just by a few hundred frames, but the result is in sync late.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH 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 16:56.


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