
Bookmarks in Media Player Classic Home Cinema
If you choose to keep history and save viewing positions in the settings, MPC HC can automatically save up to 20 bookmarks to the last place you watch video files and as many bookmarks for DVD. When resuming viewing, the player will start playback from the last position if it finds information about the file in its database (it is stored along with other settings either in the registry or in the ini-file, depending on the user's choice). However, there are conditions when 20 bookmarks are not enough. Someone likes to watch many films in parallel, sometimes postponing viewing for a while. Someone listens to music on MPC HC (and the keys for it are the same: one big album - and all the bookmarks are overwritten). Someone uses the player to repeatedly test the encoded video. Finally, several family members can use one account at once (for example, children can watch cartoons while their parents are busy). In general, I would like to have a reliable way to save a bookmark on the desired movie and then restore it.
In the registry, data is stored in a section
I come up with three ways to create custom bookmarks when working with registries: from the simplest and least flexible to the more complex and subtle. Of course, the post does not claim to be rocket science. Simple and convenient practical tricks are described.

You have to start the export after closing the player with the movie, starting MPC again, because only before closing the data on the latest files in the registry is updated. A .reg file is created with all the settings (and not only the section we need), and this is one more inconvenience: when importing settings, not only the desired bookmark will be restored, but also the entire set of previous settings.
Let's try to improve the situation a bit (further solutions were tested only in Windows XP).
Since the standard tools for working with the registry do not allow exporting individual registry entries, we again have to deal with a whole section, but now the volume can be narrowed to the desired one
Nowhere is easier (save as a text file with the extension .bat):
The argument may be the last video file or folder from the DVD. In the same directory, the .reg file of the same name is created, which is then conveniently imported with one click before returning to the movie.
In order not to have to contact the command line every time or drag the video onto the shortcut of the batch file, we implement a more convenient connection.
Add the call of our batch file to the context menu of files and folders. To do this, just create the following text file, save it in Unicode with the .reg extension and run it for integration (just replace the program paths with yours, remember to double the slashes).
Those who are more used to this file manager can create a button on the toolbar (you can duplicate it with the previous recipe with the context menu):

Then you can create a bookmark for the file that is in the focus of the active tab after watching the video.
Here we can achieve even greater convenience. If someone is not familiar with Perl, this isn’t scary: just download and install the interpreter implementation under Windows , everything else will also be easy.
Using a script, we can save only the necessary keys. If you bookmark immediately after watching the video, we will need only the very first entries in the history, they are the latest in viewing time:
Create the following text file and save it with the extension .pl:
If a folder is transferred to the script, it only saves the bookmark on the last DVD in the .reg file with the name of the folder (it’s not possible for me to check if this is a DVD: if someone knows how to do this, please write in the comments; but if you bookmark it right after watching the movie and closing the player, you don’t have to worry about its correctness). If a file is transferred, the script checks the identity of this file and the last file in the history; if the files match, the script creates the .reg file of the same name with two necessary keys; if they do not match, it gives an error message. If no arguments are passed to the script at all, it creates a summary .reg file with information about the last DVD and the last video file in the current active folder.
Everything is almost the same with minimal changes (do not forget to write down your paths to the programs).
For some reason, specifying one script is not enough, you have to specify the interpreter (even though the .pl extension is added to the PATHEXT variable):
Similar button:

The described mechanism allows you to achieve this state:

PS Of course, there are still “Favorites” in the player itself, but it may seem less convenient to someone: to update a bookmark, that is, change the transition time in the same movie, you need to delete the old one bookmark and create a new one; when bookmarks are in folders next to movies, they are easier to search for and easier to delete as unnecessary with movies after watching; such bookmarks are available from all accounts; they are easier to edit (even in Notepad) if the file name or path to it changes.
In the registry, data is stored in a section
HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings
. For video files, the key pairs File Name N
/ File Position N
(c N
from 0 to 19) are used. For a DVD, one key is used DVD Position N
(in the same range; the player manages to save both the DVD’s ID and the place of the last viewing in one mysterious digital recording). I come up with three ways to create custom bookmarks when working with registries: from the simplest and least flexible to the more complex and subtle. Of course, the post does not claim to be rocket science. Simple and convenient practical tricks are described.
I. Export / import settings using the player itself

You have to start the export after closing the player with the movie, starting MPC again, because only before closing the data on the latest files in the registry is updated. A .reg file is created with all the settings (and not only the section we need), and this is one more inconvenience: when importing settings, not only the desired bookmark will be restored, but also the entire set of previous settings.
Let's try to improve the situation a bit (further solutions were tested only in Windows XP).
II. Export / Import Using a Batch File
Since the standard tools for working with the registry do not allow exporting individual registry entries, we again have to deal with a whole section, but now the volume can be narrowed to the desired one
HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings
. Additional advantages are also that we do not need to open the player again and do not need to manually enter the name of the bookmark, everything will be done automatically.1. Batch file
Nowhere is easier (save as a text file with the extension .bat):
@echo off
reg export "hkcu\Software\Gabest\Media Player Classic\Settings" "%~dpn1.reg"
The argument may be the last video file or folder from the DVD. In the same directory, the .reg file of the same name is created, which is then conveniently imported with one click before returning to the movie.
2. Integration into the system interface
In order not to have to contact the command line every time or drag the video onto the shortcut of the batch file, we implement a more convenient connection.
a. Implementation for Explorer
Add the call of our batch file to the context menu of files and folders. To do this, just create the following text file, save it in Unicode with the .reg extension and run it for integration (just replace the program paths with yours, remember to double the slashes).
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\* MPC bookmark]
[HKEY_CLASSES_ROOT\*\shell\* MPC bookmark\command]
@="E:\\DOC\\prg\\bat\\mpc_bm.bat \"%1\""
[HKEY_CLASSES_ROOT\Folder\shell\* MPC bookmark]
[HKEY_CLASSES_ROOT\Folder\shell\* MPC bookmark\command]
@="E:\\DOC\\prg\\bat\\mpc_bm.bat \"%1\""
b. Implementation for Total Commander
Those who are more used to this file manager can create a button on the toolbar (you can duplicate it with the previous recipe with the context menu):

