View Full Version : 2023 status of tools to open H.264/mpeg4 files
TCmullet
30th May 2023, 11:58
Over the years since 2012 when I got Hauppauge H.264 capture systems, I can recall 3 ways I've used to open such files. There are pros and cons to each. I'd like to see the experts here give the "state of the art" (pros and cons) in this. My knowledge and experience so far is:
1. I've used DGIndexNV (DGSource function).
2. ffvideosource() and ffaudiosource() functions.
3. (Long ago) something I recall called "LSmash" or something.
This FAQ does not have all of these and the options it does give there are to me generally unacceptable.
http://avisynth.nl/index.php/FAQ_loading_clips
Here's my pros and cons:
1. DGIndexNV:
Pro: It's rock solid frame accurate every time.
Cons:
A. It requires running an indexer first, then converting the encoded audio to .wav before using WavSource() to open the audio in Avisynth. Tedious steps if you have a lot of videos to process. (Could double or more the time needed in creating scripts from a skeleton. This labor can be the bottleneck when many scripts need to be created rapidly.)
B. I have to pay a license for each computer I run DGIndexNV on, plus it's a very complex process to install the license on any one PC. Price is not bad FOR A DEVELOPMENT environment. But I want to create Avisynth scripts (.avs) to run on any PC (to play a video) without buying or installing licenses, nor running preliminary steps (create index or convert audio).
2. ffvideosource() and ffaudiosource(). (I don't remember how I installed these.)
Pros:
A. It's free.
B. No preprocessing steps needed. (It builds it's own index as needed.) This is great if I have to create a lot of scripts and run them quickly with a minimum of labor.
C. It can easily correct VFR sources merely by including a couple of parameters as function parameters (fpsnum=30000,fpsden=1001 or such).
Cons:
It's notorious for supplying the wrong video frames when you do timeline scrubbing, and maybe other situations too. If I have to have perfect frame selection in the opening seconds of the video, I can't trust this tool.
3. Lsmash. I regret I don't remember anything about it as I haven't used it since discovering DGIndexNV years ago. I surely must have stopped using it because of some disadvantage. I did a search and found this:
http://avisynth.nl/index.php/LSMASHSource
Is THIS the state of the art now? Can someone please comment?
4. Is there some other open tool for H264 that I don't know about?
It would sure be nice if AviSynth had enough INTERNAL features so that installing AviSynth by itself would be enough to run everything needed and not have to install a bunch of external filters to run. Every other computer programming language I've used (spanning 1972 to 2010 or so) had built-in "file open" commands or functions.
My motivation in this is based on a radical shift in playback philosophy that I've been pushed to embrace. That is, shift as much processing as possible to the playback stage rather than doing it all before the user sees it. (I've ALWAYS felt the opposite.) The goal is to preserve the original footage as much as possible, knowing that playback abilities improve over time as processors improve. I want the USER to run my script, not me.
StainlessS
30th May 2023, 13:07
DGIndexNV (DGSource [EDIT: DgDecNv]) is now free.
LSmash is (IMHO) the one for ISO files,
LSMASHVideoSource/LSMASHAudioSource for ISO, otherwise LWLibavVideoSource/LWLibavAudioSource, for anything else.
Some ISO file containers [All good for LSmashVideoSource(), maybe I missed some out]
# Requires RT_Stats
Function IsISOFileName(String s) {s=RT_GetFileExtension(s) Return(s==".mov"||s==".mp4"||s==".m4v"||s==".3gp"||s==".3g2"||s==".mj2"||s==".dvb"||s==".dcf"||s==".m21")}
From here:- https://forum.doom9.org/showthread.php?p=1874022#post1874022
Perhaps also of interest,
Avisynthesizer_Mod
A SendTo App that allows Windows Explorer selection of video files and fills in a user supplied Template with the filenames.
Can concatenate (join/splice) selected files (default as original non mod version) and create a single output AVS file OR,
batch create multiple AVS files, one for each input source file (MOD version only).
Has a GUI to select required template and sort input files if multiple input files selected.
https://forum.doom9.org/showthread.php?t=166820
Example of Batch mode
----------------------------------------------------------------------
--------- BATCH MODE TEMPLATE ----------------------------------------
----------------------------------------------------------------------
Here a Batch Mode template (NOT enclosed in square brackets)
A script will be generated for each file SendTo Avisynthesizer_Mod.
>>>>>>>>>>> TEMPLATE START >>>>>>>>>>>>>>>
#ASYNTHER BATCH-AVISOURCE
# Above line (preceded by '#ASYNTHER') shows as "BATCH-AVISOURCE" in the Avisynthesizer_Mod GUI.
FileCount = ___FILECNT___ # Should always be set to 1 in non-repeating Batch template.
# Below not enclosed in square brackets, so is Non-Repeating ie Batch Mode.
# Batch Mode == Multiple AVS files generated, one for each selected file SendTo Avisynthsizer_Mod.
AVISource("___FILE___")
<<<<<<<<<<< TEMPLATE END <<<<<<<<<<<<<<<<<
Stuff in red is NOT part of the template (is from doc's)
1--BATCH-AVISOURCE.avs (where 1.avi, 2.avi, and 3.avi sendTo Avisynthesizer_Mod [Only 1st script for "1.avi" shown]), generated script
#ASYNTHER BATCH-AVISOURCE
# Above line (preceded by '#ASYNTHER') shows as "BATCH-AVISOURCE" in the Avisynthesizer_Mod GUI.
FileCount = 1 # Should always be set to 1 in non-repeating Batch template.
# Below not enclosed in square brackets, so is Non-Repeating ie Batch Mode.
# Batch Mode == Multiple AVS files generated, one for each selected file SendTo Avisynthsizer_Mod.
AVISource("C:\Z\1.avi")
EDIT: Updates for some tools appears in this thread, New versions of free software used in the GUI's :- https://forum.doom9.org/showthread.php?t=184719
DgDecNv :- https://www.rationalqm.us/dgdecnv/binaries/
EDIT: List of command-line and batch utilities for AVISynth (and a few discussions) (Some Avisynthesizer_Mod alternatives)
https://forum.doom9.org/showthread.php?t=96451
Reel.Deel
30th May 2023, 21:30
@TCmullet
DGIndexNV
A) Why not just open the audio file with an audio source filter? There's a few options: http://avisynth.nl/index.php/External_filters#Source_Filters
B) As StainlessS mentioned, it has been free since April 2021. See https://forum.doom9.org/showthread.php?t=182778
FFmpegSource and LSMASHSource
These two are comparable as they both use FFmpeg to decode. Sometimes one may work better than the other. The advantage LSMASHSource has is that LSMASHVideoSource and LSMASHAudioSource can open ISO base media file formats without indexing.
FAQ loading clips wiki page
Yes this page is not up to date.
TCmullet
30th May 2023, 23:08
Thanks, guys. You've given me stuff to chew on. But what is "ISO"? I know ISO files are images of CDs, DVDs, etc. But what's that got to do with mpeg4 TS (transport stream) video files?
poisondeathray
30th May 2023, 23:34
Thanks, guys. You've given me stuff to chew on. But what is "ISO"? I know ISO files are images of CDs, DVDs, etc. But what's that got to do with mpeg4 TS (transport stream) video files?
https://en.wikipedia.org/wiki/ISO_base_media_file_format
StainlessS
31st May 2023, 09:21
ISO [IIRC] just stands for International Standards Organization.
EDIT: Looked it up, they call themselves "International Organization for Standardization":- https://www.iso.org/home.html
ISO container file is any one of below [EDIT: filename extension type] in blue, [its possible that I missed one or two out]
# Requires RT_Stats
Function IsISOFileName(String s) {s=RT_GetFileExtension(s) Return(s==".mov"||s==".mp4"||s==".m4v"||s==".3gp"||s==".3g2"||s==".mj2"||s==".dvb"||s==".dcf"||s==".m21")}
MKV file, even if contains h.264/x264, will not open in LSmashVideoSource as it is not an ISO type container file.
TCmullet
31st May 2023, 16:03
@TCmullet
Why not just open the audio file with an audio source filter?
You're partly missing my point. I don't want to run a separate step before running the script. AND running it creates a separate audio file WITH a radically different filename. This rules out DGIndexNV (nice that it's free now, thank you.) This rules IN the ffvideosource/ffaudiosource option, as both video and audio are pulled from the one file (it creates it's index file on the fly with NO extra step required) and it's ONE file name to type into my script.
I don't want a separate audio file coming out of an extraction step, nor do I want to enter TWO names into the script. I want to code the script, entering ONE filename for my .mp4 or .ts, and GO. I've got 900 video files to do (450 laserdisc movies with average of 2 sides per title). AND, just the other day, it was suggested that I embark on a project to process over 600 half-hour videos! No money in this latter; just donating to mankind some helpful videos. I'm nearly 70... I may be dead before I get done! (But I'm personally shooting for 130.)
StainlessS
31st May 2023, 16:43
I don't want a separate audio file coming out of an extraction step, nor do I want to enter TWO names into the script. I want to code the script, entering ONE filename for my .mp4 or .ts, and GO. I've got 900 video files to do (450 laserdisc movies with average of 2 sides per title). AND, just the other day, it was suggested that I embark on a project to process over 600 half-hour videos! No money in this latter; just donating to mankind some helpful videos. I'm nearly 70... I may be dead before I get done! (But I'm personally shooting for 130.)
Well then the Avisynthesizer_Mod thingy sounds like it is ideal for you.
Create your template, ONCE.
When you have a dozen or two clips to process, just group select the lot in Windows Explorer, right click and SendTo Avisynthesizer_Mod. Choose the template you want to use, click OK. And it will batch produce all the AVS scripts for you.
Easy-peasy.
DGIndex and DGIndexNV also both support templates for processing both video and audio in the auto created single avs script.
Reel.Deel
31st May 2023, 17:04
You're partly missing my point. I don't want to run a separate step before running the script. AND running it creates a separate audio file WITH a radically different filename. This rules out DGIndexNV (nice that it's free now, thank you.) This rules IN the ffvideosource/ffaudiosource option, as both video and audio are pulled from the one file (it creates it's index file on the fly with NO extra step required) and it's ONE file name to type into my script.
I don't want a separate audio file coming out of an extraction step, nor do I want to enter TWO names into the script. I want to code the script, entering ONE filename for my .mp4 or .ts, and GO. I've got 900 video files to do (450 laserdisc movies with average of 2 sides per title). AND, just the other day, it was suggested that I embark on a project to process over 600 half-hour videos! No money in this latter; just donating to mankind some helpful videos. I'm nearly 70... I may be dead before I get done! (But I'm personally shooting for 130.)
I'm not sure what the problem is.
path = "E:\myvideo.ts"
v = FFVideoSource(path) # LWLibavVideoSource
a = FFAudioSource(path) # LWLibavAudioSource
AudioDub(v,a)
If you encode this with FFmpeg or another AviSynth supported GUI it will create one file with both audio and video.
Not sure what you mean by "a separate audio file coming out of an extraction step". Sounds like you're taking an extra step yourself :confused:
Just curious, what type of processing are you planning to do to the videos?
StainlessS
31st May 2023, 17:20
Maybe he talks about the likes of DGIndex and DGIndexNV, which produces a separate audio file.
But, in that case can use template something like this [untested].
A DgIndexNV template with .avs extension, in DgDecNv Template folder, and chosen in the settings.
VideoFileName ="__vid__"
AudioFileName ="__aud__"
AudioDelay =Value("__del__")
Video = DgSource(VideoFileName) # for DgIndexNV, or for DgIndex Mpeg2Source(VideoFileName)
Audio = LWLibavAudioSource (AudioFileName)
AudioDub(Video,Audio).DelayAudio(AudioDelay).Trim(0,0) # Trim, chop/add audio to length
#AssumeTFF or AssumeBFF. But I think, MPeg2Source and DgSource both auto set field order.
Return Last
Emulgator
31st May 2023, 23:43
Maybe AutoPath can help. Copy the filename onto the script, the script derives the source filter, path and you are done.
I am using it daily for a year now and I think it is ready to be published.
https://forum.doom9.org/showthread.php?p=1987845#post1987845
Reel.Deel
1st June 2023, 01:27
Maybe he talks about the likes of DGIndex and DGIndexNV, which produces a separate audio file.
But, in that case can use template something like this [untested].
[/CODE]
But there should not be a need to extract audio. Both FFAudioSource and LSMASH can read just the audio in the original container.
StainlessS
1st June 2023, 01:33
Both FFAudioSource and LSMASH can read just the audio in the original container.
but when original is VTS_01_1.VOB + VTS_01_2.VOB + VTS_01_3.VOB + VTS_01_4.VOB
Then what ?
EDIT:
Emulgator, maybe long paths for W10 are handy. [only a fix for eg W10 Windows Explorer, not for apps that dont adapt/support it]
ENABLE_W10_LongPath.reg
Windows Registry Editor Version 5.00
; created by Walter Glenn
; for How-To Geek
; article: http://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001
DISABLE_W10_LongPath.reg
Windows Registry Editor Version 5.00
; created by Walter Glenn
; for How-To Geek
; article: http://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000000
TCmullet
1st June 2023, 03:11
But there should not be a need to extract audio. Both FFAudioSource and LSMASH can read just the audio in the original container.
Yes, Reel, that was my point. The original multiplexed TS file is the original container, and with them you don't have to extract them (having a separate extract step); simply refer to them in the script and they invisibly create the needed index.
StainlessS
1st June 2023, 03:51
Oops yes, OP is for ISO file, so mutli VOB not an issue.
Emulgator
1st June 2023, 19:48
Thanks StainlessS for the Longpath regkey !
TCmullet
23rd July 2023, 21:54
First, let me say I'm not happy with github's terrible lack of clarity for those who aren't members of their elite superbrains. It's never clear as to HOW to download an installable program. So for those who may be even blinder than I, I've somewhat figured it out:
Here's is LSmash doc:
http://avisynth.nl/index.php/LSMASHSource
In the upper right corner, a link for downloading appears and takes you here:
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/
That takes you to the site I always dread, github.com. With no instructions whatsoever that you're supposed to do this, I hovered mouse over the bold word 20230716. It IS a clickable link. Upon clicking it or the word "latest" next to it, it takes you here:
https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/tag/20230716
This is probably where github stinks the worst. It tells you nothing about what to do next. It lists "used libraries", which I think we don't want. Then it lists "assets" which includes 2 sets of source files. Well, I want to use the executable, not re-program it, therefore skipping "source" files, that leaves one left to try. But sadly it's not the familiar .exe (installer) or .zip. It's the unnecessary (IMHO) .7z format. I just happened to have 7zip, so I saved the .7z file and expanded it. I found a LSMASHSource.dll (my "executable") for 32-bit and for 64-bit processors. As I have a 64-bit processor, I copied that one into my plugins folder.
I ran my script which contains:
myfile="2010 The Year We Make Contact.4movie.1080i30.tcm.c2-tv.ed-20m.TS"
video=LSMASHVideoSource(myfile)
audio=LSMASHAudioSource(myfile)
AudioDub(video,audio)
Avisynth threw an error back at me via the Virtualdub interface saying "There is no function named LSMASHvideosource". I figured that it's because though my system is 64-bit, my Virtualdub is not. Therefore I copied the .dll from the x86 folder (32-bit). I believe that was the problem, based on the next error message that came out. It can find the function, but the function cannot find the file. Yet I know the file IS in the same folder with the .avs file. The error message is: "Failed to read an input file".
Please look at my script code above and tell me if you see anything wrong with it.
poisondeathray
23rd July 2023, 23:16
I ran my script which contains:
myfile="2010 The Year We Make Contact.4movie.1080i30.tcm.c2-tv.ed-20m.TS"
video=LSMASHVideoSource(myfile)
audio=LSMASHAudioSource(myfile)
AudioDub(video,audio)
Avisynth threw an error back at me via the Virtualdub interface saying "There is no function named LSMASHvideosource". I figured that it's because though my system is 64-bit, my Virtualdub is not. Therefore I copied the .dll from the x86 folder (32-bit). I believe that was the problem, based on the next error message that came out. It can find the function, but the function cannot find the file. Yet I know the file IS in the same folder with the .avs file. The error message is: "Failed to read an input file".
Please look at my script code above and tell me if you see anything wrong with it.
"Failed to read an input file".
Transport streams require LWLibavVideoSource/LWLibavAudioSource, and this will generate an index (might take some time, depending on how large the file is and your hardware)
MP4, MOV, ISO base media can be opened with LSmashVideoSource/LSmashAudioSource without indexing
You can use vdub2 x64 to "call" avisynth x64 scripts
TCmullet
23rd July 2023, 23:49
> "Transport streams require LWLibavVideoSource"
I was not clear that .TS files are not a type of ISO file. I changed to:
video=LWLibavVideoSource(myfile)
audio=LWLibavAudioSource(myfile)
Worked great. Thanks!
Apparently, it's part of the LSMASHSource.dll, as I didn't have to find and store any additional dll into plugins folder.
The fact that it creates an index is no worse than that for ffvideosource. Yes, it's several times bigger, but it's much more frame accurate that ffvideosource.
StainlessS
24th July 2023, 08:26
Untested. # Requires RT_Stats
myfile=".\2010 The Year We Make Contact.4movie.1080i30.tcm.c2-tv.ed-20m.TS" # ".\" at start, means in current directory
IsISO = IsISOFileName(myFile) # Is it type ISO file (LSmashVideo/LSmashAudio, ELSE LWLibavVideoSource/LWLibavAudioSource)
video = (IsISO) ? LSMASHVideoSource(myfile) : LWLibavVideoSource(myfile)
audio = (IsISO) ? LSMASHAudioSource(myfile) : LWLibavAudioSource(myfile)
AudioDub(video,audio)
Trim(0,0) # Trim, chop/pad audio to SAME length
# AssumeTFF # or AssumeBFF, not sure if LSmash auto sets field order
# ...
Return Last
# Requires RT_Stats
Function IsISOFileName(String s) {s=RT_GetFileExtension(s) Return(s==".mov"||s==".mp4"||s==".m4v"||s==".3gp"||s==".3g2"||s==".mj2"||s==".dvb"||s==".dcf"||s==".m21")}
EDIT: Or below version of IsISOFileName() does NOT require RT_Stats
# DOES NOT Require RT_Stats
Function IsISOFileName(String s) {s=GetFilenameExtension(s) Return(s==".mov"||s==".mp4"||s==".m4v"||s==".3gp"||s==".3g2"||s==".mj2"||s==".dvb"||s==".dcf"||s==".m21")}
Function GetFilenameExtension(String fn) {
fn=fn.RevStr i1=fn.FindStr("\") i2=fn.FindStr("/")
i=(i1==0) ? i2 : (i2==0) ? i1 : min(i1,i2)
fn=(i>0) ? Fn.LeftStr(i-1) : fn
i=fn.FindStr(".")
Return (i>0)?fn.LeftStr(i).RevStr:""
}
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.