Some progress with MakeMKV, (makemkvcon works!) getting close I guess

Zirias

Aspiring Daemon

Reaction score: 224
Messages: 609

As I'm writing this, makemkvcon is running on my FreeBSD 12.0-RELEASE desktop machine (not in a vm or linux-jail) and reading a title from a commercial bluray disk!

Forget all of the following, I found a better way without a jail for building, see next post!

What I did so far to get it running:
  • Build and install a kernel with GENERIC configuration plus device sg for Linux-compatible /dev/sg* devices.
  • Setup a devuan jail and build MakeMKV inside it, statically linked against ffmpeg. For the GUI/oss part, I used --prefix=/opt/makemkv and added LDFLAGS to search libraries at runtime in /opt/makemkv/lib and request a program interpreter /opt/makemkv/lib/ld-linux.so. To achieve the same for makemkvcon, I used PatchELF.
  • Install makemkv-oss and makemkv-bin, the latter with make PREFIX=/opt/makemkv install.
  • Copy /opt/makemkv from the jail to the host system, copy the jail's program interpreter to /opt/makemkv/lib/ld-linux.so and all required libraries to /opt/makemkv/lib. At this point, makemkvcon on the host will run (display the help text), but won't detect any drives.
  • makemkvcon uses /sys/bus/scsi to find the drive, and unfortunately, linsysfs(5) doesn't provide it. So I faked it: Unmount /compat/linux/sys and create the dirs /compat/linux/sys/bus/scsi/devices, /compat/linux/sys/bus/scsi/drivers/sr, /compat/linux/sys/class/block and /compat/linux/sys/class/scsi_generic.
  • Identify your optical drive with camcontrol devlist. On my system, it's
    Code:
    <HL-DT-ST BD-RE  GGW-H20L YL04>    at scbus1 target 0 lun 0 (sg0,cd0,pass1)
    which means my block device is cd0, my linux scsi-generic device is sg0, my bus is 1, target 0, lun 0. Now create the directories /compat/linux/sys/class/block/<blockdev> (e.g. /compat/linux/sys/class/block/cd0), /compat/linux/sys/class/scsi_generic/<sgdev> (e.g. .../sg0) and /compat/linux/sys/bus/scsi/devices/<bus>:0:<target>:<lun> (e.g. for me: /compat/linux/sys/bus/scsi/devices/1:0:0:0). Inside this device directory, create relative symlinks to your "block" and "scsi_generic" directories, looking like this:
    Code:
    /compat/linux/sys/bus/scsi/devices/1:0:0:0:
    total 3
    lrwxr-xr-x  1 root  wheel  23 Apr 27 08:52 block -> ../../../../class/block
    lrwxr-xr-x  1 root  wheel  30 Apr 27 08:47 scsi_generic -> ../../../../class/scsi_generic
    Also, create a symlink from /compat/linux/sys/bus/scsi/drivers/sr/1:0:0:0 to ../../devices/1:0:0:0 (replace with your bus/target/lun).
    Then do
    Code:
    echo 5 >/compat/linux/sys/bus/scsi/devices/1:0:0:0/type
    touch /compat/linux/sys/class/block/cd0/dev
    touch /compat/linux/sys/class/scsi_generic/sg0/dev
    With this faked sysfs, makemkvcon should find and use the drive.
  • Try /opt/makemkv/bin/makemkvcon info disc:0 to get info on the disc currently in the drive, /opt/makemkv/bin/makemkvcon mkv disc:0 <n> /path/to/output to save title <n> as an .mkv file to the output path.
Meanwhile, my own run is finished and the mkv file is fine! Yay!

There are still two problems though:
  • makemkvcon crashes and dumps core after every run (fortunately after doing its work correctly)
  • makemkv (the gui) won't run at all :( It prints the following to the console:
    Code:
    QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
    QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
    and shows a dialog message "Application failed to initialize". It would be great to fix this issue to make MakeMKV work perfectly on FreeBSD ;)
edit: concerning the second problem, I built a native FreeBSD version of the makemkv GUI (some minor patching of the source was needed) and trying to run this doesn't give any console output, but the same dialog box with "Application failed to initialize". Would be great if someone could find a solution for this, although console-only functionality is fine of course :)
 
Last edited:
  • Thanks
Reactions: bjs
Top