Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: MakeMKV has expired!

  1. #11
    Administrator andrew's Avatar
    Join Date
    Nov 2008
    Location
    New Hampshire
    Posts
    3,617
    Thanks Bruce! Your code has been committed and released!

  2. #12
    Senior Member waltonb's Avatar
    Join Date
    Sep 2011
    Posts
    150
    Too soon Andrew... I just found another bug, some blurays don't have any title info at all, and this code simply fails. Though the old code would have as well... I'll take a closer look.

  3. #13
    Senior Member waltonb's Avatar
    Join Date
    Sep 2011
    Posts
    150
    Well, I finally found some time to work on this... Andrew, could you
    please review? I figured out a way to extract title info and continue
    if none is found. It seems to be much more robust than the previous
    code, actually is able to continue without errors due to disk info
    parsing. I've tried this with several disks... it now gets the title
    info in a slightly different manner which seems to be more common than
    the way the old code as doing it.

    Just substitute this code into docd_helper_BD.php in the obvious
    place.

    regards -bruce.


    Code:
    // Get device name
    
    $cddevice=exec("/opt/vortexbox/get-cddevice");
    echo "Using device $cddevice\n";
    
    // time how long it takes to rip movie
    $start_time = getdate();
    
    echo "Reading Blu-ray track info. This may take a while...\n";
    // extract title and chapter info from the blu-ray.
    exec("/usr/bin/makemkvcon info dev:".$cddevice." -r > /tmp/docd_helper.tmp");
    
    $track_info = file("/tmp/docd_helper.tmp");
    $length = 0;
    
    for ($i = 0; $i < count($track_info); ++$i) {
      // find title
      $parts = preg_match("/^CINFO:30,0,\"(.*)\"/", $track_info[$i], $t);
      if ($parts != 0) {
        echo "Got Title: $t[1]\n";
        $movie_title = $t[1];
        continue;
      }
      // find longest track
      $parts = preg_match("/^TINFO:(\d+),30,0,\".*\s,\s(.*)\s(\S+)\"/", $track_info[$i], $t);
      if ($parts != 0) {
        if ($t[3] == "MB") {
          // only consider tracks >1GB
          echo "Track $t[1] has $t[2] units of $t[3]... skipping.\n";
        } else {
          echo "Track $t[1] has $t[2] units of $t[3]\n";
          if ($t[2] > $length) {
    	$length = $t[2];
    	$long_track = $t[1];
          }
        }
      }
    }
    
    // Rip the Blu-ray!

  4. #14
    Administrator andrew's Avatar
    Join Date
    Nov 2008
    Location
    New Hampshire
    Posts
    3,617
    Thanks but I think it still needs some work. What happens if $parts = 0? $long_track and $movie_title are never set to anything.

    -Andrew

  5. #15
    Senior Member waltonb's Avatar
    Join Date
    Sep 2011
    Posts
    150
    Yes, you're right. That wasn't one of my test cases.

    It should drop down to setting "UnknownTitle" if it can't find the
    title, and "0" if it can't determine the longest track. If the latter
    happens, the blu-ray is probably somewhat nonstandard from what I can
    tell so far.

    I'll fix it later tonight after I'm home. Thanks for checking it.

    Do you know of any documentation discussing the output of makemkv
    "info" mode? I'm just making assumptions about the data contained
    there.

    -bruce.

  6. #16
    Administrator andrew's Avatar
    Join Date
    Nov 2008
    Location
    New Hampshire
    Posts
    3,617
    MakeMKV is a little light on documentation. I figured out most of it by trial and error. This is whats available

    http://www.makemkv.com/developers/usage.txt

  7. #17
    Senior Member waltonb's Avatar
    Join Date
    Sep 2011
    Posts
    150
    Thanks.. but it's not much help, it refers you to the source code
    which is no longer public.

    For the time being I simply assigned default values so they're defined
    by the time we run the rip command.

    We'll need to revisit this at some point to make it work in ripping
    multiple tracks on a bluray disc, e.g. a TV series or whatever. When
    I get my hands on such a disc I'll come back to to this.

    -bruce.


    Code:
    echo "Reading Blu-ray track info. This may take a while...\n";
    // extract title and chapter info from the blu-ray.
    exec("/usr/bin/makemkvcon info dev:".$cddevice." -r > /tmp/docd_helper.tmp");
    $track_info = file("/tmp/docd_helper.tmp");
    
    // defaults in case we can't parse info data
    $movie_title = "Unknown_Title";
    $long_track = 0;
    $length = 0;
    
    for ($i = 0; $i < count($track_info); ++$i) {
      // find title
      $parts = preg_match("/^CINFO:30,0,\"(.*)\"/", $track_info[$i], $t);
      if ($parts != 0) {
        echo "Got Title: $t[1]\n";
        $movie_title = $t[1];
        continue;
      }
      // find longest track
      $parts = preg_match("/^TINFO:(\d+),30,0,\".*\s,\s(.*)\s(\S+)\"/", $track_info[$i], $t);
      if ($parts != 0) {
        if ($t[3] == "MB") {
          // only consider tracks >1GB
          echo "Track $t[1] has $t[2] units of $t[3]... skipping.\n";
        } else {
          echo "Track $t[1] has $t[2] units of $t[3]\n";
          if ($t[2] > $length) {
    	$length = $t[2];
    	$long_track = $t[1];
          }
        }
      }
    }
    
    // Rip the Blu-ray!
    
    echo "\nRipping ".$movie_title." (track ".$long_track.")\n\n";
    exec("/usr/bin/makemkvcon mkv --decrypt --progress=-stdout --minlength=120 dev:$cddevice ".($long_track)." /storage/tmp/ripper.tmp >> /var/log/cdrip.log");
    $movie_title_path = "/storage/movies/".$movie_title.".mkv";
    Last edited by waltonb; 03-21-2012 at 03:14 PM. Reason: left out the changes to the final rip command

  8. #18
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Originally Posted by cburbs
    The downside to having your vortexbox do the encoding is the time it will take -

    I did a 5 minute test file a while back on 4 different machines for a handbrake encode -

    ...
    Handbrake watchfolder - http://videoscripts.wordpress.com/

    MECBuddy - http://mcebuddy.com/
    http://www.hack7mc.com/2010/04.....n-wtv.html
    http://www.mediasmartserver.ne.....sh-new-ui/
    How to Handbrake watchfolder to run on a powerfull vortexbox server? I want to guet compact files from the DVD/BD disks. Just insert the dvd and forget, cover art and a small mkv file will appear under the dnla server...

    Any idea?

  9. #19
    Administrator andrew's Avatar
    Join Date
    Nov 2008
    Location
    New Hampshire
    Posts
    3,617
    pmendes, This has nothing to do with the original thread. You may want to make a new thread and ask your question more clearly.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •