Log in

View Full Version : L-SMASH Source


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 [34]

wonkey_monkey
1st February 2025, 21:45
Okay, that all seems to have worked!

So now I need to:

4. While you're still in the ucrt64 shell, download lsmash (vimeo) and obuparse and build them, install them in the same location as ffmpeg.

I don't actually know where ffmpeg has installed itself or how to install the other two things there (yes, I really am this clueless).

What are the files that L-SMASH Works will be looking for in "DCMAKE_PREFIX_PATH="path_to_folder_where_are_include/lib_directories" when I get that far? :confused:

qyot27
1st February 2025, 22:17
I don't actually know where ffmpeg has installed itself or how to install the other two things there (yes, I really am this clueless).
The value of --prefix is where ffmpeg gets installed when the 'make install' step is performed. If you don't know which directory that is (meaning, you didn't specify it), look inside the script to see what it was setting for that option.

What are the files that L-SMASH Works will be looking for in "DCMAKE_PREFIX_PATH="path_to_folder_where_are_include/lib_directories" when I get that far? :confused:
CMAKE_PREFIX_PATH sets a search path for an entire tree of headers, libs, and such, so it depends on what exactly the next steps actually look for. In some cases, it's the pkgconfig files in lib/pkgconfig, in others, the CMake modules in lib/cmake, in still other cases it's just a way of saying: look at this top-level directory and pull any .h and .a files from the include/ and lib/ folders.

StvG
1st February 2025, 23:43
I don't actually know where ffmpeg has installed itself or how to install the other two things there (yes, I really am this clueless).

The script creates folder "deps\x64-Release" next to the script. Search for it.

What are the files that L-SMASH Works will be looking for in "DCMAKE_PREFIX_PATH="path_to_folder_where_are_include/lib_directories" when I get that far? :confused:

FFmpeg include files/libraries, external libs/include files, liblsmash include file/lib, obuparse include file/lib...

wonkey_monkey
1st February 2025, 23:57
Okay... for obuparse, since it doesn't have a configure script, I edited the Makefile and just changed the first line to

PREFIX ?= ~/deps/x64-release

Then did make and make install.

For l-smash, I did

./configure --prefix="~/deps/x64-release" --extra-cflags=-I/home/david/deps/x64-Release/include --extra-ldflags=-L/home/david/deps/x64-Release/lib --includedir=~/deps/x64-Release/include --libdir=~/deps/x64-Release/lib

