Script to play segments to help find the best title

Everything related to MakeMKV
Post Reply
blurayfan2019
Posts: 9
Joined: Fri Jul 26, 2019 12:54 am

Script to play segments to help find the best title

Post by blurayfan2019 » Sat Jul 27, 2019 4:59 pm

I recently remuxed a UHD Blu-ray, using MakeMKV 1.14.4, that had 9 titles, all the appropriate size and duration. I had never done this before so I needed to know how to choose the best title. I found this forum thread that helped me decide––Determining correct title on BD with MULTIPLE titles. I copied and pasted the 'Segment map:' line for each title to a text file.

Image

Code: Select all

Segment map: 687,688,674,689
Segment map: 687,688,674,689
Segment map: 692,688,18,689
Segment map: 6,688,21,689
Segment map: 691,688,15,689
Segment map: 4,688,674,689
Segment map: 690,688,17,689
Segment map: 694,688,19,689
Segment map: 693,688,674,689
I played the corresponding m2ts files from the Blu-ray's BDMV/STREAM directory to see what they contained.

Image

For example, for the first title, which corresponds to 00800.mpls, I played 00687.m2ts, 00688.m2ts, 00674.m2ts, and 00689.m2ts. I saw that segments 688 and 689 were common to all titles. 00688.m2ts contained the whole movie, minus the intro and outro, and 00689.m2ts contained the end credits in English. The other two files contained the different language versions of the intro and outro. Both titles one and two referred to the same segments, which were for the English version. The only way I knew that was by playing 00687.m2ts and 00689.m2ts and seeing the English wording. Corresponding segments from other titles were for different languages. I was surprised that only the English audio and subtitles were chosen by the app for each title. Maybe there was no further information available to determine the language?

Image

I found it very tedious and time-consuming to go back and forth between the various files and the player each time so I wrote a script to automate the process. This is written for OS X and probably works for any OS that is UNIX based, maybe with some modification. It assumes that you have already ripped the disc or decrypted it and can copy the path of the BDMV directory (though it looks like a file, it is actually a directory that contains the STREAM directory)

Image

The script prompts you to copy the BDMV directory path to the clipboard. Then it prompts you to copy the 'Segment map:' line for the title. It then creates a playlist of the corresponding m2ts files and plays them in order so you can more easily decide if they are the correct segments in the correct order.

Here is the script:

Code: Select all

echo
echo "Copy path of BDMV directory to clipboard:"
echo "e.g., /Volumes/Alita.Battle.Angel.2019.UHD.BluRay/BDMV"
echo
read -rsp $'Press any key when you\'re done...\n' -n 1 -e key  </dev/tty
d="`pbpaste`"
echo $d
echo
echo "Copy 'Segment map' line to clipboard:"
echo "e.g., Segment map: 687,688,674,689"
echo
read -rsp $'Press any key when you\'re done...\n' -n 1 -e key  </dev/tty
s="`pbpaste`"
echo $s
echo
if [ -f playlist.m3u ]
	then rm playlist.m3u
fi
for i in $(echo $s | awk -F ': ' '{print $NF}' | tr ',' '\n')
do
	printf "%s/STREAM/%05d%s\n" $d $i .m2ts >> playlist.m3u
done
mpv --really-quiet --playlist=playlist.m3u > /dev/null 2>&1
#vlc playlist.m3u > /dev/null 2>&1
I have uploaded it as well as a text file:
playsegs.txt
(683 Bytes) Downloaded 18 times
You have to change the extension to sh to make it executable. Copy the file to /usr/local/bin/ on OS X and change permissions:

Code: Select all

chmod 755 /usr/local/bin/playsegs.sh
Run the script from any directory but probably not your home directory as it creates a playlist file there.

Note that I use the mpv player which is the best player I have found for OS X. It plays m2ts files flawlessly where VLC can't play them at all. It is small, fast loading, and simple. It is multi-platform as well. I added a commented out line for VLC. Uncomment it and comment out the mpv line if you prefer VLC.

That's it. I hope this helps make it go faster for someone struggling to determine the best title to select, as I did.

Anyone who is adept at Windows batch or WSH scripting is encouraged to convert this for Windows users.

Woodstock
Posts: 6332
Joined: Sun Jul 24, 2011 11:21 pm

Re: Script to play segments to help find the best title

Post by Woodstock » Sat Jul 27, 2019 5:33 pm

If the title has anything to do with Disney (and Fox is a Disney company), the "800" play list is the proper one for English. The others substitute local language titles and credits, as you've found.
How to aid in finding the answer to your problem: https://www.makemkv.com/faq/item/8

blurayfan2019
Posts: 9
Joined: Fri Jul 26, 2019 12:54 am

Re: Script to play segments to help find the best title

Post by blurayfan2019 » Sat Jul 27, 2019 6:26 pm

That may be, but from what I have read here, there is no set rule. Some discs have dozens, even hundreds of candidate titles. This simply makes viewing them more palatable and less time-consuming.

Woodstock
Posts: 6332
Joined: Sun Jul 24, 2011 11:21 pm

Re: Script to play segments to help find the best title

Post by Woodstock » Sat Jul 27, 2019 8:28 pm

There are rules, and then there is Lionsgate.

Disney properties are easy. Lionsgate distributions require a lot of resources to decipher which play list is the correct one for the version of the disk you purchased. And really, without knowledge of Java or tools that can interpret it, playing segments is going to be very, very tedious.

If you have Java installed, and you insert a Lionsgate BD, MakeMKV will attempt to find which play list is correct. It doesn't always work. If Java is installed and MakeMKV doesn't activate it, the disk probably isn't from Lionsgate.
How to aid in finding the answer to your problem: https://www.makemkv.com/faq/item/8

blurayfan2019
Posts: 9
Joined: Fri Jul 26, 2019 12:54 am

Re: Script to play segments to help find the best title

Post by blurayfan2019 » Sun Jul 28, 2019 12:48 am

without knowledge of Java or tools that can interpret it, playing segments is going to be very, very tedious.
Then using a tool that helps speed up that process is highly desirable, wouldn't you agree?

Woodstock
Posts: 6332
Joined: Sun Jul 24, 2011 11:21 pm

Re: Script to play segments to help find the best title

Post by Woodstock » Sun Jul 28, 2019 1:34 am

Yes, it is desirable. MakeMKV strives to be one such tool, AnyDVD is another.

Not so sure many would be looking for a tool that would make it "easier" for a human to look for it, as that assumes the human already knows the segment order, and is just searching for that segment order on the disk. There have been efforts to get a list sorted of title/segments so you can search for a known match among them.

I'm not saying "do not do this!", I'm just letting you know what sort of things you have ahead of you.

You should probably read/watch several of the topics and videos on finding the right title for Lionsgate disks, which HAS evolved over the time they've been doing this. Some of the tools used are not free - they're "official licensed products" that users have convinced to give up information they're supposed to hide.

Most importantly, have fun doing it. That's the point of hobbies, isn't it? This is an adventure game - you're given a goal, and a limited number of tools to accomplish that goal.
How to aid in finding the answer to your problem: https://www.makemkv.com/faq/item/8

Post Reply