HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: rjamorim on 2003-08-06 07:00:11

Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-06 07:00:11
Hello.

Here's the story:

I got the David Gilmour in Concert DVD. One of it's features is a LPCM stream with 24bit depth instead of the usual 16bit. I am interested in ripping this stream, cutting it and encoding it with QuickTime, since it's "best" mode is reportedly best for 24bit signals.

So, I first ripped the DVD with DVDdecrypter, then extracted the LPCM stream with VobEdit.

Now VobEdit has a bug, it always writes the wav header of LPCM streams as 16bit, probably because it has never seen a 24bit stream.

So, I ripped it, and removed the erroneous wav header with Marco Pontelo's RiffStrip.

My next step was loading it on CoolEdit on RAW PCM mode, and testing around with different 24bit settings until I found some setting that represented the correct settings of the stream.

There's where the weirdness began.

When I set, in the LPCM settings, "Data formatted as: 24-bit packed Intel PCM" with +2 offset, I got this:
http://pessoal.onda.com.br/rjamorim/screen1.png (http://pessoal.onda.com.br/rjamorim/screen1.png)

And when I used "Data formatted as: 24-bit packed Motorola PCM" with offset +1, I got this:
http://pessoal.onda.com.br/rjamorim/screen2.png (http://pessoal.onda.com.br/rjamorim/screen2.png)

So, how can this be? Two different byte orders in the same stream, one in each channel? Did anyone experience something similar?


And does anyone has any idea of what can be done with this stream? Maybe I am not doing it the right way? Maybe I should use another tool to rebuild the RIFF header?

The LPCM stream plays fine on WinDVD and PowerDVD, by the way.

Also, if anyone wants to check out, I uploaded a sample of the LPCM stream inside the VOB container in ZIP format. It's 9.7Mb large, and it's lenght is less than one minute.
http://pessoal.onda.com.br/rjamorim/VTS_02_1.zip (http://pessoal.onda.com.br/rjamorim/VTS_02_1.zip)

Thanks for any help;

Roberto.
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-06 08:11:36
Don't know whether or not DVD2AVI (http://arbor.ee.ntu.edu.tw/~jackei/dvd2avi/) handles 24-bit WAV headers properly, but that's what I use for extracting LPCM audio from VOBs. Have you tried it?

    - M.

Edit: If nothing else works, you could always extract the channels separately and merge them in a new WAV....
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-06 10:14:54
Quote
Don't know whether or not DVD2AVI (http://arbor.ee.ntu.edu.tw/~jackei/dvd2avi/) handles 24-bit WAV headers properly, but that's what I use for extracting LPCM audio from VOBs. Have you tried it?

I couldn't get it to extract the LPCM track only.

What's the trick?

Quote
Edit: If nothing else works, you could always extract the channels separately and merge them in a new WAV....


I guess I'll end up doing that, indeed. :-/

Thanks for the ideas.
Title: Big weirdness on DVD audio LPCM stream
Post by: 2Bdecided on 2003-08-06 10:17:13
Quote
Edit: If nothing else works, you could always extract the channels separately and merge them in a new WAV....

Yes - that what I thought when I saw it.

If you're going to use Cool Edit 1.2a, be careful. I had to do something similar, and found that the obvious method (for me: multi track pan left, pan right, mix down 32-bit) wasn't perfectly bit-accurate at 24-bits IIRC. Mix replace pasting one channel into the other file is bit-perfect IIRC.

Cheers,
David.
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-06 10:32:39
Quote
I couldn't get it to extract the LPCM track only.

What's the trick?

Hi Roberto. You need to configure DVD2AVI as follows:

  1) "Audio" > "Track Number" > "Track #" (checked)
  --> Be sure the proper "Track #" for the LPCM stream is checked!
  2) "Audio" > "Channel Format" > "Linear PCM" (checked)
  3) "Audio" > "48 -> 44.1 KHz" > "Off" (checked)
  4) "Audio" > "Normalization" (UN-checked)

  Then do "File" > "Save Project" (do NOT try to "Save AVI"!). Your WAV will be written as a separate file with the same name you selected for the project, plus the format description appended to the name.

    - M.