(I'm not sure why I couldn't use ~ as a prefix for the extra cflags and extra ldflags, but it didn't work so I specified the full path)

make/make install put .h and .a files in the x64-Release/include and x64-Release/lib directories.

Next:

cmake -B build_folder -DCMAKE_PREFIX_PATH="C:\msys64\home\David\deps\x64-Release" -DENABLE_VPX=OFF

This worked, although it complained about not finding Git or PkgConfig.

Trying to build the created .sln resulted in four unresolved externals:

__mingw_fprintf
__mingw_sprintf
___chkstk_ms
__mingw_vfprintf

StvG
2nd February 2025, 00:04
Actually I build obuparse with created VS solution files and manually copy "obuparse.h" and the lib in "deps\x64-Release\relevant_dirs". Also I modified lsmash VS solution files to work correctly with vimeo version and again manually copy "lsmash.h" and "liblsmash.lib" to "deps\x64-Release\relevant_dirs". If you prefer VS solution files, I can share them so you can build them with VS.

StvG
2nd February 2025, 00:11
__mingw_fprintf
__mingw_sprintf
___chkstk_ms
__mingw_vfprintf

This suggests that you're linking against ffmpeg/external libs created with GCC and not VS. For what libs are these errors?

Edit: Oh, for obuparse and liblsmash I guess you didn't explicitly used cl instead GCC. You can do in the shell: "export CC=cl".

qyot27
2nd February 2025, 00:19
It's not necessary to specify --includedir= or --libdir= if you've set --prefix. Those are automatically populated by whatever the prefix is, and you only really want to change them if you deliberately want them somewhere else.

And the extra-{cflags,ldflags} arguments can understand $HOME, e.g., --extra-cflags=-I$HOME/deps/x64-Release/include.

Not finding Git or pkgconf sounds like you haven't added MSys2's /usr/bin to the %PATH% (or alternatively, launched MSys2 from within the VS Command Prompt so the MSys2 environment can see MSVC).

wonkey_monkey
2nd February 2025, 00:20
Ah, all the errors are for liblsmash! I probably need to change the compiler to cl. Please hold...

StvG
2nd February 2025, 00:34
Ah, all the errors are for liblsmash! I probably need to change the compiler to cl. Please hold...

obuparse has hardcoded GCC in the Makefile.

Here (https://filebin.net/0sgmh4a8z49pczi9) are the VS solution files for obuparse and l-smash. Extract them in the root of the relevant folders and build the libs from there.

Edit: Copy "obuparse.h" in the root of l-smash folder.

StvG
2nd February 2025, 00:37
Not finding Git or pkgconf sounds like you haven't added MSys2's /usr/bin to the %PATH% (or alternatively, launched MSys2 from within the VS Command Prompt so the MSys2 environment can see MSVC).

For L-SMASH-Works - it checks if pkgconfig is available and if not it finds the libs with CMAKE_PREFIX_PATH. This is just warning that pkgconfig is not used. Part of the code (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/blob/master/CMakeLists.txt#L121-L128).

wonkey_monkey
2nd February 2025, 01:09
qyot27, StvG, thank you both again for your indefatigability. I would have given up on me a long time ago. I have now successfully - if still somewhat mystifyingly - built LSMASHSource.dll.

Unfortunately while it does create a .lwi file, VirtualDub2 simply ends without an error when I try to open a file with it.

I can't build a Debug version; I can build RelWithDebInfo, but when I try to Start Debugging I get this:

https://i.imgur.com/oYtxTi5.png

even though I specified VirtualDub2 as the program to launch for debugging :confused:

StvG
2nd February 2025, 01:13
You can build a Debug version but change in VS->C/C++->Code Generation->Runtime library to MD instead MDd.

Open VirtualDub2 (without loading anything), in VS->Debug->Attach to process and choose VirtualDub2, then load the script in VD2.

wonkey_monkey
2nd February 2025, 01:20
I had no idea you could attach like that. Useful!

That tells me:

Exception thrown at 0x00007FF94535F270 (LSMASHSource.dll) in VirtualDub64.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

but also

Source information is missing from the debug information for this module

so I don't know where in the code the problem is happening.

I'll try again tomorrow.

StvG
2nd February 2025, 01:24
I had no idea you could attach like that. Useful!

That tells me:

Exception thrown at 0x00007FF94535F270 (LSMASHSource.dll) in VirtualDub64.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

but also

Source information is missing from the debug information for this module

so I don't know where in the code the problem is happening.

I'll try again tomorrow.

If you build RelWithDebInfo version you probably better to disable the optimizations from O2 to Od so it will be almost the same as Debug version.
Put some break point in the lsmashworks code and see if it's hit - if it's hit with f10 go from there and see where the crash is, if it's not hit put the break point somewhere before in order to be hit.
Btw you can share a sample of the problematic video.

wonkey_monkey
2nd February 2025, 17:32
Here, apparently, is the problem:

https://i.imgur.com/PuTNmAc.png

To clarify, the videos I'm trying to open all work fine with the distributed LSMASHSource.dll; it's just the one I've built that isn't working.

StvG
2nd February 2025, 19:44
Are you trying to open HEVC video?

Also go to "msys64\ucrt64\include\_mingw.h" - find the line "# define _CRTIMP __declspec(dllimport)" and uncomment it if its not.

StvG
2nd February 2025, 20:32
Here (https://filebin.net/dnqags3uipsbm44k) you can download L-SMASH-Works 1194 source code with included external libs ("deps_lsmash" folder). Just open "build" folder and the solution file.

Your build can crash because of the some later commits after the latest release. Also the ffmpeg version is different - the latest version (https://github.com/HomeOfAviSynthPlusEvolution/FFmpeg/tree/custom-patches-for-lsmashsource), older version for 1194 (https://github.com/HomeOfAviSynthPlusEvolution/FFmpeg/tree/77b972bfedef6de7b40939b0a498fa851c45ee88).

wonkey_monkey
3rd February 2025, 23:25
Thanks for the download - but I'm afraid I'm still too dim :confused:

I tried opening LSMASHSourceVCX.sln, added the deps_lsmash\x64-Release\include and deps_lsmash\x64-Release\lib directories but got 107 unresolved externals, all seemingly MinGW related.

I also tried just opening the main folder in VS, but CMake generation fails:

1> [CMake] Could NOT find FFMPEG (missing: FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES
1> [CMake] avcodec avformat swscale swresample avutil)

Please feel free to give up - I had to remux all of my video files anyway to remove superfluous tracks to save space, which gave me the opportunity to change them from .mkv to .mp4, which works around the issue I was having with FFMpegSource in the first place, so I can use that instead for now.

StvG
4th February 2025, 01:35
You don't open the solution file from folder build - https://i.ibb.co/cXND9wFG/Untitled.png
You don't need to add the path of the external libs. They are already configured for the correct paths.

wonkey_monkey
4th February 2025, 15:26
Like I said... dim... :o

It now works, thank you!

FranceBB
13th February 2025, 16:47
asd-g has been working on a new feature and released a new test build here: Link (https://github.com/user-attachments/files/18684293/LSMASHSource.zip)
His commit is here: Link (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/commit/7dc8ba9295aafa5e99a59903cdd62c4fffc512a5)
The new build he made introduced a new parameter in LWLibavAudioSource(), namely "fill_audio_gaps", which is a boolean and it can be set to either "true" or "false" (by default is "false" for backwards compatibility with the current behavior).
What it does when it's set to true is basically read the PTS while it's indexing and - if the audio track has a missing sample due to some issues - it fills the chunk with silence so that the audio stays synced to the video and ends up having the same length/duration instead of being shorter and ending up desynced from the point of the first issue onward.

I tested it and it worked like a charm.

The source was:

Video: FULL HD 1920x1080 MPEG-2 High 4:2:2 Profile, Level High 50 Mbit/s yv16 25i TFF BT709 SDR
Audio: 4 Stereo 2ch PCM 24bit 48000Hz tracks (i.e 8 channels)
Container: mxf

where the video had 1500 frames (i.e 1 minute) and the audio had 1499 frames (i.e 59 seconds and 960ms).
In other words, using a 25fps based timecode format, we have:

Video: 00:00:00:00 - 00:00:59:24
Audio: 00:00:00:00 - 00:00:59:23

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

worked like a charm and filled the gap:

Video: 00:00:00:00 - 00:00:59:24
Audio: 00:00:00:00 - 00:00:59:24


The command line I tested it with was:

ffmpeg.exe -hide_banner -i "HNC06683_Audio_1_frame_shorter_than_video.mxf.avs" -pix_fmt yuv422p -vcodec mpeg2video -s 1920:1080 -aspect 16:9 -vf setfield=tff -flags +ildct+ilme+cgop -b_strategy 0 -mpv_flags +strict_gop -sc_threshold 1000000000 -r 25 -b:v 50000k -minrate 50000k -maxrate 50000k -bufsize 36408333 -qmin 5 -qmax 28 -qsquish 99 -g 12 -bf 2 -profile:v 0 -level:v 2 -color_range 1 -color_primaries 1 -color_trc 1 -colorspace 1 -an -f mxf -y "raw_video.mxf"

ffmpeg.exe -hide_banner -i "HNC06683_Audio_1_frame_shorter_than_video.mxf.avs" -c:a pcm_s24le -ar 48000 -f wav -y "audio.wav"

ffmpeg.exe -hide_banner -i "raw_video.mxf" -i "audio.wav" -c:v copy -c:a copy -f mxf -y "pre-final_output.mxf"

bmxtranswrap.exe -p -y 10:00:00:00 -t op1a --track-map stereo -o "final_output.mxf" "pre-final_output.mxf"

pause


The Mediainfo of the output file with fill_audio_gaps=true was perfect:


General
Complete name : A:\MEDIA\temp\final_output_with_padding.mxf
Format : MXF
Commercial name : XDCAM HD422
Format version : 1.3
Format profile : OP-1a
Format settings : Closed / Complete
File size : 423 MiB
Duration : 1 min 0 s
Overall bit rate : 59.1 Mb/s
Frame rate : 25.000 FPS
Encoded date : 2025-02-12 08:41:08.112
Writing application : BBC bmx 1.3.1.0.2
Writing library : libMXF (Win64) 1.3.1.0.2
Video
ID : 1001
Format : MPEG Video
Commercial name : XDCAM HD422
Format version : Version 2
Format profile : 4:2:2@High
Format settings : BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=12
Format settings, picture structure : Frame
Format settings, wrapping mode : Frame
Codec ID : 0D01030102046001-0401020201040300
Duration : 1 min 0 s
Bit rate mode : Constant
Bit rate : 50.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.965
Time code of first frame : 00:00:00:00
Time code source : Group of pictures header
GOP, Open/Closed : Closed
Stream size : 358 MiB (85%)
Title : V1
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio #1
ID : 2001
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 1 min 0 s
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A1
Locked : Yes
Audio #2
ID : 2002
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 1 min 0 s
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A2
Locked : Yes
Audio #3
ID : 2003
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 1 min 0 s
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A3
Locked : Yes
Audio #4
ID : 2004
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 1 min 0 s
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A4
Locked : Yes
Other #1
ID : 901-Material
Type : Time code
Format : MXF TC
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
Time code of last frame : 10:00:59:24
Time code settings : Material Package
Time code, stripped : Yes
Title : TC1
Other #2
ID : 901-Source
Type : Time code
Format : MXF TC
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
Time code of last frame : 10:00:59:24
Time code settings : Source Package
Time code, stripped : Yes
Title : TC1



While using fill_audio_gaps=false to get the old behavior creates the wrong output, as expected:

video=LWLibavVideoSource("A:\MEDIA\temp\HNC06683_Audio_1_frame_shorter_than_video.mxf")
ch12=LWLibavAudioSource("A:\MEDIA\temp\HNC06683_Audio_1_frame_shorter_than_video.mxf", stream_index=1, fill_audio_gaps=false)
ch34=LWLibavAudioSource("A:\MEDIA\temp\HNC06683_Audio_1_frame_shorter_than_video.mxf", stream_index=2, fill_audio_gaps=false)
ch56=LWLibavAudioSource("A:\MEDIA\temp\HNC06683_Audio_1_frame_shorter_than_video.mxf", stream_index=3, fill_audio_gaps=false)
ch78=LWLibavAudioSource("A:\MEDIA\temp\HNC06683_Audio_1_frame_shorter_than_video.mxf", stream_index=4, fill_audio_gaps=false)
audio=MergeChannels(ch12, ch34, ch56, ch78)
AudioDub(video, audio)

In the mediainfo report we can see that the video is truncated by 1 frame due to the unpadded audio:

General
Complete name : A:\MEDIA\temp\final_output_without_padding.mxf
Format : MXF
Commercial name : XDCAM HD422
Format version : 1.3
Format profile : OP-1a
Format settings : Closed / Complete
File size : 423 MiB
Duration : 59 s 960 ms
Overall bit rate : 59.2 Mb/s
Frame rate : 25.000 FPS
Encoded date : 2025-02-12 08:23:13.332
Writing application : BBC bmx 1.3.1.0.2
Writing library : libMXF (Win64) 1.3.1.0.2
Video
ID : 1001
Format : MPEG Video
Commercial name : XDCAM HD422
Format version : Version 2
Format profile : 4:2:2@High
Format settings : CustomMatrix / BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=12
Format settings, picture structure : Frame
Format settings, wrapping mode : Frame
Codec ID : 0D01030102046001-0401020201040300
Duration : 59 s 960 ms
Bit rate mode : Constant
Bit rate : 50.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 FPS
Standard : Component
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.965
Time code of first frame : 01:00:00:00
Time code source : Group of pictures header
GOP, Open/Closed : Closed
Stream size : 357 MiB (84%)
Title : V1
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio #1
ID : 2001
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 59 s 960 ms
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A1
Locked : Yes
Audio #2
ID : 2002
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 59 s 960 ms
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A2
Locked : Yes
Audio #3
ID : 2003
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 59 s 960 ms
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A3
Locked : Yes
Audio #4
ID : 2004
Format : PCM
Format settings : Little
Format settings, wrapping mode : Frame (BWF)
Codec ID : 0D01030102060100
Duration : 59 s 960 ms
Bit rate mode : Constant
Bit rate : 2 304 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Frame rate : 25.000 FPS (1920 SPF)
Bit depth : 24 bits
Stream size : 16.5 MiB (4%)
Title : A4
Locked : Yes
Other #1
ID : 901-Material
Type : Time code
Format : MXF TC
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
Time code of last frame : 10:00:59:23
Time code settings : Material Package
Time code, stripped : Yes
Title : TC1
Other #2
ID : 901-Source
Type : Time code
Format : MXF TC
Frame rate : 25.000 FPS
Time code of first frame : 10:00:00:00
Time code of last frame : 10:00:59:23
Time code settings : Source Package
Time code, stripped : Yes
Title : TC1




Up until now I've been indexing all files with fill_audio_gaps=true and I haven't seen any issues with leaving it on at all times. I mean, if there aren't any gaps to fill it just doesn't do anything and if there are then it does what it's supposed to do. Although the chances of having issues with audio are slim in most containers, this is extremely useful for people who deal with files in .ts and .mxf containers all the time as it's very easy to have CRC Errors in live recordings, especially when the signal isn't great.

filler56789
13th February 2025, 20:35
asd-g has been working on a new feature and released a new test build here: Link (https://github.com/user-attachments/files/18684293/LSMASHSource.zip)
His commit is here: Link (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/commit/7dc8ba9295aafa5e99a59903cdd62c4fffc512a5)
The new build he made introduced a new parameter in LWLibavAudioSource(), namely "fill_audio_gaps", which is a boolean and it can be set to either "true" or "false" (by default is "false" for backwards compatibility with the current behavior).
What it does when it's set to true is basically read the PTS while it's indexing and - if the audio track has a missing sample due to some issues - it fills the chunk with silence so that the audio stays synced to the video and ends up having the same length/duration instead of being shorter and ending up desynced from the point of the first issue onward.

That's an overdue and very-welcome update. :goodpost:
It's very similar to what Lord Mulder's wma2wav.exe does to WMA streams when converting them to uncompressed .WAV files.

rgr
18th February 2025, 14:50
asd-g has been working on a new feature and released a new test build here: Link (https://github.com/user-attachments/files/18684293/LSMASHSource.zip)
His commit is here: Link (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/commit/7dc8ba9295aafa5e99a59903cdd62c4fffc512a5)
The new build he made introduced a new parameter in LWLibavAudioSource(), namely "fill_audio_gaps", which is a boolean and it can be set to either "true" or "false" (by default is "false" for backwards compatibility with the current behavior).
What it does when it's set to true is basically read the PTS while it's indexing and - if the audio track has a missing sample due to some issues - it fills the chunk with silence so that the audio stays synced to the video and ends up having the same length/duration instead of being shorter and ending up desynced from the point of the first issue onward.

I tested it and it worked like a charm.

I also tested it and it didn't work properly with my mp4 file with audio gaps from recorder. In fact, even worse than with fill_audio_gaps set to false. With false, audible desync occurred after 4 hours. With true, it's bad after 1 hour. Only EAC3TO still handles it and fills gaps correctly.
I also checked on m2ts and avi files (from camera) -- also without success. But only ffmpeg can handle these files, no AviSynth plugin works properly.

Jamaika
31st March 2025, 12:44
I don't know how to compile ffmpeg 7.2.0-1d2c391.
Are add-ons like the latest avisynth plus plugins or lcevc decoder definitively deleted in the ffmpeg 7.2.0 2025?

base_decoder_libav.cpp: In member function 'void lcevc_dec::utility::BaseDecoderLibAV::close()':
base_decoder_libav.cpp:361:9: error: 'avcodec_close' was not declared in this scope; did you mean 'avio_close'?
361 | avcodec_close(m_videoDecCtx);
| ^~~~~~~~~~~~~
| avio_close

In file included from convert.cpp:103:
plugins/video_output.cpp: In function 'void avs_set_frame_properties(AVFrame*, AVStream*, int64_t, int64_t, bool, PVideoFrame&, int, int, IScriptEnvironment*, int)':
plugins/video_output.cpp:890:20: error: 'AVFrame' {aka 'struct AVFrame'} has no member named 'interlaced_frame'
890 | if ( av_frame->interlaced_frame )
| ^~~~~~~~~~~~~~~~
plugins/video_output.cpp:891:33: error: 'AVFrame' {aka 'struct AVFrame'} has no member named 'top_field_first'
891 | field_based = av_frame->top_field_first ? 2 : 1;
| ^~~~~~~~~~~~~~~
plugins/video_output.cpp:925:37: error: 'AVStream' {aka 'struct AVStream'} has no member named 'nb_side_data'
925 | for (int i = 0; i < stream->nb_side_data; ++i)
| ^~~~~~~~~~~~
plugins/video_output.cpp:927:25: error: 'AVStream' {aka 'struct AVStream'} has no member named 'side_data'
927 | if (stream->side_data[i].type == AV_PKT_DATA_MASTERING_DISPLAY_METADATA)
| ^~~~~~~~~
plugins/video_output.cpp:929:114: error: 'AVStream' {aka 'struct AVStream'} has no member named 'side_data'
929 | const AVMasteringDisplayMetadata* mastering_display = (const AVMasteringDisplayMetadata*)stream->side_data[i].data;
| ^~~~~~~~~
plugins/video_output.cpp:965:37: error: 'AVStream' {aka 'struct AVStream'} has no member named 'nb_side_data'
965 | for (int i = 0; i < stream->nb_side_data; ++i)
| ^~~~~~~~~~~~
plugins/video_output.cpp:967:25: error: 'AVStream' {aka 'struct AVStream'} has no member named 'side_data'
967 | if (stream->side_data[i].type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL)
| ^~~~~~~~~
plugins/video_output.cpp:969:102: error: 'AVStream' {aka 'struct AVStream'} has no member named 'side_data'
969 | const AVContentLightMetadata* content_light = (const AVContentLightMetadata*)stream->side_data[i].data;

lwindex.c: In function 'get_ticks_per_frame':
lwindex.c:1789:15: error: 'AVCodecContext' has no member named 'ticks_per_frame'
1789 | return ctx->ticks_per_frame;
| ^~
lwlibav_video.c: In function 'field_number_of_picture_in_frame':
lwlibav_video.c:864:14: error: 'AVFrame' has no member named 'top_field_first'
864 | if( frame->top_field_first )
| ^~
lwlibav_video.c: In function 'copy_field':
lwlibav_video.c:1253:8: error: 'AVFrame' has no member named 'interlaced_frame'
1253 | dst->interlaced_frame = src->interlaced_frame;
| ^~
lwlibav_video.c:1253:32: error: 'AVFrame' has no member named 'interlaced_frame'
1253 | dst->interlaced_frame = src->interlaced_frame;
| ^~
lwlibav_video.c:1254:8: error: 'AVFrame' has no member named 'top_field_first'
1254 | dst->top_field_first = top_field_first;
| ^~
lwlibav_video.c: In function 'lwlibav_repeat_control':
lwlibav_video.c:1296:31: error: 'AVFrame' has no member named 'interlaced_frame'
1296 | vdhp->frame_buffer->interlaced_frame = vdhp->last_req_frame->interlaced_frame;
| ^~
lwlibav_video.c:1296:72: error: 'AVFrame' has no member named 'interlaced_frame'
1296 | vdhp->frame_buffer->interlaced_frame = vdhp->last_req_frame->interlaced_frame;
| ^~

LigH
31st March 2025, 14:59
The ffmpeg source must have been refactored, many renamed types and constants; e.g. FF_PROFILE~ to AV_PROFILE~ (https://github.com/m-ab-s/media-autobuild_suite/issues/2866)

Jamaika
1st April 2025, 07:12
I don't think so. As for the rest, I was rejected from the topic.
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/pull/80

Problem with:
https://github.com/FFmpeg/FFmpeg/commit/4a66fe15880565d006996ac9719a3290b77e9536
https://github.com/FFmpeg/FFmpeg/commit/8af333188349d7eaab141bc872d98e03d03bf029
https://github.com/FFmpeg/FFmpeg/commit/7d07723db5c18bb762f8eeb2a844a677986b8dcc
https://github.com/FFmpeg/FFmpeg/commit/ec8e796b42bccf999fdf31c110385e2cc119b7f2

VoodooFX
1st April 2025, 10:00
Here you can try the sneak peak build (https://github.com/user-attachments/files/19379759/LSMASHSource.zip) [before the official build comes out] that supports hardware accelerated decoding for Intel QSV [this one was broken before], d3d11va , dxva2.

prefer_hw=2 / Intel QSV
prefer_hw=4 / dxva2
prefer_hw=5 / d3d11va

EDIT:
Real world encoding benefit [those where short 10000 frames tests] - from ~3% upto 23.4% encoding speedup variation depending on a source file.


Source h264 720p:
dxva2 - 6.3%
d3d11va - 4.9%
Intel QSV - 4.9%

Source h264 1080p:
dxva2 - 2.7%
d3d11va - 3.6%
Intel QSV - 23.4%

Z2697
1st April 2025, 14:08
Here you can try the sneak peak build (https://github.com/user-attachments/files/19379759/LSMASHSource.zip) [before the official build comes out] that supports hardware accelerated decoding for Intel QSV [this one was broken before], d3d11va , dxva2.

prefer_hw=2 / Intel QSV
prefer_hw=4 / dxva2
prefer_hw=5 / d3d11va

EDIT:
Real world encoding benefit [those where short 10000 frames tests] - from ~3% upto 23.4% encoding speedup variation depending on a source file.


Source h264 720p:
dxva2 - 6.3%
d3d11va - 4.9%
Intel QSV - 4.9%

Source h264 1080p:
dxva2 - 2.7%
d3d11va - 3.6%
Intel QSV - 23.4%

That's gonna depend on the CPU and encoder settings you use.
A modern CPU can easily do hundreads of frames per second on single thread h264 1080p decoding.
Imagnine you doing the encoding at 10% the single thread decoding speed on a 16C CPU, by switching to HW decode you save 1/16*10% = 0.625% total CPU resource.

VoodooFX
1st April 2025, 14:55
That's gonna depend on the CPU and encoder settings you use.
Of course.
Those tests were done on 4 cores 11th Gen Intel CPU.

Z2697
1st April 2025, 20:16
Of course.
Those tests were done on 4 cores 11th Gen Intel CPU.

Did you check the GPU decoding engine usage? None of the prefer_hw option works on my system, with new builds. Old builds works fine.

poisondeathray
1st April 2025, 21:15
For that test build, prefer_hw=2 does not work for me either, but decoder="h264_qsv" works (when decoding a AVC stream).

Years ago, when both qsv and cuvid worked for old versions of lsmash, I didn't see much benefit for final encoding speed difference . Maybe 1-2% on a 1080 stream. 23.4% seems abnormally high for a 4 core

VoodooFX
2nd April 2025, 00:32
Did you check the GPU decoding engine usage? None of the prefer_hw option works on my system, with new builds. Old builds works fine.

"prefer_hw=2" in 20240408 1194 doesn't work for me, tested with 2th and 11th Gen CPUs. Same confirmed by Asd-g himself.
What's your CPU?

I didn't check actual GPU usage, but CPU usage is low and LSMASH itself reports that it works on GPU.

This is how you can check if it works:

# Official AvS 3.7.3
LWLibAvVideoSource("D:\xxxxx.mkv", prefer_hw=2)
Subtitle(LWLDECODER)



For that test build, prefer_hw=2 does not work for me either, but decoder="h264_qsv" works (when decoding a AVC stream).

Make sure that r1217 build is in use. What is your CPU?

Years ago, when both qsv and cuvid worked for old versions of lsmash, I didn't see much benefit for final encoding speed difference . Maybe 1-2% on a 1080 stream. 23.4% seems abnormally high for a 4 core

I don't remember if I tested hw with older builds. That looked weird for me too so I repeated the tests multiple times, same results. Encode was running above 100FPS, I think.

TR-7970X
3rd April 2025, 05:32
Make sure that r1217 build is in use.

I had some weird Avisynth issues with r1217 :(

I dont know what "height" means

r1205 was good :)

After pulling in a new job with RipBot264, which uses Lsmash, when doing a preview of the script in MPC-HC, it showed the above error.

Z2697
3rd April 2025, 15:14
"prefer_hw=2" in 20240408 1194 doesn't work for me, tested with 2th and 11th Gen CPUs. Same confirmed by Asd-g himself.
What's your CPU?

I didn't check actual GPU usage, but CPU usage is low and LSMASH itself reports that it works on GPU.

This is how you can check if it works:

# Official AvS 3.7.3
LWLibAvVideoSource("D:\xxxxx.mkv", prefer_hw=2)
Subtitle(LWLDECODER)





Make sure that r1217 build is in use. What is your CPU?



I don't remember if I tested hw with older builds. That looked weird for me too so I repeated the tests multiple times, same results. Encode was running above 100FPS, I think.

I only have CUVID available, I disabled the iGPU.

VoodooFX
3rd April 2025, 16:59
I had some weird Avisynth issues with r1217 :(

I dont know what "height" means

r1205 was good :)


Report it there [with more details than you provided here]: https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/issues

I only have CUVID available, I disabled the iGPU.

Oh, I don't have CUDA, try to report your issue.

leoenc
15th April 2025, 18:25
I'm suddenly getting the following error when compiling:
../../common/lwindex.c:58:10: fatal error: xxhash.h: No such file or directory
And the compilation fails.
It was working fine just a few days ago. I've tried apt install xxhash but it didn't help.

Here is the relevant part of my dockerfile (the error is on the last RUN command):
WORKDIR /prereq
RUN git clone https://git.videolan.org/git/ffmpeg.git
WORKDIR /prereq/ffmpeg
RUN mkdir -p /prereq/ffmpeg_build_minimal && \
./configure --prefix=/prereq/ffmpeg_build_minimal \
--enable-gpl --enable-version3 --disable-encoders \
--disable-muxers --disable-doc --disable-debug --enable-libdav1d \
--cpu=native --extra-cflags="-march=native" && \
make -j$(nproc) && \
make install

WORKDIR /prereq
RUN git clone https://github.com/dwbuiten/obuparse.git
WORKDIR /prereq/obuparse
RUN make && \
make install

WORKDIR /prereq
RUN git clone https://github.com/vimeo/l-smash.git
WORKDIR /prereq/l-smash
RUN ./configure --extra-cflags="-march=native -fPIC" && \
make -j$(nproc) && \
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

WORKDIR /prereq
RUN git clone https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works.git && \
mkdir -p /prereq/L-SMASH-Works/AviSynth/build
WORKDIR /prereq/L-SMASH-Works/AviSynth/build
RUN PKG_CONFIG_PATH=/prereq/ffmpeg_build_minimal/lib/pkgconfig LDFLAGS="-Wl,-Bsymbolic" meson setup .. && \
ninja && \
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

StvG
15th April 2025, 19:53
xxHash is submodule (https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/commit/42157a2c2c2aef5c548295dbf985fcaff36ac27e).
Either change RUN git clone https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works.git to RUN git clone --recurse-submodules https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works.git and change building to the official one - with CMake.
Or change in lwindex.c #include "xxhash.h" to #include <xxhash.h> in order to use the system xxHash you installed.

Xuqiwu
15th April 2025, 20:20
Looks like Asd-g and co is close to release a new version.

So he has made new test builds 2 days ago.

https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/issues/94#issuecomment-2799927594

LigH
18th June 2025, 18:35
I noticed that MPEG-1 video gets decoded with doubled frames in field rate, e.g. NTSC 352x240 with 29.97 fps becomes 59.94 fps with identical odd and even frames. Can't tell for sure yet, not much tested so far.

Katie Boundary
7th August 2025, 20:36
Does an XP-compatible version of this exist? FFmpegsource is having some problems decoding the audio from one of my files.