Index MKV files from right-click

This forum is for questions and discussion of all the aspects of handling your footage. If you have questions about capturing/ripping footage, AviSynth, or compression/encoding/converting, look here.

Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 2:17 am

This is meant to do three things:
A) Not have to open the AviSynth script in a media player to get FFmpegSource2 to index the file, because it uses ffmsindex instead. This cuts way down on resource usage during the indexing phase, and you get to know how far along the indexing is, percentage-wise.

B) Not require users to use the Command Prompt, because ffmsindex does not have a GUI (yet, anyway).

C) Autogenerate an AviSynth script with the index file, like DGIndex's template option does*.

*it's not the same, though - DGIndex's template system is much nicer than this is if you want to have more than the source function in the script.




I know that there are some complaints about FFMS2 crashing AviSynth when it tries to open the files (or that it simply takes too long to index+play them). I use the CLI ffmsindex app to do the indexing before I ever try to playback the files, so I've never encountered this problem.

But I understand that a lot of users are very reluctant to use the command line, and so I've whipped up a solution for them. Using this method, you never have to touch the command line, and shouldn't have to deal with those file opening problems I just mentioned either.

As a bit of forewarning, I have no idea how this works on Vista and Win7; you may need to do this as Administrator.

Download mkvindex_contextmenu.zip here:
http://www.mediafire.com/?wzjitzzxtqz

XP users: double-click on install-xp.bat
Vista users (maybe Win7 users too): follow the directions in vista-install-instructions.txt
Vista SP1 users: bats differ for scripting reasons.

Unpack the zip file, and then double-click on install.bat. When it asks, click OK. Now you should be able to right-click on any MKV file and not only index it, but also have a basic, functional AviSynth script outputted for you as well. Index will only index the video track of the MKV, while Index (w/Audio) will index the video and audio tracks.

One caveat is that if the file doesn't have an audio track at all, don't use the w/Audio option - the script it generates will fail unless you remove the atrack=-1 portion.

[MOD 258: Updated link and instructions.]
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 2:19 am

Gah, double post.

This assumes that ffmsindex is residing in C:\Program Files\AviSynth 2.5\plugins. If you unpack FFmpegSource2 to that directory, this shouldn't be an issue.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby mirkosp » Fri Mar 12, 2010 3:31 am

Running with administrator and UAC disabled on Vista Home Premium 32bit, and the voice is not showing up in the context menu. I did check and the keys did get properly registered, so I'm not exactly sure what's not working out. :\
EDIT: Ah, and yeah, I do have ffmsindex.exe in C:\Program Files\AviSynth 2.5\plugins
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 2:28 pm

I'm troubleshooting a bit on my mom's laptop, since it runs Vista Home Premium 32-bit, and it seems a couple of things go wrong:

1) Trying to run install.bat as Administrator means it cannot find mkvindex.bat or mkvindex-audio.bat because it looks for them in C:\Windows\system32 - these need to be copied to C:\Windows. Running the install script as Administrator also seems to cause Regedit to fail.

2) Running the script with normal privileges allows Regedit to do its job, but the copy portion fails because the regular user doesn't have normal access to C:\Windows. There might be a per-operation override for it, but I don't know what it is.

