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

[Feature Request] - Preserve track information #7

Open AkiraNorthstar opened 5 years ago

AkiraNorthstar commented 5 years ago

Preserve language information of audio and subtitle tracks for easier post-processing stuff. Example:

$ bluray_info -m -a -s -c /mnt/BD/TestDiscs/Test1/
Disc title: XXXXXXXXXX – Blu-ray™
Title: 170, Playlist: 420, Length: 02:13:28.00, Chapters: 016, Video streams: 01, Audio streams: 03, Subtitles: 03, Filesize: 32377 MB
        Audio: 01, Language: eng, Codec: dtshd-ma, Format: multi_chan, Rate: 48
        Audio: 02, Language: deu, Codec: dtshd-ma, Format: multi_chan, Rate: 48
        Audio: 03, Language: tur, Codec: ac3, Format: multi_chan, Rate: 48
        Subtitle: 01, Language: eng
        Subtitle: 02, Language: deu
        Subtitle: 03, Language: tur
        Chapter: 001, Start: 00:00:00.00, Length: 00:05:34.08
        Chapter: 002, Start: 00:05:34.08, Length: 00:08:50.19
        Chapter: 003, Start: 00:14:24.28, Length: 00:06:26.71
        Chapter: 004, Start: 00:20:50.99, Length: 00:05:28.24
        Chapter: 005, Start: 00:26:19.24, Length: 00:10:08.73
        Chapter: 006, Start: 00:36:27.97, Length: 00:09:35.95
        Chapter: 007, Start: 00:46:03.92, Length: 00:08:36.26
        Chapter: 008, Start: 00:54:40.19, Length: 00:10:30.08
        Chapter: 009, Start: 01:05:10.28, Length: 00:06:52.99
        Chapter: 010, Start: 01:12:03.27, Length: 00:08:16.91
        Chapter: 011, Start: 01:20:20.19, Length: 00:09:21.35
        Chapter: 012, Start: 01:29:41.54, Length: 00:07:15.35
        Chapter: 013, Start: 01:36:56.89, Length: 00:07:47.25
        Chapter: 014, Start: 01:44:44.15, Length: 00:05:47.09
        Chapter: 015, Start: 01:50:31.24, Length: 00:07:22.31
        Chapter: 016, Start: 01:57:53.56, Length: 00:15:34.43
$ bluray_copy -m /mnt/BD/TestDiscs/Test1/ -o /mnt/BD/Test1.m2ts
...

After using bluray_copy:

$ mediainfo /mnt/BD/Test1.m2ts           
General
ID                                       : 0 (0x0)
Complete name                            : /mnt/BD/Test1.m2ts
Format                                   : BDAV
Format/Info                              : Blu-ray Video
File size                                : 31.6 GiB
Duration                                 : 2 h 13 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 33.9 Mb/s
Maximum Overall bit rate                 : 48.0 Mb/s

Video
ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Codec ID                                 : 27
Duration                                 : 2 h 13 min
Bit rate mode                            : Variable
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive

Audio #1
ID                                       : 4352 (0x1100)
Menu ID                                  : 1 (0x1)
Format                                   : DTS XLL
Format/Info                              : Digital Theater Systems
Commercial name                          : DTS-HD Master Audio
Muxing mode                              : Stream extension
Codec ID                                 : 134
Duration                                 : 2 h 13 min
Bit rate mode                            : Variable
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 24 bits
Compression mode                         : Lossless

Audio #2
ID                                       : 4353 (0x1101)
Menu ID                                  : 1 (0x1)
Format                                   : DTS XLL
Format/Info                              : Digital Theater Systems
Commercial name                          : DTS-HD Master Audio
Muxing mode                              : Stream extension
Codec ID                                 : 134
Duration                                 : 2 h 13 min
Bit rate mode                            : Variable
Channel(s)                               : 6 channels
Channel layout                           : C L R Ls Rs LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossless

Audio #3
ID                                       : 4354 (0x1102)
Menu ID                                  : 1 (0x1)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : 129
Duration                                 : 2 h 13 min
Bit rate mode                            : Constant
Bit rate                                 : 448 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : 24 ms
Stream size                              : 428 MiB (1%)
Service kind                             : Complete Main

Text #1
ID                                       : 4608 (0x1200)
Menu ID                                  : 1 (0x1)
Format                                   : PGS
Codec ID                                 : 144

Text #2
ID                                       : 4609 (0x1201)
Menu ID                                  : 1 (0x1)
Format                                   : PGS
Codec ID                                 : 144

Text #3
ID                                       : 4610 (0x1202)
Menu ID                                  : 1 (0x1)
Format                                   : PGS
Codec ID                                 : 144

Best Regards, AkiraNorthstar

beandog commented 5 years ago

The problem is that the language information is stored in the metadata of the blu-ray, not the contents of the stream itself (same as with DVDs).

To get it added, I'd have to do some kind of muxing with the output stream (m2ts) into another container, most likely mkv.

I haven't looked into the possibility of doing that yet. I did try with ffmpeg / lavc but didn't get very far at all. Using libmatroska would make more sense.