I found many question about creating DVD menu using ffmpeg but i did not find any one about programmically access to DVD structure information. When i using libav (or FFmpeg) library i can open DVD image (iso file) and access to video, audio and subtitle streams. But i could not find any API.
I can play video and found information using VLC player (and so libvlc library). But I need to do some processing on audio and subtitle stream programmically. I don't want to split VOBs using tools like SmartRipper, and only then do processing.
Does libav(ffmpeg) contain any API for dealing with DVD menus? If not can you recommend any other library which can be used to obtain information about title(chapter) start and end time with one frame(sample, AVPacket) accuracy?
I heard about libdvdnav library but i don't know if it right for me. I'm new to libav and DVD format internals.
Basically you can’t tell, but you can look for the longest title.
one option: use
handbrakecli -scan e:
(part of handbrake)another: use
mplayer -identify dvd:// -dvd-device e:
(mplayer standard)
From: http://betterlogic.com/roger/2011/07/dvd-determine-main-title-from-command-line/
This helped me, as VLC lists the titles and chapters in it's GUI Menu's
Basically, install VLC Media Player, then play your DVD in it. Navigate through till it “is playing the real title”
then go to Playback [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/
I'm not sure about what 1-frame accuracy means in this context. However, I've been using a tool called lsdvd, which is a basic CLI tool that takes as it's only parameter, the block device of your DVD drive. (Without that parameter, it will guess /dev/dvd
, which is lacking on modern Linux, and is usually /dev/sr0
.) It will then give you a nice listing of the chapters on the disc, like so:
$ 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 wish to write your own code, I imagine looking at the source for lsdvd
will be instructive. The only library it links against in Fedora 25 (other than standard stuff) is libdvdread.so.4
, which is part of the dvdnav project.
HTH.
Mplayer can do this. I am not familiar with their library, but this could get you 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,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With