Title: Big weirdness on DVD audio LPCM stream
Post by: rpop on 2003-08-07 22:20:09
I'm using the latest stable version of DVD2AVI (1.77.3) and it has no Channel Format option under Audio. Which one are you using?
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-08 04:11:20
Quote
I'm using the latest stable version of DVD2AVI (1.77.3) and it has no Channel Format option under Audio. Which one are you using?

Sorry... the instructions I gave were for stable version 1.76. In 1.77.3 the structure of the "Audio" menu has slightly changed, so step 2 from above should read as follows:

  2) "Audio" > "Output Method" > "Decode to WAV (AC3, LPCM)" (checked)

    - M.
Title: Big weirdness on DVD audio LPCM stream
Post by: rpop on 2003-08-08 06:14:56
Quote
"Audio" > "Output Method" > "Decode to WAV (AC3, LPCM)" (checked)

I thought so too, but the output file still was still filled with static 
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-08 06:19:12
I am under the impression that there is no ripping software supporting 24bit yet
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-08 07:35:37
Quote
I am under the impression that there is no ripping software supporting 24bit yet

One piece of software may soon support 24-bit LPCM. I sent the following e-mail to the author of DVDDecrypter:
Quote
Hi! Thank you for all the work you have done on the DVDDecrypter project. I have a quick question (at least, I hope it's quick...):

  Is there something wrong with the "Demux" function for LPCM streams, under "Stream Processing"?

  The reason I ask is that, although I can extract a clean LPCM WAV from a VOB file (ripped with DVDDecrypter), I am unable to get the same results when using DVDDecrypter's built-in demuxing function. I've selected the appropriate stream, and changed the behaviour to "Demux," but the output WAV has intermittent static overlaying the music. Also, for some reason the software seems (?) completely unable to handle 24-bit LPCM (as on David Gilmour's live concert DVD). Is this a known issue, and are there already plans to fix this behaviour?

  With sincere thanks and appreciation,
    - M.


  ... and received this answer within a few hours:
Quote
From: "DVD Decrypter Support Team"
Subject: Re: Demux LPCM does not work?
Date: Fri, 8 Aug 2003 07:16:43 +0100

Sorry, I introduce a bug in the last version. Its fixed in the new one that I will release shortly.


  Expect an update some time in the near future....

    - M.
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-08 07:45:23
Quote
Expect an update some time in the near future....

Great. Thank-you very much, M
Title: Big weirdness on DVD audio LPCM stream
Post by: Tes on 2003-08-08 07:47:12
check this (http://www.avsforum.com/avs-vb/showthread.php?threadid=163722)

If the LPCM track on your dvd has the same format as the ones in that thread, Thomas's program should do the trick. He probably wouldn't mind sending it to you. I think I still have a copy the program but I don't want to distribute it without Thomas's permission.
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-08 08:07:03
Thanks for the hint, Tes. Already PMd the developer
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-08 08:12:13
... and I sent a link for that thread to the author of DVDDecrypter. 

  Roberto, did you already ask permission to host Thomas' program on Rarewares?

    - M.
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-08 08:17:04
Quote
Roberto, did you already ask permission to host Thomas' program on Rarewares?

I was exactly thinking about that

I will wait for the tool to arrive first. Then I'll immediately reply asking for the permission.

Although, I must admit, Eye of Horus' post at the end of that thread is quite disturbing.
Title: Big weirdness on DVD audio LPCM stream
Post by: rpop on 2003-08-08 19:34:58
Edit: The program is now available at RareWares (http://rarewares.hydrogenaudio.org/files/lpcm24.zip)
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-08 20:56:05
Mr. Thomas just sent me a mail, but it didn't work.

Here is what I got out after I ran the tool on the sample linked at the first post:
http://pessoal.onda.com.br/rjamorim/screen3.png (http://pessoal.onda.com.br/rjamorim/screen3.png)

At least, I can start to see some waveforms there
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-09 03:11:11
Okay, let's continue the thread here.

Yes the tool has a lot of limitations and only serves one single purpose. Reorder the bytes in a raw (no header whatsoever) 24bit lpcm data stream so they are in normal Intel byte order for 24bit wav samples and slap a WAV header on the resulting file. Since there are two types of wave headers and different tools support playback only in one or the other I added the option for the Windows 2000 style WAV headers as well. It only works with 24 bit files and there are much nicer tools available to rip 16 and 8 bit lpcm.

I use vstrip to extract the lpcm24 tracks in raw format. Whatever tool you use you must make sure the ripped track only contains raw samples with no headers in front.

I have not tried this with DVDdecrypter and I am not sure in what format it extracts the data. However I got feedback from a couple of people that this little tool works for them quite reliably.

Cheers

  Thomas

P.S.: Please feel free to host this and if you can get this build into DVDdecrypter even better
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-09 04:46:57
Hello, Thomas.

This time, I ripped from the DVD directly to a PCM stream with vStrip. Then I ran
lpcm24 -48 test.raw test.wav

I got this:
http://pessoal.onda.com.br/rjamorim/screen4.png (http://pessoal.onda.com.br/rjamorim/screen4.png)


the mistery deepens... :B
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-09 06:10:31
This starts looking like a wave form. Which stream id did you extract in vstrip?

Cheers

  Thomas
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-09 07:06:53
Quote
This starts looking like a wave form. Which stream id did you extract in vstrip?

Standard 0xA0

Now, a weird fact:
When I try to play a vob stream with the LPCM stream only demuxed with vStrip on PowerDVD or WinDVD, the stream plays with the same errors as the raw LPCM strem I demuxed with vStrip and processed with your program. So the error is obviously in vStrip.

When I just decrypt the entire DVD with DVDdecrypter and try to play the vob on WinDVD or PowerDVD, the LPCM stream sounds perfectly.

But as soon as I demux the LPCM stream from the VOB using VobEdit, and run it through your program, the errors are back.

So I believe that what we are really missing is a decent VOB demultiplexer that understands 24bit/48kHz format.

BTW: VobEdit is a piece of crap that writes wrong WAV headers (even if the very program shows on stream information that it's 24bit, it writes a 16bit header), and there's no way to output RAW streams. The GUI also breaks on 800x600. Utterly POS.

Anyway, since I was afraid RiffStrip might bork the stream as well, I decided to leave it alone with the WAV header and run the tool on it. Worst case, there would be a little garbage at the beginning. Anyway, after corrected with your tool, the stream looked like this:
http://pessoal.onda.com.br/rjamorim/screen5.png (http://pessoal.onda.com.br/rjamorim/screen5.png)

Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-09 08:08:33
The RAW stream I linked to in my first post was demuxed with VobEdit. Therefore, it's broken.

I've replaced it with a VOB stream cut from the same DVD. It seems to be working (plays well on WinDVD), therefore if anyone downloaded the former stream to test, I suggest you download this new one.
http://pessoal.onda.com.br/rjamorim/VTS_02_1.zip (http://pessoal.onda.com.br/rjamorim/VTS_02_1.zip)

I have updated my first post as well.

Regards;

Roberto.
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-09 17:01:10
Very interesting. I have never tried this on 24/48. I wrote this tool to load the tracks from Classic Records DADs which are ein 24/96 on my jukebox.

I just checked and found a classical concert DVD that has a 24/48 LPCM track on it. I will try to reproduce the problem.

Cheers

  Thomas
Title: Big weirdness on DVD audio LPCM stream
Post by: JeanLuc on 2003-08-09 18:01:09
Did you try Smartripper yet ?

Activate Stream Processing and DeMux the LPCM audio to an extra file (no need to extract from VOB's with another application)
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-09 18:06:15
I just extracted the lpcm 24/48 track from Herbert von Karajans recording of Beethooven's 9th Symphony Sony SVD46364 and converted the resulting raw streams with lpcm24.

I did not encounter any problem. Let me give you the vstrip options that I use to extract the tracks.


Input pane:
All the VOBs with the actual content in order

IFO pane
The IFO file describing the content of the above VOBs. In my case the different movements are organized by cell id but this differs from DVD to DVD

Output pane
deselect all streams and check substreams. Only extract 0xa0 which should read (PCM Audio Stream 0)

Output Name:
Select your directory and file name with type raw PCM stream

Output 0

Under output options
Only demux must be checked

Split file size is in my case by cellid to get the individual movements

Hope this helps

  Thomas
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-10 00:08:54
On second thought!

After looking at the wave form I checked again what the format of the stereo track on the Karajan DVD is. As it turns out my wave form looks weird since the original track is 16/48 and not 24/48. It got fooled by playing it on my laptop were it sounded okay on a quick glance.

I do not have access to any such DVD an can not look into what is going wrong. I have about a dozen DADs from Checky Records, Water Lilly Acoustics, and Classic Records containing 24/96 tracks which all have worked fine using the described method.


Roberto, I tried to look at the vob file you posted but it plays only static for me with Cineplayer.

Cheers

    Thomas
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-10 03:24:12
Have you tried working with the VOB file I linked to in my first post?

Unfortunately, there's no IFO since I had to cut that file.
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-10 03:27:25
Yes I did, I just edited my old posting. It plays only static for me using Cineplayer.

Cheers

    Thomas
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-10 03:46:26
Quote
Yes I did, I just edited my old posting. It plays only static for me using Cineplayer.

Does cineplayer support 24bit?

I'm 100% sure it plays well on my WinDVD 5.
Title: Big weirdness on DVD audio LPCM stream
Post by: thomaspf on 2003-08-10 03:48:02
Hmm, I send you a PM.

Cheers

  Thomas
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-10 04:21:20
It works!!!!

Thanks a bunch, Thomas. It was really of great help
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-10 04:26:28
Hmm... I'm curious as to the fix. Is there a new program/solution for demuxing this sort of audio? For reference, the VOB plays fine even in my old version of WinDVD 3.0, and plays fine in Winamp using VID4WA (http://rc4wa.narod.ru/) 2.6, but I didn't have any success demuxing a non-encrypted (?) stream.

    - M.
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-10 04:38:24
Here is what I did:

Decrypted the stream and copied it to my HDD with DVDdecrypter.

Demuxed the LPCM stream with vStrip

Ran lpcm24 through it (lpcm24 -48 VTS_02_1.RAW VTS_02_1.WAV)

That's it

I don't know what went wrong the last time I did the same chain.

And yes, VobEdit is buggy and destroys the stream.
Title: Big weirdness on DVD audio LPCM stream
Post by: rjamorim on 2003-08-10 04:43:10
If anyone is interested in it: I uploaded the tool to RareWares (with Thomas' permission)

It's available at the "others" page:
http://rarewares.hydrogenaudio.org/others.html (http://rarewares.hydrogenaudio.org/others.html)

According to him, sources will be made available soon.

Again, thanks a lot to Thomas

Edit: Sources are now included
Title: Big weirdness on DVD audio LPCM stream
Post by: M on 2003-08-10 05:35:29
Quote
Here is what I did:

Decrypted the stream and copied it to my HDD with DVDdecrypter.

Demuxed the LPCM stream with vStrip

Ran lpcm24 through it (lpcm24 -48 VTS_02_1.RAW VTS_02_1.WAV)

That's it

I don't know what went wrong the last time I did the same chain.

And yes, VobEdit is buggy and destroys the stream.

Ah! Went back to the VOB I got from you, and demuxed the stream using bbTools 1.9 (available from Doom9 (http://www.doom9.org/)) with the following line:
Code: [Select]
bbdmux vts_02_1.vob 0xBD vts_02_1-test.raw 0xA0


  Then I passed the raw stream through lpcm24 as follows:
Code: [Select]
lpcm24 -48 vts_02_1-test.raw vts_02_1-test.wav


  ... and it worked perfectly. 

  Thanks Thomas (for designing the tool), and thanks Roberto (for giving it a home on the web and enduring all those frustrating moments until the problem was solved).

    - M.