How to get titles and chapters on a DVD?

I found many questions about creating a DVD menu using ffmpeg, but I did not find anyone about programmatically accessing DVD structure information. When I use the libav library (or FFmpeg), I can open the DVD image (iso file) and access the video, audio and subtitle streams. But I could not find the API.

I can play videos and find information using a VLC player (and therefore the libvlc library). But I need to do some processing on audio and subtitle programmatically. I don’t want to split VOB with tools like SmartRipper, and only then process it.

Does libav (ffmpeg) have any API for working with DVD menus? If you can not recommend any other library that can be used to obtain information about the start and end time of a chapter (chapter) with an accuracy of one frame (sample, AVPacket)?

I heard about the libdvdnav library, but I don't know if this is right for me. I am new to libav and DVD libraries.

+6
source share
3 answers

Mplayer can do this. I am not familiar with their library, but it may help you get started.

mplayer dvd:// -identify 

Result

  CHAPTERS: 00: 00: 00.000,00: 03: 40.200,00: 07: 29.500,00: 12: 04.033,00: 16: 17.199,
 00: 27: 36.499,00: 34: 26.166,00: 43: 37.199,00: 49: 29.533,00: 59: 46.500,01: 12: 47.667,
 01: 17: 09.000.01: 26: 13.700.01: 47: 15.833.01: 50: 06.200.01: 55: 25.500.02: 06: 42.500,
 02: 13: 03.666,02: 20: 37.499,02: 28: 20.832,02: 33: 26.832,02: 37: 47.532,02: 43: 58.665,
 02: 51: 00.165,02: 56: 36.165,03: 01: 21.998,03: 05: 09.331,03: 07: 14.665,03: 11: 49.665,
 03: 16: 35.165,
+3
source

Basically you cannot say, but you can find the longest heading.

one option: use handbrakecli -scan e: (part of the hand brake)

other: use mplayer -identify dvd:// -dvd-device e: (mplayer standard)

From: http://betterlogic.com/roger/2011/07/dvd-determine-main-title-from-command-line/

It helped me since VLC lists the headings and chapters in it.

Basically, install VLC Media Player, and then play your DVD on it. Move until he "plays a real title"

then go to Play [menu] β†’ title and see which one it is currently highlighting.

Now you know which title is the β€œmain” title track.

Source: http://betterlogic.com/roger/2010/11/how-to-use-vlc-to-tell-how-many-titles-and-chapters-and-which-is-the-main/

+1
source

I'm not sure what accuracy in 1 frame means in this context. However, I used the lsdvd tool, which is the basic CLI tool that takes as a parameter only the block device of your DVD drive. (Without this option, it will guess /dev/dvd , which is missing in modern Linux, and usually /dev/sr0 .) Then it will provide you with a good list of chapters on the disk, for example:

 $ lsdvd /dev/sr0 Disc Title: METAL_DISC_2 Title: 01, Length: 00:00:00.433 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 01 Title: 02, Length: 00:00:11.500 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00 Title: 03, Length: 00:00:00.433 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 01 Title: 04, Length: 00:00:00.433 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 01 Title: 05, Length: 00:00:09.000 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00 Title: 06, Length: 00:00:10.000 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00 Title: 07, Length: 00:00:00.433 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 01 Title: 08, Length: 00:25:02.333 Chapters: 06, Cells: 06, Audio streams: 01, Subpictures: 00 Title: 09, Length: 00:00:00.433 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00 Title: 10, Length: 00:07:48.700 Chapters: 16, Cells: 16, Audio streams: 01, Subpictures: 00 Title: 11, Length: 00:00:00.433 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00 Title: 12, Length: 00:16:43.066 Chapters: 08, Cells: 08, Audio streams: 01, Subpictures: 00 ...snip... Longest track: 20 

If you want to write your own code, I think that looking at the source for lsdvd will be instructive. The only library it libdvdread.so.4 in Fedora 25 (other than the standard ones) is libdvdread.so.4 , which is part of dvdnav .

NTN.

+1
source

Source: https://habr.com/ru/post/924406/


All Articles