Log in

View Full Version : WAV File Limit Problem


bcn_246
3rd January 2006, 23:18
Ok, I am trying to work on upmixing tracks (I know, but I prefer to know Prologic II has done the 1/2ch>5.1 than some other 3rd party upmixer). I have been using GraphEdit to do this. I am using CyberLink PowerDVD's filter to upmix, and ffdshow to set the output channels. All works very well until I tried to encode the audio of a movie over 2 1/2 hours long. Problem is that if I use WAV Dest+File writer in GraphEdit I cannot encode beyond 4GB. If I use the "Dump" filter the output file is not recognised as a wav by anything (foobar2000, besweet) but is nearly 6GB. If I use WAV Dest+Dump the file is no different to WAV Dest+File writer, stopping again at 4GB (3.99 to be exact).

Other than splitting the file in two at the 1/2 channel end, encoding both, then using BeSweet to split to 6 mono WAV files and rejoin all of those, is their any other option? Obviously I could use a lossy compression format like MP3 or even a lossless one like FLAC but I am not sure they work with 6ch sound, FLAC defiantly crashed when I tried using the FLAC directshow filter. Also, BeSweet would not decode it to 6 mono WAV, and I doubt the FLAC frontend would.

So in short, is their a alternative to WAV Dest (which I assume sets the WAV header and settings in the file and makes the audio data a proper WAV) as a DirectShow filter?

Or is their any way of "fixing" the wav headers on the output files that have not been trough WAV Dest but straight from ffdshow Audio Decoder>Dump. I assume it would just be a matter of adding the headers.

Any help would be very much welcome, and apologies that my first post here is asking for something rather than giving,

Ben :)

tebasuna51
4th January 2006, 04:19
Or is their any way of "fixing" the wav headers on the output files that have not been trough WAV Dest but straight from ffdshow Audio Decoder>Dump. I assume it would just be a matter of adding the headers.
You can add a header to a raw PCM file. But if the file is > 4 GB the header is always invalid. There are two fields in wav header, to fill with filesize - 8 and with datalength, only with 4 bytes and the max value allowed is 2^32 (4 GB).

With a 'invalid' wav > 4 GB you can only, afaik, split in monowav with Tranzcode or WaveWizard.

bcn_246
4th January 2006, 16:38
You can add a header to a raw PCM file. But if the file is > 4 GB the header is always invalid. There are two fields in wav header, to fill with filesize - 8 and with datalength, only with 4 bytes and the max value allowed is 2^32 (4 GB).

With a 'invalid' wav > 4 GB you can only, afaik, split in monowav with Tranzcode or WaveWizard.
When I try to open the file with without changing any headers Trazcode says "works only with a 6ch file" so it doesnt seem to be recognising it as anything (I am on DTSWAV mode, will Trazcode do wav also?

What software can I use to add the headers? Will I have do do it with a hex editor? If so what information should I add and where? I have no experiance manually editing audio/video files with hex editors. Also do you know a (preferably freeware) hex editor that doesnt load the file into the RAM first but can open/edit from the hard drive directly?

Many thanks for your help so far,

Ben :)

Austin Forgotten
4th January 2006, 18:04
Hello Ben,

I don't recall putting an error msg like that into Tranzcode, but it's been a long time since I looked at ver 0.30. As for 'DTSWAV mode' (whatever), it will check to see if the wav file is a 16 bit stereo wav, 44kHz (the container for a DTSWav), then search the wav file for dts sync-words, if found it will decode dts to mono wavs, if not found, or if the wav is not 16 bit stereo, 44kHz, it will demux the wav by the # of channels determined in the wav header. What you are describing to me is that you are using TranzGUI. I didn't write that so I can't see what the problem might be. Tranzcode will de-interleave (demux) a multichannel wav (up to 18 channels) although it will use a lot of resources on your computer (slow it down - I've fixed that on my unrealesed ver writing in blocks). With TranzGUI, did you select '6 mono' output? I just tested a file and it works fine at that setting, but crashes on stereo, since I didn't have a downmix to stereo for multichannel wavs, only for DTSWav/DTS albiet not a very good one :(

Try opening a Commandline (DOS) window, copy tranzcode (modded) to the directory of your file, and cd (change dir) to the directory and type:

tranzcode <filename>

or if the filename contains any spaces use double quote around the filename:

tranzcode "<filename>"

-AF

bcn_246
4th January 2006, 18:44
Hello Ben,

