View Full Version : FFmpegSource
wonkey_monkey
29th May 2020, 00:01
I've run into a problem with FFmpegSource, and I'm not sure if it isn't just something which is already understood to happen and just doesn't affect most users.
https://filebin.net/ycobtv5flicijv2e/trim.ts?t=9ldisa80
I can open this file with VirtualDub via Avisynth and ffmpegsource2 and I can step forward through it frame-by-frame without problems. The trouble starts when I try to step through it backwards - once they fall out of whatever caches they might be in (e.g. by advancing past frame 50), frames 24 and 25 become duplicates of frame 26. This is a problem because the filters I want to call on this clip do a lot of random access and the end result suffers from these duplicates even when stepped through forwards.
seekmode = 0 fixes it, but is impractical since the source file has 180000 frames and it takes several minutes to seek into the middle of the file.
Is there any other way to avoid this, or is there another source filter (edit: an x64 one, since my project is ravenous for RAM) for h.264/.ts that won't exhibit this behaviour? (apart from DGIndexNV, which I know would work fine but my new laptop isn't compatible with it).
poisondeathray
29th May 2020, 00:37
@w_m , lsmash works ok , HolyWu branch
https://github.com/HolyWu/L-SMASH-Works/releases
wonkey_monkey
29th May 2020, 01:02
Thanks, I'll give it a try.
ffmpegsource also seems to have a habit of silently killing VirtualDub at random. Hopefully LSmash won't do that either.
wonkey_monkey
29th May 2020, 13:13
@w_m , lsmash works ok , HolyWu branch
https://github.com/HolyWu/L-SMASH-Works/releases
It (LWLibavVideoSource) doesn't cause frames 24 and 25 to become duplicates of 26... but it does cause frame 55 to become a duplicate of frame 56 :(
You can also exhibit this behaviour by adding the "reverse" filter and stepping through forwards.
manolito
29th May 2020, 16:18
For me seeking in transport stream has always been problematic, even when using an indexing source filter. I made it a habit to repack transport streams into an MKV container before I do anything else to them.
Tested your sample, and after using MKVToolNix to repack the file all my source filters (even DSS2Mod) behaved nicely.
poisondeathray
29th May 2020, 16:42
It (LWLibavVideoSource) doesn't cause frames 24 and 25 to become duplicates of 26... but it does cause frame 55 to become a duplicate of frame 56 :(
You can also exhibit this behaviour by adding the "reverse" filter and stepping through forwards.
threads=1 looks ok, but slower
Does that computer not have nvidia card ? Interesting that gpu decoding with decoder="h264_cuvid" works (or prefer_hw=1) , but intel QS does not on that clip (prefer_hw=2)
Tested your sample, and after using MKVToolNix to repack the file all my source filters (even DSS2Mod) behaved nicely.
This did not work for me using ffms2 or lsmash x64 (same problem); and dss2 x64 drops the last frame
stax76
29th May 2020, 16:56
In my experience it's better to use ffmpeg to remux ts to mkv, that is the default handling in staxrip, mkvmerge is fine for playback but not so for editing, causes sync issues.
wonkey_monkey
29th May 2020, 18:05
Well this is a minefield...
Results of remuxing to MKV (with ffmpeg):
LWLibavVideoSource: still skips frame 55
LSmashVideoSource: doesn't open this container
FFMpegSource2: seems to work okay so far
Results of remuxing to MP4 (with ffmpeg):
LWLibavVideoSource: still skips frame 55
LSmashVideoSource: First two frames get repeated, a couple of later frames get skipped. Definite no-go.
FFMpegSource2: Freezes on the first few frames, skips a couple of later frames (despite claiming to be frame accurate on Avisynth wiki)
--------------------------------------------------------------------------------------------------------
Is this all as expected?
qyot27
29th May 2020, 18:34
It may be the method you're using to rip the Blu-ray. If I have to, I make a full-disc decrypted backup with MakeMKV (arguably you could maybe do a more restricted rip using BlurayTestAndDecrypt and libaacs/KEYDB.cfg, but you'd lose the disc structure), and then use mkvmerge to remux the main title to MKV by giving it the index.bdmv to parse. No demuxing to elementary streams and then remuxing them into other containers, if that's where the .ts sample came from.
I say this because there was a point, not sure how long ago exactly or if it's been fixed since, that MakeMKV's Matroska output acted strangely when given to source filters (or maybe it was eac3to? Like I said, it was a while ago). The simplest way to sidestep the problem is not to let MakeMKV make an MKV of whatever you're ripping.
Atak_Snajpera
29th May 2020, 19:37
Well this is a minefield...
Results of remuxing to MKV (with ffmpeg):
LWLibavVideoSource: still skips frame 55
LSmashVideoSource: doesn't open this container
FFMpegSource2: seems to work okay so far
Results of remuxing to MP4 (with ffmpeg):
LWLibavVideoSource: still skips frame 55
LSmashVideoSource: First two frames get repeated, a couple of later frames get skipped. Definite no-go.
FFMpegSource2: Freezes on the first few frames, skips a couple of later frames (despite claiming to be frame accurate on Avisynth wiki)
--------------------------------------------------------------------------------------------------------
Is this all as expected?
I can confirm. Remuxing to mkv with mkvtoolnix solves nothing
https://i.postimg.cc/NMh37s2w/Untitled-1.png
wonkey_monkey
29th May 2020, 21:06
I'd forgotten about Seek Tester! Definitely going to put that to some good use.
Does it seek forward and store a hash per frame, or something, and then seek randomly and test the hashes to see which frames are returned?
kedautinh12
27th July 2020, 01:19
Any update FFmpegSource with FFmpeg 4.3.1??
StvG
21st August 2020, 22:35
ffms2 (https://cloud.owncube.com/s/tcwyzNJ6LgD2iN7):
- ffmpeg n4.4@1c7e55dd50;
- zlib 1.2.11;
- dav1d 0.7.1.
kedautinh12
22nd August 2020, 01:01
ffms2 (https://cloud.owncube.com/s/tcwyzNJ6LgD2iN7):
- ffmpeg n4.4@1c7e55dd50;
- zlib 1.2.11;
- dav1d 0.7.1.
Thanks
Myrsloik
22nd August 2020, 13:01
FFMS 2.40-RC1 (https://github.com/FFMS/ffms2/releases/tag/2.40-RC1)
Test it. Don't bitch about missing libraries (apart from zlib but I think I got that one included).
kedautinh12
22nd August 2020, 13:35
FFMS 2.40-RC1 (https://github.com/FFMS/ffms2/releases/tag/2.40-RC1)
Test it. Don't bitch about missing libraries (apart from zlib but I think I got that one included).
Thanks
ChaosKing
22nd August 2020, 14:46
My results:
https://i.imgur.com/S2Y6JY3.png
Myrsloik
22nd August 2020, 16:07
My results:
What's different in the stvg builds? From what I can tell the results should be more similar.
StvG
22nd August 2020, 17:26
This (https://pastebin.com/raw/0wS5syun) is the patch for my builds.
StainlessS
22nd August 2020, 17:55
Impressive update, thanks.
Myrsloik
22nd August 2020, 18:51
This (https://pastebin.com/raw/0wS5syun) is the patch for my builds.
Oh, mostly a rollback of the still partial VP9 fixes and such. Can't please all formats at once I guess.
amayra
23rd August 2020, 07:59
there any reason for not using GitHub Actions or appveyor ?
Myrsloik
23rd August 2020, 11:18
My results:
Where can I find all the test clips?
ChaosKing
23rd August 2020, 11:57
You can find 70% of the clips here https://www.dropbox.com/sh/bxwibb20m8rnnro/AABmPSXEWGgE7nBK-PvwyU6Aa?dl=0
Others are bigger vob files etc that I can't upload.
(you can set dl=1 to download all files as zip)
kedautinh12
23rd August 2020, 12:14
You can find 70% of the clips here https://www.dropbox.com/sh/bxwibb20m8rnnro/AABmPSXEWGgE7nBK-PvwyU6Aa?dl=0
Others are bigger vob files etc that I can't upload.
(you can set dl=1 to download all files as zip)
Can you up 30% to google drive??
ChaosKing
23rd August 2020, 12:22
I uploaded some missing clips. Should be enough test files now.
StainlessS
23rd August 2020, 14:45
Chaos, perhaps you got some of them from here in usage sticky[Consolidated list of test video clip resources ]:-
https://forum.doom9.org/showthread.php?t=135034
Some of those are truly massive[like maybe 500GB for some lossless IIRC].
Myrsloik
24th August 2020, 15:34
2.40 released (https://github.com/FFMS/ffms2/releases/tag/2.40)
Identical to RC1.
Have a look at BestAudioSource (https://forum.doom9.org/showthread.php?t=177337) for all your audio needs!
kedautinh12
25th August 2020, 02:21
2.40 released (https://github.com/FFMS/ffms2/releases/tag/2.40)
Identical to RC1.
Have a look at BestAudioSource (https://forum.doom9.org/showthread.php?t=177337) for all your audio needs!
Same error with STvG ver
log:
-[Information] Versions
--[Information] MeGUI: 2913 x64
--[Information] MeGUI Debug Data: available
--[Information] Update Check: development update server
-[Information] Operating System: Windows 10 Pro 1909 x64 (10.0.18363.720)
-[Information] .NET Framework: 4.0 (4.0.0.0)
-[Information] .NET Framework: 4.8 (4.8.03752)
-[Information] Microsoft Visual C++ 2005 x64: 8.0.61000
-[Information] Microsoft Visual C++ 2005 x86: 8.0.61001
-[Information] Microsoft Visual C++ 2010 x64: 10.0.40219
-[Information] Microsoft Visual C++ 2010 x86: 10.0.40219
-[Information] Microsoft Visual C++ 2012 x64: 11.0.61030
-[Information] Microsoft Visual C++ 2012 x86: 11.0.61030
-[Information] Microsoft Visual C++ 2013 x64: 12.0.40664
-[Information] Microsoft Visual C++ 2013 x86: 12.0.40664
-[Information] Microsoft Visual C++ 2015-2019 x64: 14.24.28127
-[Information] Microsoft Visual C++ 2015-2019 x86: 14.24.28127
-[Information] Redistributables
-[Information] DPI: 100% (96/96)
-[Information] Resolution: 1366x768
-[Information] Primary Screen: True
-[Information] Monitor 1
--[Information] System Information
-[Information] Update detection
-[Information] Haali Media Splitter: 1.13.138.14 (14-04-2013)
-[Information] Haali DSS2: 2.0.0.13 (01-01-2019)
-[Information] ICSharpCode.SharpZipLib: 0.85.5.452 (07-08-2008)
-[Information] MediaInfo: 18.05.0.0 (08-05-2018)
-[Information] SevenZipSharp: 0.64.3890.29348 (02-01-2011)
-[Information] 7z: 9.20 (18-11-2010)
--[Information] Component Information
-[Information] Version: 1.0.2847.0
-[Information] Date: 06-05-2018
-[Information] Interface: 3
-[Information] AviSynth Wrapper
-[Information] AviSynth Status: ignored as portable build is forced
-[Information] AviSynth
--[Information] [4/11/2020 8:02:09 AM] Cannot use update server http://megui.org/auto/. Reason: Update server is not available
--[Information] [4/11/2020 8:02:09 AM] Cannot use update server http://megui.tmebi.de/test/. Reason: Update server is not available
--[Information] [4/11/2020 8:02:09 AM] Using cached update config and server: http://megui.tmebi.de/test/
--[Information] [4/11/2020 8:02:09 AM] No package requires an update
-[Information] File Version: 3.5
-[Information] File Date: 02-04-2020
-[Information] File Name: AviSynth+ 3.5 (r3106, 3.5, x86_64)
-[Information] File Path: e:\megui-2913-64\avisynth.dll
-[Information] AviSynth Version: AviSynth+ 3.5 (r3106, 3.5, x86_64)
-[Information] AviSynth+: true
-[Information] AviSynth MT: true
-[Information] AviSynth Status: active
-[Information] AviSynth portable
--[Information] AviSynth Information
-[Information] FileIndexer
--[Information] [4/11/2020 8:02:25 AM] MediaInfo
---[Information] File: C:\Users\84945\Downloads\Video for test\Hikoutei - King Gnu.ts
-[Information] Format: MPEG-TS
-[Information] FileSize: 147849216
-[Information] PlayTime: 00:04:22.912
---[Information] General
-[Information] ID: 4352
-[Information] StreamOrder: 0-0
-[Information] CodecID: 27
-[Information] Format: AVC
-[Information] FormatInfo: Advanced Video Codec
-[Information] Width: 1440
-[Information] Height: 1080
-[Information] FrameCount: 7852
-[Information] FrameRate: 29.970
-[Information] Duration: 00:04:21.995
-[Information] ScanType: Interlaced
-[Information] Bits Depth: 8
-[Information] AspectRatio: 1.778
-[Information] AspectRatioString: 16:9
-[Information] PixelAspectRatio: 1.333
-[Information] Delay: 1079.911
---[Information] Video
-[Information] ID: 4353
-[Information] StreamOrder: 0-1
-[Information] CodecID: 15
-[Information] Format: AAC
-[Information] FormatVersion: Version 2
-[Information] FormatInfo: Advanced Audio Codec
-[Information] FormatProfile: LC
-[Information] Muxing Mode: ADTS
-[Information] SamplingRate: 48000
-[Information] SamplingRateString: 48.0 kHz
-[Information] Channels: 2
-[Information] ChannelsString: 2 channels
-[Information] ChannelPositionsString2: 2/0/0
-[Information] BitRateMode: VBR
-[Information] Delay: 1079.911
-[Information] [4/11/2020 8:02:26 AM] The language information is not available for this track. The default MeGUI language has been selected.
---[Information] Audio
-[Information] Log for job1 (idx, Hikoutei - King Gnu.ts -> Hikoutei - King Gnu.ts.ffindex)
--[Information] [4/11/2020 8:02:28 AM] Started handling job
--[Information] [4/11/2020 8:02:28 AM] Preprocessing
--[Information] [4/11/2020 8:02:28 AM] Job command line: "E:\MeGUI-2913-64\tools\ffms\ffmsindex.exe" -t -1 -f "C:\Users\84945\Downloads\Video for test\Hikoutei - King Gnu.ts" "C:\Users\84945\Downloads\Video for test\Hikoutei - King Gnu.ts.ffindex"
--[Information] [4/11/2020 8:02:28 AM] Process started
--[Information] [4/11/2020 8:02:28 AM] Standard output stream
--[Information] [4/11/2020 8:02:28 AM] Standard error stream
---[Information] [4/11/2020 8:02:31 AM] Writing index... done.
--[Information] [4/11/2020 8:02:35 AM] MediaInfo
---[Information] File: C:\Users\84945\Downloads\Video for test\Hikoutei - King Gnu.ts.ffindex
-[Information] FileSize: 85117
---[Information] General
--[Information] [4/11/2020 8:02:35 AM] Postprocessing
---[Information] [4/11/2020 8:02:40 AM] Deleting intermediate files
--[Information] [4/11/2020 8:02:40 AM] Job completed
-[Information] AVS Script Creator
--[Warning] [4/11/2020 8:02:40 AM] Could not read frame: FFVideoSource: Out of bounds frame requested
--[Warning] [4/11/2020 8:02:41 AM] Could not read frame: FFVideoSource: Out of bounds frame requested
kedautinh12
25th August 2020, 03:24
video test: https://drive.google.com/file/d/1BlzSQ-xD1ct9sEriL1n6YtfyPf1bJpT1/view?usp=sharing
tebasuna51
25th August 2020, 10:29
video test: https://drive.google.com/file/d/1BlzSQ-xD1ct9sEriL1n6YtfyPf1bJpT1/view?usp=sharing
Denied access
Myrsloik
25th August 2020, 11:00
video test: https://drive.google.com/file/d/1BlzSQ-xD1ct9sEriL1n6YtfyPf1bJpT1/view?usp=sharing
.ts? .TS?
That's simply unsupported and has never worked well. Remux into a real container and try again.
kedautinh12
25th August 2020, 11:27
.ts? .TS?
That's simply unsupported and has never worked well. Remux into a real container and try again.
i seen work normal with 2.23.1
LigH
25th August 2020, 12:01
Anyway, let mkvtoolnix remultiplex it to MKV and you are on a pretty solid base.
kedautinh12
25th August 2020, 12:53
Denied access
I was seted permission
StvG
13th October 2020, 06:52
ffms2 (https://cloud.owncube.com/s/C3ELrqtA5braszk):
- ffmpeg n4.4@9b72cea446;
- zlib 1.2.11;
- dav1d 0.7.1;
- set frame properties - _DurationNum (int), _DurationDen (int), _AbsoluteTime (float), _SARNum (int), _SARDen (int), _Matrix (int), _Primaries (int), _Transfer (int), _ChromaLocation (int), _ColorRange (int), _PictType (string), _FieldBased (int), MasteringDisplayPrimariesX (float array), MasteringDisplayPrimariesY (float array), MasteringDisplayWhitePointX (float), MasteringDisplayWhitePointY (float), MasteringDisplayMinLuminance (float), MasteringDisplayMaxLuminance (float), ContentLightLevelMax (float), ContentLightLevelAverage (float).
real.finder
13th October 2020, 10:31
ffms2 (https://cloud.owncube.com/s/C3ELrqtA5braszk):
- ffmpeg n4.4@9b72cea446;
- zlib 1.2.11;
- dav1d 0.7.1;
- set frame properties
thanks! I hope the ffms2 guys add the patch to https://github.com/FFMS/ffms2
edit: seems audio don't has new avs+ properties, right? but seems there are "BASCHANNEL_LAYOUT and BASVALID_BITS" in https://forum.doom9.org/showthread.php?t=177337
aside from that and slightly off-topic asd also added frame properties https://github.com/Asd-g/MPEG2DecPlus/releases so the only one left is LSMASHSource (lets hope HolyWu do it soon)
kedautinh12
13th October 2020, 11:00
ffms2 (https://cloud.owncube.com/s/C3ELrqtA5braszk):
- ffmpeg n4.4@9b72cea446;
- zlib 1.2.11;
- dav1d 0.7.1;
- set frame properties - _DurationNum (int), _DurationDen (int), _AbsoluteTime (float), _SARNum (int), _SARDen (int), _Matrix (int), _Primaries (int), _Transfer (int), _ChromaLocation (int), _ColorRange (int), _PictType (string), _FieldBased (int), MasteringDisplayPrimariesX (float array), MasteringDisplayPrimariesY (float array), MasteringDisplayWhitePointX (float), MasteringDisplayWhitePointY (float), MasteringDisplayMinLuminance (float), MasteringDisplayMaxLuminance (float), ContentLightLevelMax (float), ContentLightLevelAverage (float).
Thanks
kedautinh12
14th October 2020, 05:29
ffms2 (https://cloud.owncube.com/s/C3ELrqtA5braszk):
- ffmpeg n4.4@9b72cea446;
- zlib 1.2.11;
- dav1d 0.7.1;
- set frame properties - _DurationNum (int), _DurationDen (int), _AbsoluteTime (float), _SARNum (int), _SARDen (int), _Matrix (int), _Primaries (int), _Transfer (int), _ChromaLocation (int), _ColorRange (int), _PictType (string), _FieldBased (int), MasteringDisplayPrimariesX (float array), MasteringDisplayPrimariesY (float array), MasteringDisplayWhitePointX (float), MasteringDisplayWhitePointY (float), MasteringDisplayMinLuminance (float), MasteringDisplayMaxLuminance (float), ContentLightLevelMax (float), ContentLightLevelAverage (float).
I replaced old ffms2_64 in aegisub with your ver but aegisub64 error with notification: "The procedure entry point FFMS_DoIndexing could not be located in the dynamic link library C:\Program Files\Aegisub\aegisub64.exe
LigH
14th October 2020, 07:18
That sounds funny to me, as if something tries to load aegisub64.exe as a DLL (not the ffms2.dll). But maybe there is just a separator missing, and the message ends at "library".
kedautinh12
14th October 2020, 12:02
That sounds funny to me, as if something tries to load aegisub64.exe as a DLL (not the ffms2.dll). But maybe there is just a separator missing, and the message ends at "library".
I comeback and use normally with old ver ffms2 2.23.1. i think some new commit was removed or change structure function FFMS_DoIndexing
zambelli
18th October 2020, 22:17
What are the factors that have most impact on ffmsindex performance? File size/bitrate? Specific containers? Specific codecs? I notice that some videos take a lot longer to index than others - sometimes it takes 10-15 minutes to index a video, and I'm curious where the bottleneck is.
LigH
19th October 2020, 07:30
One factor I remember right away: If you try to index uncompressed video or audio, the index file can get extremely huge and needs a lot of time to be written.
The container can be a factor too. Some keep video and audio in easily accessible units, others may switch between them in the middle of a frame's content.
FranceBB
19th October 2020, 08:02
Yep and some codecs are faster / better indexable than others.
For instance, it takes way less to index an H.264 than it generally takes to index an Apple ProRes of the same size, so even codecs might come into play here.
Still, for me, the one that slows me down, the real bottleneck, is the LAN.
You know, I use Avisynth at work all the time and it's not exactly easy to justify the "waiting" while you index an 800 GB AppleProRes file over the network with a connection of 1 Gbit/s...
I generally act as a "stalker", though, and I watch the RAM being allocated while it's indexing in AVSPmod. This way, I get a "feeling" of what it's doing and how long it's gonna take.
Oh and if it has 16 PCM audio tracks, the painful waiting even worse...
Still, all in all, I'm kinda happy to wait 'cause, despite that, ever since 2006, ffms2 and LSMASH made make me index and then encode pretty much everything...
zambelli
20th October 2020, 08:05
Because indexing performance is so unpredictable sometimes I prefer to run the ffmsindex.exe process manually before I even try to load the script. It doesn't make it run any faster, of course, but at least that way I can track its progress and estimate time needed.
Some of the worst performance I've observed so far seems to be indexing AVI files with FFV1 video. A 100GB file (1hr 720p60 YUY2) can take nearly 30 mins to index on an 8th gen i5, which is barely 2x speed. It probably doesn't help that the indexing process is not fully multi-threaded.
wonkey_monkey
20th October 2020, 09:48
https://forum.doom9.org/showthread.php?t=176878
Seektester is a handy utility for determining whether ffmpegsource is seeking correctly for a given container/codec.
FranceBB
21st October 2020, 07:33
Thanks for the tool. By the way, it would be nice to have AVSPmod display it somehow as well.
I would be fine even with a very simple command line progress bar that occasionally pops-up...
manolito
22nd October 2020, 12:33
I solved almost all of my indexing annoyances by using DSS2Mod by forclip (using 32-bit only). Thanks wonkey_monkey for recommending the Seek Tester utility. I just tested DSS2Mod using different AVC clips. Only SD resolution, only progressive. Container formats were MP4, MKV and FLV. For DSS2Mod I used "preroll=15". In all tests I did not get any seek errors, so at least for such sources this source filter works excellently...
Matias
23rd November 2020, 05:37
I replaced old ffms2_64 in aegisub with your ver but aegisub64 error with notification: "The procedure entry point FFMS_DoIndexing could not be located in the dynamic link library C:\Program Files\Aegisub\aegisub64.exe
Use Kainote Beta, this has a dll from StvG
https://github.com/bjakja/Kainote
StvG
23rd November 2020, 23:31
ffms2 (https://cloud.owncube.com/s/g35T64mo6SNQBpF):
- ffmpeg n4.4@9208b72a38;
- zlib 1.2.11;
- dav1d 0.7.1;
- changed the default threads number:
* VP9 - min(CPU logical processors, 8);
* AV1 - 1 when CPU logical processors = 1, otherwise 2;
* rest - CPU logical processors;
- MPEG2 streams in mkv container should be ok now.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.