Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AviSynth plugin not indexing audio/not reading audio index with .mkv files? #448

Open
dartheditous opened this issue Jan 28, 2025 · 0 comments

Comments

@dartheditous
Copy link

I've been doing some experimenting trying to get to the bottom of some audio seeking issues using the AviSynth plugin and it seems to me that there may be a problem with indexing audio in MKV files.

What I was seeing was a delay when jumping (in VirtualDub) from some point in the timeline to a later point in the timeline. This is only the case when audio was involved (either playing audio, or using VirtualDub's waveform display or the AviSynth Waveform plugin).

Using the following as a test script:

a = ffmpegsource2("<source_filename>", atrack = 1) # this should index video and audio on first run, right?

a
trim(a.framecount - 1, a.framecount - 1) # return the last frame of the clip only to induce the audio-seek delay
waveform # paint the waveform on the clip (forces GetAudio on GetFrame)

...I found that opening this script with a previously indexed file as the source takes around the same time as indexing the file in the first place (around 30s for each of the ~45m Blu-ray rips I'm working with). Whereas opening without the trim, to the true first frame, takes just a couple of seconds.

Running the script immediately on following occasions reduces this delay to just 2-3s, which I suspect is due to the OS having cached the entire file in RAM. If I change to another source, whether indexed or not, the same ~30s delay returns (again only on the first sequential run with that source).

So it seems to me like it's having to rebuild an index for the whole file up to the requested point in time, each time (not reading it from the index file, if it's in there). Once audio for a certain point has been fetched, seeking to previous points is fast. Seeking to later points still has a delay which seems to be proportional to the size of the forward jump.

I've tested this with other MKV sources, with AC3, E-AC3, DTS, DTS XLL and AAC audio tracks, and it's the same each time. I also reverted to 2.23.1 and the issue was still present (although indexing and the related delay was somewhat faster for some files).

If I remux my MKV to MP4, or try existing MP4s, then there is no delay other than initial indexing.

Here's one of my .ffindex files: 03 - The Unquiet Dead.mkv.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant