beandog / bluray_info

Linux/BSD Blu-ray utilities - bluray_info, bluray_copy, bluray_player
GNU General Public License v2.0
40 stars 2 forks source link

Some playlists not selectable / wrong playlist selected #10

Open Daniel-Abrecht opened 3 years ago

Daniel-Abrecht commented 3 years ago

I saw this with the BluRay Made in Abyss - Staffel 1.Vol.1 Limited Collector's Edition, (the Germen version). There has been a playlist which I can use with ffmpeg and ffprobe, but for which bluray_info fails. (ffmpeg uses libbluray too.)

To find the right playlist of a bluray, I have a small script which uses vlc, strace and grep such that it outputs any playlist vlc opens immediatly:

strace -ff vlc "bluray://$bdpath" 2>&1 | grep 'open' | grep --line-buffered ".mpls" | grep --line-buffered -o '"[^"]*' | grep --line-buffered -o '[^"/]*$' | grep --line-buffered mpls | uniq

This way, I determined that after selecting to play the whole movie in the bluray menu in vlc, the playlists 11, 12, 13, 14, 15, 16 and 17 get played one after the other. The problem is, I can't select playlist 17 with bluray_info, it selects title 1 playlist 1 instead.

Here is what I found so far:

ffprobe doesn't list playlist 17 as a usable playlist, but selecting it works correctly (same with ffmpeg):

$ ffprobe -i bluray:///BD_MADEINABYSS1D1
ffprobe version 4.1.6-1~deb10u1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[bluray @ 0x5587effecac0] 15 usable playlists:
[bluray @ 0x5587effecac0] playlist 00004.mpls (0:23:51)
[bluray @ 0x5587effecac0] playlist 00005.mpls (0:23:51)
[bluray @ 0x5587effecac0] playlist 00018.mpls (0:17:40)
[bluray @ 0x5587effecac0] playlist 00019.mpls (0:24:59)
[bluray @ 0x5587effecac0] playlist 00006.mpls (0:23:51)
[bluray @ 0x5587effecac0] playlist 00007.mpls (0:23:51)
[bluray @ 0x5587effecac0] playlist 00008.mpls (0:23:52)
[bluray @ 0x5587effecac0] playlist 00009.mpls (0:23:51)
[bluray @ 0x5587effecac0] playlist 00010.mpls (0:23:45)
[bluray @ 0x5587effecac0] playlist 00011.mpls (0:23:41)
[bluray @ 0x5587effecac0] playlist 00012.mpls (0:23:41)
[bluray @ 0x5587effecac0] playlist 00013.mpls (0:23:41)
[bluray @ 0x5587effecac0] playlist 00014.mpls (0:23:41)
[bluray @ 0x5587effecac0] playlist 00015.mpls (0:23:42)
[bluray @ 0x5587effecac0] playlist 00016.mpls (0:23:41)
[bluray @ 0x5587effecac0] selected 00019.mpls
bluray.c:255: 00016.m2ts: no timestamp for SPN 0 (got 0). clip 524280-68015280.
Input #0, mpegts, from 'bluray:///mnt/media/video/original/BD_MADEINABYSS1D1':
  Duration: 00:24:59.81, start: 11.650667, bitrate: 13956 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 224 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
$ ffprobe -playlist 17 -i bluray:///BD_MADEINABYSS1D1
ffprobe version 4.1.6-1~deb10u1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[bluray @ 0x55faf49fab00] 15 usable playlists:
[mpegts @ 0x55faf49fa040] start time for stream 3 is not set in estimate_timings_from_pts
[mpegts @ 0x55faf49fa040] start time for stream 4 is not set in estimate_timings_from_pts
bluray.c:255: 00012.m2ts: no timestamp for SPN 0 (got 0). clip 524280-64225417.
[mpegts @ 0x55faf49fa040] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x55faf49fa040] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'bluray:///mnt/media/video/original/BD_MADEINABYSS1D1':
  Duration: 00:00:09.26, start: 11.650667, bitrate: 4781632 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Stream #0:1[0x1100]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, stereo, s32p (24 bit)
    Stream #0:2[0x1101]: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, stereo, s32p (24 bit)
    Stream #0:3[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:4[0x1201]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)

Here is what I get with bluray_info:

$ bluray_info /BD_MADEINABYSS1D1/
Disc title: 'Made in Abyss -- Staffel 1 - Disk 1', Volume name: '', Main title: 007, AACS: no, BD-J: no, BD+: no
Title: 001, Playlist: 0001, Length: 00:00:24.167, Chapters: 001, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00068 MBs
Title: 002, Playlist: 0002, Length: 00:00:21.021, Chapters: 001, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00050 MBs
Title: 003, Playlist: 0003, Length: 00:00:08.000, Chapters: 001, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00011 MBs
Title: 004, Playlist: 0004, Length: 00:23:51.722, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05303 MBs
Title: 005, Playlist: 0005, Length: 00:23:51.555, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05298 MBs
Title: 006, Playlist: 0018, Length: 00:17:40.960, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 01, Angles: 01, Filesize: 01766 MBs
Title: 007, Playlist: 0019, Length: 00:24:59.800, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 01, Angles: 01, Filesize: 02496 MBs
Title: 008, Playlist: 0020, Length: 00:02:01.079, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00201 MBs
Title: 009, Playlist: 0021, Length: 00:01:44.813, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00174 MBs
Title: 010, Playlist: 0022, Length: 00:02:56.843, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00293 MBs
Title: 011, Playlist: 0031, Length: 00:01:36.054, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00150 MBs
Title: 012, Playlist: 0032, Length: 00:01:32.968, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00143 MBs
Title: 013, Playlist: 0033, Length: 00:01:24.543, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00132 MBs
Title: 014, Playlist: 0034, Length: 00:01:46.398, Chapters: 002, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00163 MBs
Title: 015, Playlist: 0006, Length: 00:23:51.555, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05307 MBs
Title: 016, Playlist: 0007, Length: 00:23:51.513, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05313 MBs
Title: 017, Playlist: 0008, Length: 00:23:52.014, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05309 MBs
Title: 018, Playlist: 0009, Length: 00:23:51.764, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05301 MBs
Title: 019, Playlist: 0010, Length: 00:23:45.591, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05278 MBs
Title: 020, Playlist: 0011, Length: 00:23:41.712, Chapters: 005, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05285 MBs
Title: 021, Playlist: 0012, Length: 00:23:41.545, Chapters: 005, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05280 MBs
Title: 022, Playlist: 0013, Length: 00:23:41.545, Chapters: 005, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05289 MBs
Title: 023, Playlist: 0014, Length: 00:23:41.503, Chapters: 005, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05295 MBs
Title: 024, Playlist: 0015, Length: 00:23:42.004, Chapters: 005, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05291 MBs
Title: 025, Playlist: 0016, Length: 00:23:41.754, Chapters: 005, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05283 MBs
$ bluray_info /BD_MADEINABYSS1D1/ -p 17 -x
Disc title: 'Made in Abyss -- Staffel 1 - Disk 1', Volume name: '', Main title: 007, AACS: no, BD-J: no, BD+: no
Title: 001, Playlist: 0001, Length: 00:00:24.167, Chapters: 001, Video streams: 01, Audio streams: 01, Subtitles: 00, Angles: 01, Filesize: 00068 MBs
    Video: 01, Format: 1080p, Aspect ratio: 16:9, FPS: 24.00, Codec: h264
    Audio: 01, Language: und, Codec: ac3, Format: multi_chan, Rate: 48
    Chapter: 001, Start: 00:00:00.000, Length: 00:00:24.167

Another interesting thing I found is, that if I select a specific episode in the bluray menu in vlc, then it returns to the menu after playing it, and it uses different playlists in that case (playlist 4 instead of 11, playlist 10 instead of 17, and so on). The interesting thing about this is, playlist 4 and 11 for example, are listed in bluray_info and ffprobe. playlist 10 is listed too (and can be selected bluray_info). But while playlist 4 and 11 slightly differ, playlist 10 and 17 (the last episode, so both return to the menu) are identical. I compared the 2 mpls files using the diff utility, they have the same content.

For completeness sake, here is the bluray_info output for playlist 10:

$ bluray_info /BD_MADEINABYSS1D1/ -p 10 -x
Disc title: 'Made in Abyss -- Staffel 1 - Disk 1', Volume name: '', Main title: 007, AACS: no, BD-J: no, BD+: no
Title: 019, Playlist: 0010, Length: 00:23:45.591, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 05278 MBs
    Video: 01, Format: 1080p, Aspect ratio: 16:9, FPS: 23.97, Codec: h264
    Audio: 01, Language: deu, Codec: dtshd-ma, Format: stereo, Rate: 48
    Audio: 02, Language: jpn, Codec: dtshd-ma, Format: stereo, Rate: 48
    Subtitle: 01, Language: deu
    Subtitle: 02, Language: deu
    Chapter: 001, Start: 00:00:00.000, Length: 00:01:58.744
    Chapter: 002, Start: 00:01:58.744, Length: 00:11:02.245
    Chapter: 003, Start: 00:13:00.989, Length: 00:08:53.366
    Chapter: 004, Start: 00:21:54.355, Length: 00:01:51.236

It would be great if bluray_info could be made to output the info for the correct playlist in these circumstances, or if it could at least check that the information it outputs are for the correct playlist.

Daniel-Abrecht commented 3 years ago

The following seams to work, kind of:

diff --git a/bluray_copy.c b/bluray_copy.c
index 07a18d1..4329b0a 100644
--- a/bluray_copy.c
+++ b/bluray_copy.c
@@ -294,7 +294,7 @@ int main(int argc, char **argv) {
        }

        // Init bluray_title struct
-       retval = bluray_title_init(bd, &bluray_title, bluray_title.ix, angle_ix);
+       retval = bluray_title_init(bd, &bluray_title, bluray_title.ix, angle_ix, opt_playlist_number ? arg_playlist_number : -1);

        // Quit if title / playlist couldn't be opened
        if(retval) {
diff --git a/bluray_info.c b/bluray_info.c
index 01c088b..5cc46af 100644
--- a/bluray_info.c
+++ b/bluray_info.c
@@ -379,7 +379,7 @@ int main(int argc, char **argv) {

        for(ix = d_first_ix; d_title_counter < d_num_titles; ix++, d_title_counter++) {

-               retval = bluray_title_init(bd, &bluray_title, ix, angle_ix);
+               retval = bluray_title_init(bd, &bluray_title, ix, angle_ix, d_playlist_number ? arg_playlist_number : -1);

                // Skip if there was a problem getting it
                if(retval)
diff --git a/bluray_open.c b/bluray_open.c
index 26f4e8b..7fc068e 100644
--- a/bluray_open.c
+++ b/bluray_open.c
@@ -82,7 +82,7 @@ int bluray_info_init(struct bluray *bd, struct bluray_info *bluray_info) {
 /**
  * Initialize and populate a bluray_title struct
  */
-int bluray_title_init(struct bluray *bd, struct bluray_title *bluray_title, uint32_t title_ix, uint8_t angle_ix) {
+int bluray_title_init(struct bluray *bd, struct bluray_title *bluray_title, uint32_t title_ix, uint8_t angle_ix, int64_t playlist) {

        // Initialize to safe values
        bluray_title->ix = title_ix;
@@ -115,7 +115,11 @@ int bluray_title_init(struct bluray *bd, struct bluray_title *bluray_title, uint

        // Quit if couldn't get title info
        BLURAY_TITLE_INFO *bd_title = NULL;
-       bd_title = bd_get_title_info(bd, title_ix, angle_ix);
+        if(playlist >= 0){
+          bd_title = bd_get_playlist_info(bd, playlist, angle_ix);
+        }else{
+         bd_title = bd_get_title_info(bd, title_ix, angle_ix);
+       }
        if(bd_title == NULL)
                return 3;

diff --git a/bluray_open.h b/bluray_open.h
index 6932271..3eb10ef 100644
--- a/bluray_open.h
+++ b/bluray_open.h
@@ -70,6 +70,6 @@ struct bluray_chapter {

 int bluray_info_init(struct bluray *bd, struct bluray_info *bluray_info);

-int bluray_title_init(struct bluray *bd, struct bluray_title *bluray_title, uint32_t title_ix, uint8_t angle_ix);
+int bluray_title_init(struct bluray *bd, struct bluray_title *bluray_title, uint32_t title_ix, uint8_t angle_ix, int64_t playlist);

 #endif

With this patch, the title number still seams wrong (not sure what it's even supposed to be here), but at least all the other data seams correct:

$ ./bluray_info /BD_MADEINABYSS1D1/ -p 17 -x
Disc title: 'Made in Abyss -- Staffel 1 - Disk 1', Volume name: '', Main title: 007, AACS: no, BD-J: no, BD+: no
Title: 001, Playlist: 0017, Length: 00:23:45.591, Chapters: 004, Video streams: 01, Audio streams: 02, Subtitles: 02, Angles: 01, Filesize: 00068 MBs
    Video: 01, Format: 1080p, Aspect ratio: 16:9, FPS: 23.97, Codec: h264
    Audio: 01, Language: deu, Codec: dtshd-ma, Format: stereo, Rate: 48
    Audio: 02, Language: jpn, Codec: dtshd-ma, Format: stereo, Rate: 48
    Subtitle: 01, Language: deu
    Subtitle: 02, Language: deu
    Chapter: 001, Start: 00:00:00.000, Length: 00:01:58.744
    Chapter: 002, Start: 00:01:58.744, Length: 00:11:02.245
    Chapter: 003, Start: 00:13:00.989, Length: 00:08:53.366
    Chapter: 004, Start: 00:21:54.355, Length: 00:01:51.236