I don't recall putting an error msg like that into Tranzcode, but it's been a long time since I looked at ver 0.30. As for 'DTSWAV mode' (whatever), it will check to see if the wav file is a 16 bit stereo wav, 44kHz (the container for a DTSWav), then search the wav file for dts sync-words, if found it will decode dts to mono wavs, if not found, or if the wav is not 16 bit stereo, 44kHz, it will demux the wav by the # of channels determined in the wav header. What you are describing to me is that you are using TranzGUI. I didn't write that so I can't see what the problem might be. Tranzcode will de-interleave (demux) a multichannel wav (up to 18 channels) although it will use a lot of resources on your computer (slow it down - I've fixed that on my unrealesed ver writing in blocks). With TranzGUI, did you select '6 mono' output? I just tested a file and it works fine at that setting, but crashes on stereo, since I didn't have a downmix to stereo for multichannel wavs, only for DTSWav/DTS albiet not a very good one :(

Try opening a Commandline (DOS) window, copy tranzcode (modded) to the directory of your file, and type:

tranzcode <filename>

or if the filename contains any space characters use double quote around the filename:

tranzcode "<filename>"

-AF
Yes you are correct, I was using TranzGUI. I assumed it would be the same as the command line. I will try using Tranzcode with the incorrect WAV file. Also Tranzcode says it outputs the files to 32 bit mono wav. My input is 16 bit and so is my Dolby Digital output. Will encoding at 32 bit and then back to 16 bit lose quality? Is their any way to output to 16 bit WAV.

Ben :)

Austin Forgotten
4th January 2006, 19:37
Hi Ben,

Thanks for not giving up on Tranzcode yet :).

Tranzcode will decode DTS (.dts) or DTSWav (.wav) to 32 bit floating point mono files. There will be output options for lower resolution bitrates with dithering etc. in the next ver however. If you are just demuxing a multichannel wav, it will output mono wavs at the bit depth the original wav was originally (if your multichan wav is 16 bit, so will the mono wavs). As for Dolby Digital, Trancode v0.30 cannot decode DD, but in the next version it will (similar to DTS decoding - default output being 32 bit floats), with option to resample output and select bit depth (all based on SSRC - http://shibatch.sourceforge.net).

Just curious, what type of file are you trying to transcode? (.wav, .dts, .ac3)

-AF

bcn_246
4th January 2006, 19:52
Hi Ben,

Thanks for not giving up on Tranzcode yet :).

Tranzcode will decode DTS (.dts) or DTSWav (.wav) to 32 bit floating point mono files. There will be output options for lower resolution bitrates with dithering etc. in the next ver however. If you are just demuxing a multichannel wav, it will output mono wavs at the bit depth the original wav was originally (if your multichan wav is 16 bit, so will the mono wavs). As for Dolby Digital, Trancode v0.30 cannot decode DD, but in the next version it will (similar to DTS decoding - default output being 32 bit floats), with option to resample output and select bit depth (all based on SSRC - http://shibatch.sourceforge.net).

Just curious, what type of file are you trying to transcode? (.wav, .dts, .ac3)

-AF
I am trying to tranzcode a 6ch WAV file. I tried the directly "dumped" one (without any wav header) and it didn't work at all. I then tried one with the correct header (that works with besweet, foobar2000 etc.) All it says is the following error:
http://img319.imageshack.us/img319/1859/error1uc.png

I am really keen to be able to get this working with Tranzcode, as then I would only have to feed into the AC3 encoder and get perfect 5.1 sound.

Thanks again for your help,

Ben :)

tebasuna51
4th January 2006, 20:25
Before using Tranzcode/TranzGUI you need add a header to your raw pcm data.

This is a header (44 bytes) for a wav 6 channel 16 bit 48 KHz.:
Offset | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
------------------------------------------------------------------------------
00000000 | 52 49 46 46 00 FF FF FF 57 41 56 45 66 6D 74 20 | RIFF.ÿÿÿWAVEfmt
00000016 | 10 00 00 00 01 00 06 00 80 BB 00 00 00 CA 08 00 | ........_»...Ê..
00000032 | 0C 00 10 00 64 61 74 61 00 FF FF FF | ....data.ÿÿÿ
Here is a graphical description of wav header:
http://ccrma.stanford.edu/courses/422/projects/WaveFormat/

You can use a hex editor to type this or to extract the first 44 bytes from a little wav with same parameters.

