RED 2

Please post here for issues related to Blu-ray discs
scottlindner
Posts: 8
Joined: Sun Mar 09, 2014 12:24 am

Re: RED 2

Post by scottlindner »

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. ;)
ixion
Posts: 11
Joined: Tue Dec 08, 2009 3:54 am

Re: RED 2

Post by ixion »

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.

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;

}
jbuszkie
Posts: 3
Joined: Tue Jan 14, 2014 2:59 pm

Re: RED 2

Post by jbuszkie »

FYI.. The script did not work for me for catching fire... The correct playlist fails this test.. The two that do pass play the movie out of order.
Bahndit
Posts: 9
Joined: Sun Jun 01, 2014 4:34 am

Re: RED 2

Post by Bahndit »

I have used this script but I am not exactly sure what I should be doing with the output. Does anyone have any pointers on what I should be looking for when using this script? Thanks for your help in advance.
Leonoportman
Posts: 8
Joined: Sat Jul 05, 2014 3:42 am

Re: RED 2

Post by Leonoportman »

I am confused here are we saying that this code change is required and I must upload Pearl to correctly RIP this File on Hand Brake or are we saying that this is answer to someone specific code Problem. I've incurred no uses making my MKV folders but when I load them into Hand Break I have like a 100 Different options to convert. At most I find 2 or 3 usally an extended version or and Alternate ending but in this Case I have 171 options of the Film I have started to convert all of them that are 1:55:48 (This includes 19, 79, 107, 151) but without ripping all 171 of these and burning up my processors to find out which one is correct I want to know if anyone knows which one is the correct one, I have seen this in several movies where the security is a such that it Blast with multiple versions of the movie and for the most part the movie is correct but there is spots where it swaps small 20 sec segment (Like Expendables 2) for another screen in the movie or it skips back 20 seconds making the movie have the record effect were the needle jumps back and forward. In this Case RED2_RENTAL this is what I have gotten. I can confirm 19 is one that jumps around I guess 170 to go unless anyone has any suggestions. mine doesn't go up to 577 so that out.
midnighwatcher
Posts: 75
Joined: Mon Mar 28, 2016 3:57 am

Re: RED 2

Post by midnighwatcher »

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
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?
Myrtledog
Posts: 18
Joined: Sun Nov 08, 2015 6:16 am

Re: RED 2

Post by Myrtledog »

Anyone have the segment order for a NetFlix rental disc?
swampdaddy
Posts: 99
Joined: Tue Aug 14, 2018 5:19 am

Re: RED 2

Post by swampdaddy »

I was not able to get this script to run on a High Sierra Mac... Ideas?

=========================
TopSecretMac:~ robert$ perl /Users/robert/Dropbox/Perl\ Scripts/RED_2.pl /Volumes/RED_2_RENTAL
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 8, near "$b\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 8, near "$playlists\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 8, near ") \"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 9, near "->\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 9, near "$list\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 9, near "}\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 16, near "->\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 16, near "$last\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 16, near "}\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 18, near ") \"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 19, near ") \"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 22, near "->\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 22, near "$last\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 22, near "}\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 23, near "}\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 24, near "}\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 29, near ") \"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 33, near "}\"
(Missing operator before \?)
Backslash found where operator expected at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 35, near "}\"
(Missing operator before \?)
Can't modify single ref constructor in scalar assignment at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 3, near "shift;"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 8, near "foreach "
Can't use global %\ in "my" at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 9, near "= @\"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 16, near "->\"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 18, near "if"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 22, near "->\"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 23, near "\}"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 29, near "if"
syntax error at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 33, near "\}"
Illegal declaration of subroutine main::read_m2ts at /Users/robert/Dropbox/Perl Scripts/RED_2.pl line 37.

=========================

Thanks,

R
oddeyeball
Posts: 41
Joined: Wed Sep 18, 2019 8:20 am

Re: RED 2

Post by oddeyeball »

00679.mpls seems to be correct for the US Amazon retail copy as well
therapy80301
Posts: 12
Joined: Wed Apr 01, 2020 9:11 pm

Re: RED 2

Post by therapy80301 »

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
SpaceElf
Posts: 1
Joined: Sun May 31, 2020 7:45 pm

Re: RED 2

Post by SpaceElf »

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
DVDFab confirmed this is the correct playlist for Netflix disc.
MacChickenSamich
Posts: 3
Joined: Sat Nov 28, 2020 8:09 pm

Re: RED 2

Post by MacChickenSamich »

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 worked exactly for me even though I have a different version. Here is my version information in case it helps someone else:

The one that worked for me:
UPC: 0-31398-28379-9
Amazon - Red / Red 2 Double Feature [Blu-ray]

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
BuccoBruce
Posts: 2
Joined: Wed Apr 20, 2022 3:57 pm

Re: RED 2

Post by BuccoBruce »

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.
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.
Bless you all. Script works great for me on Windows with Strawberry Perl.

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;

}
My RED2_RENTAL disc was also 577.mpls, even though VLC and even PowerDVD both reported a longer playback length that was leading me to think it was another playlist file. Happy I found this.
Post Reply