Then you can create a bookmark for the file that is in the focus of the active tab after watching the video.
II. Export / import using Perl script
Here we can achieve even greater convenience. If someone is not familiar with Perl, this isn’t scary: just download and install the interpreter implementation under Windows , everything else will also be easy.
Using a script, we can save only the necessary keys. If you bookmark immediately after watching the video, we will need only the very first entries in the history, they are the latest in viewing time:
File Name 0
+ File Position 0
or DVD Position 0
. In addition, the script will check the identity of the argument file and the last file in the player’s history so that we do not accidentally leave an erroneous bookmark.1. The script
Create the following text file and save it with the extension .pl:
################################################################################
use strict;
use warnings;
use Win32::TieRegistry;
################################################################################
$Registry->Delimiter("/");
my $movie = shift();
################################################################################
if ($movie && -d $movie) {
open(OUTPUT, '>:raw:encoding(UTF16-LE)', $movie . ".DVD.reg") or die "Cannot create the .reg file: $!\n";
print OUTPUT
"\x{FEFF}Windows Registry Editor Version 5.00\r\n\r\n[HKEY_CURRENT_USER\\Software\\Gabest\\Media Player Classic\\Settings]\r\n",
'"DVD Position 0"="',
$Registry->{'HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings//DVD Position 0'}, "\"\r\n\r\n";
close(OUTPUT) or die "Cannot close the .reg file: $!\n";
}
elsif ($movie && -f $movie) {
my $last_file = $Registry->{'HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings//File Name 0'};
if (lc($movie) eq lc($last_file)) {
open(OUTPUT, '>:raw:encoding(UTF16-LE)', $last_file =~ s/\.\w+$/.reg/r) or die "Cannot create the .reg file: $!\n";
print OUTPUT
"\x{FEFF}Windows Registry Editor Version 5.00\r\n\r\n[HKEY_CURRENT_USER\\Software\\Gabest\\Media Player Classic\\Settings]\r\n",
'"File Name 0"="',
$last_file =~ s/\\/\\\\/gr, "\"\r\n",
'"File Position 0"="',
$Registry->{'HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings//File Position 0'}, "\"\r\n\r\n";
close(OUTPUT) or die "Cannot close the .reg file: $!\n";
}
else {
print "The input file does not match the last played one:\n\n$movie\n\n$last_file\n\n";
system('pause');
}
}
else {
my $last_file = $Registry->{'HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings//File Name 0'};
open(OUTPUT, '>:raw:encoding(UTF16-LE)', $last_file =~ s/^.+\\//r =~ s/\.\w+$/+Last_DVD.reg/r) or die "Cannot create the .reg file: $!\n";
print OUTPUT
"\x{FEFF}Windows Registry Editor Version 5.00\r\n\r\n[HKEY_CURRENT_USER\\Software\\Gabest\\Media Player Classic\\Settings]\r\n",
'"File Name 0"="',
$last_file =~ s/\\/\\\\/gr, "\"\r\n",
'"File Position 0"="',
$Registry->{'HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings//File Position 0'}, "\"\r\n",
'"DVD Position 0"="',
$Registry->{'HKEY_CURRENT_USER/Software/Gabest/Media Player Classic/Settings//DVD Position 0'}, "\"\r\n\r\n";
close(OUTPUT) or die "Cannot close the .reg file: $!\n";
}
################################################################################
If a folder is transferred to the script, it only saves the bookmark on the last DVD in the .reg file with the name of the folder (it’s not possible for me to check if this is a DVD: if someone knows how to do this, please write in the comments; but if you bookmark it right after watching the movie and closing the player, you don’t have to worry about its correctness). If a file is transferred, the script checks the identity of this file and the last file in the history; if the files match, the script creates the .reg file of the same name with two necessary keys; if they do not match, it gives an error message. If no arguments are passed to the script at all, it creates a summary .reg file with information about the last DVD and the last video file in the current active folder.
2. Integration into the system interface
Everything is almost the same with minimal changes (do not forget to write down your paths to the programs).
a. Implementation for Explorer
For some reason, specifying one script is not enough, you have to specify the interpreter (even though the .pl extension is added to the PATHEXT variable):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\* MPC bookmark]
[HKEY_CLASSES_ROOT\*\shell\* MPC bookmark\command]
@="C:\\Perl\\bin\\perl.exe E:\\DOC\\prg\\perl\\var\\mpc_bm.pl \"%1\""
[HKEY_CLASSES_ROOT\Folder\shell\* MPC bookmark]
[HKEY_CLASSES_ROOT\Folder\shell\* MPC bookmark\command]
@="C:\\Perl\\bin\\perl.exe E:\\DOC\\prg\\perl\\var\\mpc_bm.pl \"%1\""
b. Implementation for Total Commander
Similar button:

The described mechanism allows you to achieve this state:

PS Of course, there are still “Favorites” in the player itself, but it may seem less convenient to someone: to update a bookmark, that is, change the transition time in the same movie, you need to delete the old one bookmark and create a new one; when bookmarks are in folders next to movies, they are easier to search for and easier to delete as unnecessary with movies after watching; such bookmarks are available from all accounts; they are easier to edit (even in Notepad) if the file name or path to it changes.