After you can try (I'm not sure if work for 6 GB):
copy /B header.wav + raw_data.wav new.waw

And for use tranzcode (command line mode) don't put the "<>" then:
c:\tranzcode audio6ch.wav ...

Austin Forgotten
4th January 2006, 20:47
Aha...

Yes tebasuna51 is correct, the wav file needs a wav header! That's is where the problem most likely lies ;). Hmm.. maybe I can check for that condition in the next version, and let it slide for accepting the file as a wav file and begin de-interleaving it as is, err... on second thought... bad idea :D. What sample rate & bit depth to use, and most of all number of channels -> monos to output too?

Oh, I looked at your command, don't use '<' and '>' and also leave off the -Fl -Fr -C stuff. If you want to cancle output on a channel then you need to use the format option: /-FL (to cancel FL channel), or /-FL,LFE,SR to cancel outp for those 3 channels. If you only want certain cahnnels output you can also use the /+ instead of /-. (i.e. If I only want Center, Front Left and Front Right, I would use: /+C,FL,FR so the full command would be...

c:\tranzcode audio6ch.wav /+C,FL,FR

to just extract those channels. If you just type: c:\tranzcode audio6ch.wav
it will output all channels.



-AF

bcn_246
4th January 2006, 20:57
For a 5.5GB file I am using WinHex (all the freebies kept trying to load into RAM, of which I have only 1GB), the begining of the WAV file (which is headerless) is alot of 00 00 00 00 for a long time (but it does have data further down). Should I insert new hex values at the start or overwrite the begining 00 00 00?

Austin Forgotten
4th January 2006, 21:33
Try this Ben,

I uploaded a wav header file, but you need to unrar it 1st. It is for a 16 bit 44.1kHz 6 channel extensible wav file.

get it here: http://tranzcode.byethost22.com/files/header.rar

Try the following command line to join it to your raw pcm wav.

copy /B header.wav + audio6ch.wav good.wav

(this joins the file 'audio6ch.wav' to the file 'header.wav' and produces a new file 'good.wav'

If all goes well use the file 'good.wav' (or whatever you want to call it) with Tranzcode, and maybe it will split your 6 channel wav into 6 mono wavs.

-AF

bcn_246
4th January 2006, 21:48
Try this Ben,

I uploaded a wav header file, but you need to unrar it 1st. It is for a 16 bit 44.1kHz 6 channel extensible wav file.

get it here: http://tranzcode.byethost22.com/files/header.rar

Try the following command line to join it to your raw pcm wav.

copy /B header.wav + audio6ch.wav good.wav

(this joins the file 'audio6ch.wav' to the file 'header.wav' and produces a new file 'good.wav'

If all goes well use the file 'good.wav' (or whatever you want to call it) with Tranzcode, and maybe it will split your 6 channel wav into 6 mono wavs.

-AF
Thankyou so much tebasuna51 and Austin Forgotten.
Initially the header you sent (which is 44.1kHz) was not working properly, so I made a very short 6ch 48kHz 16 bit WAV file, and copied just the first bit of the header (it looked almost identicle in the hex edit to the header.wav you sent). I am now joining them together, and tranzcode seems to accept the output .wav as a valid WAV file, I am almost certain it will work fully now.

One more thing, does Tranzcode do anything to the audio like change the volume or gain of the surround track? Alot of audio programs do this in the background without saying and it requires some reading to work out how to turn it off. I assume Tranzcode simple decodes+splits the data exactly rather than modify it unless it is told to.

I think it may be a good idea to link to this thread in the section regarding 2ch>5.1 upmixing, as there have been quite a few people asking about the 4GB limit and the only way around it they posted was splitting (which takes alot of time and is very likely to result in mistakes).

Thanks again,

Ben :)

bcn_246
4th January 2006, 23:12
The output works perfectly for smaller files now, and seemingly for large files. However the large files over 4GB sound very distorted.

Ben

Edit: I have fixed it now, I tried it again with some other films over the 4GB mark, I guess I just screwed up the DPLIIx upmix settings. All is working fine now. Thanks again :)

tebasuna51
5th January 2006, 02:16
The output works perfectly for smaller files now, and seemingly for large files. However the large files over 4GB sound very distorted. Any ideas?
Here is a correct header for 16bits, 6chan, 48KHz. (44 bytes):
http://personal.telefonica.terra.es/web/burgosrosa/header6.wav
You need insert this header before the raw data in WinHex or use:
copy /B header6.wav + raw_data.wav new.waw

If this not work maybe the raw data is corrupted.

You can try also WaveWizard to split the wav, gain, format change, ...

@Austin, sorry for recommend WaveWizard. Tranzcode works always ok for me and is the first tool in split wav6 > 4GB (also with header WAVE FORMAT EXTENSIBLE) and a excellent DTS decoder.

One question, your header WAVE FORMAT EXTENSIBLE have:
NumChannels .: 6
SampleRate ..: 44100
ByteRate ....: 529200
BlockAlign ..: 12
BitsPerSample: 32
ValidBitsPS .: 16
MaskChannels : 52506648

I think BitsPerSample must be 16 for this raw data, and MaskChannels 63 for FL-FR-C-LFE-SL-SR channels. It's correct?

Austin Forgotten
5th January 2006, 03:44
Yo tebasuna51,

Could be the header is not correct, I just picked a multichannel wav which was 16 bit 44.1kHz with 6 channels from my large test file dir, it could be a Fantastic4 or Frankenstein wav creation from an old Tranzcode test ver output. I didn't check the header that closely, just checked to see if the current circulating ver of Tranzcode would demux it, since it only looks for enough info to split into monos, speaker info may very well be wrong I remember fixing this for multichannel output awhile ago, but that's just for playback. Of course I can't post a perfect wav header so you can just append raw pcm and play it properly, also Tranzcode doesn't support raw wavs anyway.

Yes!! Wavewizard IS a much better tools for this, and with all the extra dsp stuff, but in my opinion only lacks an intuitive user friendly interface, well it's still better than my console interface anyway :p. I only jumped into this thread since Ben mentioned he had probs with Tranzcode. I know it's plagued with faults, why do you think it's taken so long for a new ver :(

@Ben, I'm glad you've found a way to reach your results. Actually I would like to experiment with extracting multichannel output from Dolbly Pro Logic IIx, seems I have problems with WinDVD Audio Decoder only allows stereo and GraphEdit crashes now, it's been a long time and quite a few software installs which have rendered GraphEdit useless to me. I think I need to unistall some apps. Anyway what was the method you used? You mentioned Foobar and data dumping...

-AF

bcn_246
5th January 2006, 17:18
Anyway what was the method you used? You mentioned Foobar and data dumping...

-AF
Ok... for my method you need
*ffdshow
*CyberLink PowerDVD 6
*GraphEdit
*tranzcode
*Sony SoundForge (although any audio software that can resample, RMS normalise and save as 2ch 16 bit PCM wav will do, GoldWave is a cheaper alternative).

1. Start SoundForge
2. Join any files together if you have more than one WAV to encode to one file (open both files, Edit > Select All > Copy the second one, then go to other one, “Edit > Go to… > Data End +1” and paste the file.) Repeat until all files are joined.
3. Resample to 48,000kHz
4. Normalise > RMS average level to -18dB (use up/down arrows to get exact if you cant drag the bar exactly and you are perfectionist like me), under "If clipping occers" click "Apply dynamic compression". Leave other settings alone.
5. Save output as 2ch 16 bit PCM WAV
6. Launch GraphEdit
7. Add the following DirectShow filters:
CyberLink Audio Effect (PDVD6)
Dump (you will need to point to where you want the output 6ch file to be)
ffdshow Audio Decoder
Wave Parser
8. Right click the CyberLink Audio Effect (PDVD6) effect filter.
9. Set the top option to "Using 6 Speakers"
10. Check "Expander", select Pro Logic II and select the desired mode (music/movie). Leave all other settings alone.
11. Right click the ffdshow Audio effect (PDVD6) effect filter
12. Check the "LFE Crossover", set the frequency to 120 and the gain to 0.00db.
13. Check the "Mixer" options.
14. Select the "3/2+LFE 5.1 channel" option, leave all the levels at the bottom on 100%
15. Select the "Mixer" subheading.
16. Check all allowed sample rates for processing, and select "16 bit integer" for the output rates. Also check "don't use WAVFORMATEXSIMBLE when not needed"
17. Then go to "Codecs" at the top, under "Uncompressed" make sure it is set to "all supported".
18. Click Apply>Ok.
19. Go to File > Render media file and open your 2ch audio WAV file.
20. Remove all the connections between filters, and drag from filter ends to make them like this:
audio2ch.wav (or your 2ch file name) > WAV Parser > CyberLink Audio Effect (PDVD6) > ffdshow Audio Decoder > audio6ch (or your output name)
21. Click the play button. You will have to wait until it goes green again to know it has finished rendering your file.
22. Unzip your tranzcode folder to somewhere easy, like C:\audioupmix
23. Copy your newly created WAV file there. Do not try and play it, it has no header at the moment.
24. UnRAR the attached "header.rar" file to C:\audioupmix (or wherever you set it to)
25. Go to Run > cmd then type “cd C:\audioupmix”
26. Type (without “”) “copy /B header + audio6ch audio6chwithheader.wav” (or replace audio6ch with your output file name, you can choose a output name also). The output WAV file will now have a header.
Note: The header file is for a 6ch 16 bit 48,000kHz WAV file.
27. Wait for that to complete, and then type “tranzcode audio6chwithheader.wav” tranzcode will then split the 6ch file into 6 mono WAV files.
28. You will now have 6 mono files. You can encode them to DTS/AC3 with whatever program you like. Commercially Sonic Audio Transcoder (Comes with Sonic Scenarist) is best for AC3 (set to 3/2 and tick Low frewquency Effects – then load in right order – bitrate should be set to 448 for a 6ch file). SurCode DVD DTS is best for DTS, just load in all the files in the correct order and save the DTS file. If you want to check the output files work I recommend you open one of the monos (FL or FR should sound clear and normal – LFE should sound very low).

Unfortunatly I am not aware of a method that does not require GraphEdit. I would suggest you redownloaded, extracted again the GraphEdit files and if any of the filters are allready pointing to your old GraphEdit logation to update them in RegEdit.

Thanks again for all your help,

Ben :)