There were also some rather wonky issues with the registry entries and the scripts in the original file concerning file paths and double quotes. I'm close to getting it sorted out and I'll repost an updated pack with both XP and Vista install scripts included (AviSynth doesn't mind double-quotations on XP - and actually the script to generate the stuff requires them on there, but on Vista it spazzes out on them and the double-quotes aren't needed; let's hope Win7 doesn't need a third way to get this working, as I don't have a copy of it to test on). On Vista it may still be required to manually copy the indexing scripts to C:\Windows, though.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 2:58 pm

Ok, here's the updated pack:
http://www.mediafire.com/?bonzhaw2zjy

XP users: double-click on install-xp.bat
Vista users (maybe Win7 users too): follow the directions in vista-install-instructions.txt

Hopefully that fixes things. The file linked in the first post has been deleted, so it might be a good idea to add a note to the post about the updated package.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby mirkosp » Fri Mar 12, 2010 3:17 pm

Perhaps I'm being the failguy here, but if I run it as a normal user it doesn't allow me to add info to regedit, and running as an admin user, while adding info to the regedit, still doesn't get me the context menu. In all this I haven't rebooted yet because I can't reboot atm and I won't be able to for about a day still, but I don't think reboot is required, is it now? >_>
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 4:08 pm

It shouldn't be. I was adding/deleting/readding the reg files on my mom's laptop and it worked fine. If you add the entries to Regedit manually, does it work? The methodology I used was thus:

Search for mkv_auto_file in Regedit. Expand the entry, and then expand the 'shell' entry underneath it. Open, Index, and Index (w/Audio) should all be there. If they are, then Windows Explorer may be the one with the problem. If they aren't there, then right-click on 'shell' and select New->Key. Name this 'Index', and then right-click on Index, New->Key, and name it 'command'. The actual entry on the right pane should be defined as "C:\Windows\mkvindex-vista.bat" %1 - repeat this for Index (w/Audio), so that it finally looks like this:

    mkv_auto_file
    • shell
      • Index
      • command [defined in the right pane as "C:\Windows\mkvindex-vista.bat" %1]
      • Index (w/Audio)
      • command [defined in the right pane as "C:\Windows\mkvindex-audio-vista.bat" %1]

Maybe it has something to do with Service Packs or other updates. My mom's laptop may be running Vista, but it's still RTM as far as I know. Definitely not SP1 or SP2, though. So perhaps those have altered the way this works.

The only time I had to reboot was when testing with UAC on/off - but this worked with or without UAC enabled. The install script didn't work, though - I had to copy mkvindex-vista.bat and mkvindex-audio-vista.bat to C:\Windows manually using Windows Explorer. The thing that was infuriating for me were the file associations - if the indexing bat files weren't where they were supposed to be, the menu entries would launch the Open With dialog instead.

If it is an issue with Explorer refreshing itself, you could simply quit Explorer using the Task Manager and reload it, which might resolve the changes.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 4:13 pm

Wait, was Explorer running as Administrator? It just occurred to me that if Regedit added the entries without issue if it was run as Admin, then Explorer may not be able to see them unless it's running as Admin also.

Honestly, this would be demonstrably easier if Vista and 7 user permissions worked similarly to the way sudo/gksudo do in *nix-based OSes. Maybe it wouldn't be easy with Regedit, though.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby mirkosp » Fri Mar 12, 2010 5:02 pm

Image
Should be right.

And as far as explorer is concerned, it either is already running as admin or it won't let me do so, since the voice doesn't show up with right click...

EDIT: Oh, and yeah, I'm running SP1, so perhaps might change something...
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Index MKV files from right-click

Postby Zarxrax » Fri Mar 12, 2010 5:56 pm

You might want to try making an installer with InnoSetup.
With the ISTool editor, you can probably whip up an installer to easily handle this on all systems in a matter of minutes.
User avatar
Zarxrax
 
Joined: 01 Apr 2001
Location: Concord, NC

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 7:37 pm

mirkosp wrote:Quoted Image converted to link:
http://i39.tinypic.com/ng6jif.png
Should be right.

And as far as explorer is concerned, it either is already running as admin or it won't let me do so, since the voice doesn't show up with right click...

EDIT: Oh, and yeah, I'm running SP1, so perhaps might change something...

I looked around on Google and found this:
http://vistavitals.blogspot.com/2008/06 ... lorer.html

In which the solution is that because Explorer is already running, it won't let you elevate, and the way to work around this is to tell Explorer to launch new folder windows in a separate process, which will let 'Run as Administrator' work to launch Explorer itself with those privileges (just as long as there are no other Explorer windows open when you do it).

But it also had a note, down toward the bottom of the page, that SP1 drastically changes the way Explorer behaves. Unfortunately it doesn't say how it changes things. Whether the fix the rest of the post describes works for SP1, I have no idea.

Zarxrax wrote:You might want to try making an installer with InnoSetup.
With the ISTool editor, you can probably whip up an installer to easily handle this on all systems in a matter of minutes.

I'll look into it, but it'll come down to either having two or three separate installers, or I'll have to figure out how to store separate copies for the different scenarios it might come across - I already found that XP and Vista handle the scripts involved differently, and if SP1 is different than Vista RTM, and if SP2 is different than SP1, and if Win7 is different than all three of the previous, this is going to get messy, either way you look at it.

What I'd really prefer is just a generic frontend app that integrates with the context menu and has a configuration file to control how it handles each individual application beneath it. I had tried making audio frontends adapt, but it failed pretty badly. All the custom context menu editors I've seen hone in on very specific tasks rather than a broad, all-purpose CLI task controller. If one exists and I simply overlooked it, then suggestions are certainly welcome.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby mirkosp » Fri Mar 12, 2010 8:24 pm

Qyot27 wrote:
mirkosp wrote:Quoted Image converted to link:
http://i39.tinypic.com/ng6jif.png
Should be right.

And as far as explorer is concerned, it either is already running as admin or it won't let me do so, since the voice doesn't show up with right click...

EDIT: Oh, and yeah, I'm running SP1, so perhaps might change something...

I looked around on Google and found this:
http://vistavitals.blogspot.com/2008/06 ... lorer.html

In which the solution is that because Explorer is already running, it won't let you elevate, and the way to work around this is to tell Explorer to launch new folder windows in a separate process, which will let 'Run as Administrator' work to launch Explorer itself with those privileges (just as long as there are no other Explorer windows open when you do it).

But it also had a note, down toward the bottom of the page, that SP1 drastically changes the way Explorer behaves. Unfortunately it doesn't say how it changes things. Whether the fix the rest of the post describes works for SP1, I have no idea.


Tried that and the option won't show up. Not if I'm just running it as a user, nor even if I'm running it specifically as administrator. Seems like explorer.exe dislikes this context feature for some reason or another... =_=
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 9:07 pm

The actual indexing bat files work though, right? You can simply drag-and-drop the MKVs onto them and the index+.avs will get written. If nothing else, that has no reason to not work unless the syntax is bad again.

I just figured it'd be less intrusive if the context menu works, because it wouldn't require users to drag files around all over the place or make sure they didn't delete the indexing bats. Heck, you can also call them from new batch scripts if you do want to keep them in C:\WINDOWS. But that still requires some familiarity with batch scripting/CLI.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: Index MKV files from right-click

Postby mirkosp » Fri Mar 12, 2010 9:47 pm

Qyot27 wrote:The actual indexing bat files work though, right? You can simply drag-and-drop the MKVs onto them and the index+.avs will get written. If nothing else, that has no reason to not work unless the syntax is bad again.


Didn't come to my mind to try that, and apparently the script comes off broken:
Code: Select all
FFmpegSource2(""D:\path\filename.mkv"")

gets outputted instead of
Code: Select all
FFmpegSource2("D:\path\filename.mkv")

when dragging the mkv on mkvindex-vista.bat.
Since the code in that bat is
Code: Select all
"C:\Program Files\AviSynth 2.5\plugins\ffmsindex.exe" %1
echo FFmpegSource2^("%1"^)> ""%1".avs"
pause

I would assume that changing it to
Code: Select all
"C:\Program Files\AviSynth 2.5\plugins\ffmsindex.exe" %1
echo FFmpegSource2^(%1^)> ""%1".avs"
pause

should work. Actually, I checked and it did work, so I suppose that the bat for vista SP1 should be changed to that?

But yeah, having the context menu would be nice. Not that dragging a file over a bat isn't easy, but just right click and chosing the voice is much more friendly for a lazy user like me. :P
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Index MKV files from right-click

Postby Qyot27 » Fri Mar 12, 2010 11:50 pm

That's one of those issues I couldn't figure out about the quotation marks - when I was composing the scripts on XP, the way the %1's were treated was incredibly erratic, not being able to detect the full path to the file at times, mainly if there was a space somewhere in the path to the file. But checking just now with simply a %1 inside of the Source filter instead of ""%1"" works ok too (on XP, AviSynth seems to be fine if there are three sets of quotation marks around a filename, which the ""%1"" creates). I don't know what's going on.

So here's yet another update to the pack (as was true before, the previous pack is now gone):
http://www.mediafire.com/?wzjitzzxtqz

Still have no clue why the context menu edits don't seem to work on SP1, only that it might simply have to do with how SP1 alters Explorer's functionality, however that actually is.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Next

Return to Footage Help

Who is online

Users browsing this forum: No registered users and 1 guest