Re: RED 2
Posted: Sun Mar 09, 2014 10:40 pm
I want to thank everyone for the work you put into this. I was fortunate enough to Google my way out of the problem rather quickly thanks to you all. 
Code: Select all
# /usr/bin/perl find-playlist.perl <bluray root dir>
#
# This script will find the playlist that has matching mpls and clipinfo segments.
# The one with the longest number of segments is typically the correct main movie file.
#
# Example:
#
# Create a movie directory (e.g. RED2) and copy BDMV/CLIPINF and BDMV/PLAYLIST to it.
# You should now have a structure like this:
#
# RED2/BDMV/CLIPINF
# RED2/BDMV/PLAYLIST
#
# Then execute the script:
#
# /usr/bin/perl find-playlist.perl RED2
#
#
my $path = shift;
my $clips = read_m2ts("$path/BDMV/CLIPINF", ".clpi");
my $playlists = read_m2ts("$path/BDMV/PLAYLIST", ".mpls");
foreach my $list (sort {$a <=> $b} keys %{$playlists}) {
my @clp = @{$playlists->{$list}};
my @playlist = ();
my $next = $clp[0];
push(@playlist, $next);
my $last = $next;
$next = ${$clips->{$last}}[0];
if($next && $next != $last) {
while ($next && $next != $last) {
push(@playlist, $next);
$last = $next;
$next = ${$clips->{$last}}[0];
}
}
my $mpls = join(",",@clp);
my $cliplist = join(",",@playlist);
if( $mpls eq $cliplist ) {
printf("$list :\n");
printf(" mpls -> $mpls\n");
printf(" clipinfo -> $cliplist\n");
}
}
sub read_m2ts {
my $dir = shift;
my $ext = shift;
my $out = {};
opendir(DIR, "$dir") || die "can't open $dir";
my @dir = readdir(DIR);
closedir DIR;
foreach my $file ( grep{ /$ext$/ } @dir ) {
open(XIN, "<$dir/$file");
my @infile = <XIN>;
chomp @infile;
my $tmp = join(" ", @infile);
my @stuff = $tmp=~m/\d\d\d\d\dM2TS/g;
my @streams = ();
foreach my $strm (@stuff) {
my $a = $strm;
$a =~s/^0*//;
$a =~s/M2TS$//;
push(@streams, $a);
}
my $fnum = $file;
$fnum =~s/$ext$//;
$fnum =~s/^0*//;
$out->{$fnum}=[@streams];
}
return $out;
}
I'm in Canada with the Eone Blu-ray, UPC 774212929649. The 00674.mpls(1) source file on this disc matches everything exactly as shown above, including the segment map. Is this also correct for the Eone disc? Can anyone confirm?bottleneck70 wrote:UPC 77421200502...
Name: RED 2
Source file name: 00674.mpls(1)
Duration: 1:55:48
Chapters count: 17
Size: 31.5 GB
Segment count: 15
Segment map: 505,502,509,507,513,501,510,512,506,508,504,74,515,511,503
DVDFab confirmed this is the correct playlist for Netflix disc.therapy80301 wrote: Mon May 25, 2020 11:12 am New version...
Title information
Name: RED 2
Source file name: 00577.mpls
Duration: 1:55:48
Chapters count: 18
Size: 20.7 GB
Segment count: 15
Segment map: 507,504,501,517,502,511,514,513,519,508,503,512,518,516,510
This worked exactly for me even though I have a different version. Here is my version information in case it helps someone else:penguinsaregood wrote: Wed Nov 27, 2013 3:10 am According to my player the length is 1:55:48, three possible titles, the one that worked for me:
UPC: 0-25192-21310-6
Title information
Name: RED 2 (English)
Source file name: 00679.mpls
Duration: 1:55:48
Chapters count: 18
Size: 31.5 GB
Segment count: 15
Segment map: 505,517,514,502,504,511,507,503,509,506,515,501,510,518,519
tappinaway wrote: Tue Dec 03, 2013 11:51 pm I discovered while being frustrated by this disc that the correct sequence is encoded in the files within the BDMV/CLIPINF directory. there is a .clpi file in there for each .m2ts in BDMV/STREAM, where the first occurance of XXXXXM2TS (XXXXX being a stream number) points to the next m2ts file that follows it. additional M2TS entries in the .clpi files seem to point to alternate bogus paths.
here's some perl code that I threw together to find which mpls files have sequences that match.
hope this helps. I've only verified this method against one other disc so far.
ixion wrote: Wed Mar 12, 2014 4:34 pm I just want to add that I've now used this script on several movies (Red2, Hunger Games, Hunger Games Catching Fire, etc), and the script works every time. I've added a descriptive "usage" header to the script. Thanks again.
Bless you all. Script works great for me on Windows with Strawberry Perl.kecarbaugh wrote: Wed Jan 08, 2014 4:21 am The perl script can be run successfully under windows (ActiveState Perl) if you change all the directory forward slashes '/' to the windows backward slash '\\'. Specifically the following lines:
Runs great.
Code: Select all
# perl find-playlist.pl <bluray root dir>
#
# This script will find the playlist that has matching mpls and clipinfo segments.
# The one with the longest number of segments is typically the correct main movie file.
#
# Example:
#
# Create a movie directory (e.g. RED2) and copy BDMV/CLIPINF and BDMV/PLAYLIST to it.
# You should now have a structure like this:
#
# RED2/BDMV/CLIPINF
# RED2/BDMV/PLAYLIST
#
# Then execute the script:
#
# perl find-playlist.pl RED2
#
#
my $path = shift;
my $clips = read_m2ts("$path\\BDMV\\CLIPINF", ".clpi");
my $playlists = read_m2ts("$path\\BDMV\\PLAYLIST", ".mpls");
foreach my $list (sort {$a <=> $b} keys %{$playlists}) {
my @clp = @{$playlists->{$list}};
my @playlist = ();
my $next = $clp[0];
push(@playlist, $next);
my $last = $next;
$next = ${$clips->{$last}}[0];
if($next && $next != $last) {
while ($next && $next != $last) {
push(@playlist, $next);
$last = $next;
$next = ${$clips->{$last}}[0];
}
}
my $mpls = join(",",@clp);
my $cliplist = join(",",@playlist);
if( $mpls eq $cliplist ) {
printf("$list :\n");
printf(" mpls -> $mpls\n");
printf(" clipinfo -> $cliplist\n");
}
}
sub read_m2ts {
my $dir = shift;
my $ext = shift;
my $out = {};
opendir(DIR, "$dir") || die "can't open $dir";
my @dir = readdir(DIR);
closedir DIR;
foreach my $file ( grep{ /$ext$/ } @dir ) {
open(XIN, "<$dir\\$file");
my @infile = <XIN>;
chomp @infile;
my $tmp = join(" ", @infile);
my @stuff = $tmp=~m/\d\d\d\d\dM2TS/g;
my @streams = ();
foreach my $strm (@stuff) {
my $a = $strm;
$a =~s/^0*//;
$a =~s/M2TS$//;
push(@streams, $a);
}
my $fnum = $file;
$fnum =~s/$ext$//;
$fnum =~s/^0*//;
$out->{$fnum}=[@streams];
}
return $out;
}I know I am reviving an old thread but thank you so much for this. This worked perfectly on my copy of RED 2. Thanks!penguinsaregood wrote: Wed Nov 27, 2013 3:10 am According to my player the length is 1:55:48, three possible titles, the one that worked for me:
UPC: 0-25192-21310-6
Title information
Name: RED 2 (English)
Source file name: 00679.mpls
Duration: 1:55:48
Chapters count: 18
Size: 31.5 GB
Segment count: 15
Segment map: 505,517,514,502,504,511,507,503,509,506,515,501,510,518,519
This is the UPC code I have. Were you asking someone if this was the file, or telling us?bottleneck70 wrote: Sat Dec 14, 2013 5:12 am UPC 77421200502...
Name: RED 2
Source file name: 00674.mpls(1)
Duration: 1:55:48
Chapters count: 17
Size: 31.5 GB
Segment count: 15
Segment map: 505,502,509,507,513,501,510,512,506,508,504,74,515,511,503