Austin Forgotten
6th January 2006, 05:46
Hi Ben,

Thanks for writing this thorough step by step guide for your upmix method. The problems I encountered recently with Graphedit are probably my own fault, or not having the correct filter version installed, for what I'm doing with Graphedit. It's been awhile since I've used it, I followed you method using ffdshow filter (which I think I previously referred to as FooBar.. my bad :( - I never used ffdshow before). I have a problem with it, because when I want to join the filter, ffdshow seems to want to join before CyberLink Audio Effect (PDVD6) instead of after. My source files are ac3 not wav, and I wanted to upmix from them, just as a curiosity to see how well it sounds upmixed with this method. It seems that I might as well decode 2ch ac3 to stereo wav and use you method, and compare it with DPLamb/Plogue Bidule method (i.e. DTS-AC3 Forum).

Sorry about making available an incompatible wav header file, I just did it in a hurry, finding the 1st 6-ch, 16 bit multichannel wav in my test files dir and coping the 1st few bytes from the hex editor to a new file. I should have checked to see if the header was compatible with Raw PCM. I've not worked with them as such so I thought just attaching the header to your file would work, I even had the sample rate wrong. Since it was wav extensible I didn't think it should be a problem because Tranzcode can handle it for spliting, the speaker flags didn't occur to me, anyway I'll have to check my latest version to make sure it will outut a correct mulichannel wav (with correct speaker flag values). Actually I remember its not complete since I only had speaker flags up to 6-7 channles but it's suppose to support 18 chans and that was on the TODO list. Guess it doesn't matter now that you've figured it out :)

