Using libdvdread to extract audio stream

Dave Chapman <[email protected]> Wed, 30 Mar 2005 09:01:40 +0100
Newsgroups gmane.comp.video.ogle.devel
Message-ID <[email protected]>
Hi,

I want to be able to extract the audio stream from a DVD title,
splitting it by chapter.

The main use is for music DVDs (including the VIDEO_TS part of DVD-Audio
discs) so I can extract the LPCM audio to a set of WAV files, one per track.

I've looked at the example "play_title.c" program in the libdvdread
source, and this seems to do most of the work for me.

I can use the information stored in vts_file->vtsi_mat->vts_audio_attr[]
to view the information on the various audio streams, and I can parse
the private stream packets to extract the audio data.

In my example DVD, audio stream 0 contains LPCM audio (with substream_id
0xa0) and audio stream 1 contains AC3 audio (with substream_id 0x89).

The problem I have is identifying which audio stream to extract.  Does
libdvdread provide any kind of mapping between the information in the
vts_audio_attr structure and the substream_id used in the VOB file?

i.e. I want to be able to say "extract audio stream 0", instead of
"extract audio stream 0xa0" or "extract audio stream "0x89".

Thanks,

Dave.