Cheers.

-AF

bcn_246
6th January 2006, 16:47
Hi Ben,

Thanks for writing this thorough step by step guide for your upmix method. The problems I encountered recently with Graphedit are probably my own fault, or not having the correct filter version installed, for what I'm doing with Graphedit. It's been awhile since I've used it, I followed you method using ffdshow filter (which I think I previously referred to as FooBar.. my bad :( - I never used ffdshow before). I have a problem with it, because when I want to join the filter, ffdshow seems to want to join before CyberLink Audio Effect (PDVD6) instead of after. My source files are ac3 not wav, and I wanted to upmix from them, just as a curiosity to see how well it sounds upmixed with this method. It seems that I might as well decode 2ch ac3 to stereo wav and use you method, and compare it with DPLamb/Plogue Bidule method (i.e. DTS-AC3 Forum).

Sorry about making available an incompatible wav header file, I just did it in a hurry, finding the 1st 6-ch, 16 bit multichannel wav in my test files dir and coping the 1st few bytes from the hex editor to a new file. I should have checked to see if the header was compatible with Raw PCM. I've not worked with them as such so I thought just attaching the header to your file would work, I even had the sample rate wrong. Since it was wav extensible I didn't think it should be a problem because Tranzcode can handle it for spliting, the speaker flags didn't occur to me, anyway I'll have to check my latest version to make sure it will outut a correct mulichannel wav (with correct speaker flag values). Actually I remember its not complete since I only had speaker flags up to 6-7 channles but it's suppose to support 18 chans and that was on the TODO list. Guess it doesn't matter now that you've figured it out :)

Cheers.

-AF
I would definatly demux, using foobar2000 (and no DSP filters turned on). I find it is far better to decode to WAV first becasue you don't allways know what an other AC3 encoder is doing with the file (some alter audio volume etc). With GraphEdit click the remove conections button (below)
http://img352.imageshack.us/img352/6702/step17vi.png
Then drag output>input pin to pin to connect in any order you like.
http://img352.imageshack.us/img352/9577/step25vp.png

Ben