Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th February 2005, 02:22   #21  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
@Paulcat
IF your 6 mono wav have exactly the same size in bytes and the same header (in Winhex, all the bytes until "data" and the next four) THEN
is a problem in SoftEncode
ELSE
I need more data to help you: exactly size and header of your 6 mono wav and your wav6, logs of your process faad, BeSplit or BeSweet, ...
ENDIF

OR try with Foobar2000 like I say to Sakuya

@Sakuya
If foobar convert the aac (6 channel) to a 2 channel wav maybe you have activate any DSP function like "Convert 5.1 to stereo" or "Simple surround"
Then, before "Convert->Run conversion", you must "Convert->Settings...->Processing->Unmark "Use DSP""

Another program to change 44100 Hz to 48000 Hz is ssrc-1.29 (free, http://shibatch.sourceforge.net/) directly in the 6ch WAV PCM with:
ssrc --rate 48000 wav6_PCM_44.wav wav6_PCM_48.wav

Now your steps:
1. AAC > 6ch WAV using FAAD2 (and Audioformat to PCM) or use Foobar2000
2. 6ch WAV 44100 Hz > 6ch WAV 48000 Hz using ssrc (need Audioformat PCM)
3. 6ch WAV 48000 Hz > AC3 using Soft Encode (realign the channels like say Paulcat)

All re-encode messes up any sound quality, the sound directionality is in your hands.
tebasuna51 is offline   Reply With Quote
Old 28th February 2005, 03:38   #22  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
Sorry, I got mixed up! Foobar2000 did fine in creating the WAV (whether or not it is 6ch I don't know since there is no way to check). What is Audioformat to PCM? How do I do that with Foobar or FAAD2? Does it mess up the 6ch sound?

SSRC is pretty slow. It gives me some notes on what it's doing and I noticed this peculiar line:

nchannels: 8

Since when did I have 8 channels? Okay, it finished and after 100%, it gives me this error:

ssrc --
unrecognized option : --
st48000

The WAV works though. When I tried to open it in Soft Encode, it said it has more than 6 channels and cannot open it. Is this the reason why I've lost the gunfire sounds from before? Because there are actually 8 channels? AAC sucks.

I did a search and it seems that foobar decodes AAC 6ch to 8ch WAV. Read the comments here:
http://www.hydrogenaudio.org/forums/...hp/t30602.html

So should I stick with FAAD2?

Last edited by Sakuya; 28th February 2005 at 04:15.
Sakuya is offline   Reply With Quote
Old 28th February 2005, 14:16   #23  |  Link
Paulcat
Registered User
 
Join Date: Jan 2005
Location: Great White North
Posts: 326
It Works

(1) I used mkvextract to extract to an 6channel.aac file
(2) I used FAAD2 to convert to aac file to 6channel.wav
(3) I used besplit to get 6 mono wav files
(4) Used WinHex to alter the $20 byte from 06 to 02.
(5) Loaded the 6 files in the order of 1,3,2,5,6,4 into softencode and produced an ac3 file that plays fine.

My mistake was in WinHex, I changed the 06 to 01 last time instead of 02, Doh!

SAKUYA, when you select 48000 in the encode option of softencode, DO NOT check the AUTO option. Auto will read the value from the first wav file and reset itself (likely 44100).

I was having an issue with the aac file...inside the MKV, it played fine, but when I tried to play just the aac audio after extraction, it wouldn't play, although the 6channel wav file did! Odd...
Paulcat is offline   Reply With Quote
Old 1st March 2005, 03:55   #24  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
Thanks for telling me that. Paulcat, were you successful in removing that click? How did you get Winhex to work since I'm sure your AAC file was above 200KB? Or did you buy the program already? Are there any other ways for me to remove the click? I tried foobar but as I said, it makes an 8ch WAV.
Sakuya is offline   Reply With Quote
Old 1st March 2005, 14:22   #25  |  Link
Paulcat
Registered User
 
Join Date: Jan 2005
Location: Great White North
Posts: 326
Yes the clicking sound disappeared. I didn't use the scripts in WinHex, I just opened the file, changed the byte, and re-saved it. The individual wav files were just under 200K, why? Is there a limit in filesize with the trial version?
Paulcat is offline   Reply With Quote
Old 1st March 2005, 20:30   #26  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
In WinHex, where do I find the $20 byte? Is that the same as Offset 00000020?

Last edited by Sakuya; 6th March 2005 at 22:30.
Sakuya is offline   Reply With Quote
Old 6th March 2005, 22:31   #27  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
Can anybody help me with this? Just one more little step...
Sakuya is offline   Reply With Quote
Old 7th March 2005, 14:07   #28  |  Link
Paulcat
Registered User
 
Join Date: Jan 2005
Location: Great White North
Posts: 326
The offset and the $20 byte is the same, when I open a file it's the first byte in the third row. Or, since $20 HEX is the same as 32 in decimal, it's the 32nd byte...
Paulcat is offline   Reply With Quote
Old 7th March 2005, 20:57   #29  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
Thanks. I used Hexedit because WinHex trial wouldn't let me save. In Offset 00000020, I changed the first number in that row from 06 to 02. Then I saved it as a new WAV. But when I tried to open it in Soft Encode as a PCM WAV, it told me it cannot because it is compressed data.

When I loaded all of them into Soft Encode as raw data and then played all the channels at the same time, there is still a "click" in the beginning.

I'm guessing I didn't do this part mentioned by tebasuna. How do I do this?

Quote:
Make a header WAVE_FORMAT_EXTENSIBLE with AudioFormat 0xFFFE ?, this must be changed to AudioFormat PCM 0x0001

Last edited by Sakuya; 7th March 2005 at 21:05.
Sakuya is offline   Reply With Quote
Old 7th March 2005, 21:11   #30  |  Link
Paulcat
Registered User
 
Join Date: Jan 2005
Location: Great White North
Posts: 326
Did you change the $20 byte on all six mono wav files? (not the multichannel wav)
Paulcat is offline   Reply With Quote
Old 7th March 2005, 22:02   #31  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
Yes I did. In Hexedit, when I tried to highlight the 6 in 06, it only let me highlight the 0 before the 6. So I had to type in "02". Is that okay?

I still think it's the overflow thing with the header that tebasuna mentioned because I didn't do that part.
Sakuya is offline   Reply With Quote
Old 8th March 2005, 03:31   #32  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
I hope this info help you to verify yours wav.
This is the correct canonic header of a mono wav 16 bits 48 KHz

Offset
_____
De He Value
__ __ _____
00 00 RIFF (fix literal, 4 bytes) Chunk "RIFF"
04 04 xx xx xx xx (integer, 4 bytes, max. 4 GB) Length of file - 8
08 08 WAVE (fix literal, 4 bytes)
12 0C fmt (fix literal, 4 bytes) Subchunk "fmt "
16 10 10 00 00 00 (integer, 4 bytes) Length of Subchunk fmt - 8 (16)
20 14 01 00 (integer, 2 bytes) AudioFormat (1 = PCM)
22 16 01 00 (integer, 2 bytes) NumChannels (mono)
24 18 80 BB 00 00 (integer, 4 bytes) SampleRate (48000)
28 1C 00 77 01 00 (integer, 4 bytes) ByteRate (96000)
32 20 02 00 (integer, 2 bytes) BlockAlign (2)
34 22 10 00 (integer, 2 bytes) BitsPerSample (16)
36 24 data (fix literal, 4 bytes) Subchunk "data"
40 28 Length of Subchunk data - 8 (integer, 4 bytes)
44 2C sound data ...

Always:
BlockAlign = NumChannels x BitsPerSample / 8
ByteRate = SampleRate x BlockAlign

Integer values with the lower byte first, then:
44 AC 00 00 = 44100 dec = 0000AC44 hex

There are another format well recognized, the float 32 bits with:
AudioFormat = 3 and BitsPerSample = 32 (float)

In the header WAVE_FORMAT_EXTENSIBLE there are more fields (than canonic) in the Subchunk fmt just before the Subchunk data, then:
Length of Subchunk fmt > 24
Offset of Subchunk data = 12 + Length of Subchunk fmt

Soft Encode can read canonic or WAVE_FORMAT_EXTENSIBLE headers if the AudioFormat is 1 or 3, and if all the values are correct (BlokAlign = 2 in a mono 16 bits, file < 4 GB, etc.)
With others values of Audioformat or any field error it read in RAW mode and convert the incorrect header in sound (click).
tebasuna51 is offline   Reply With Quote
Old 8th March 2005, 03:57   #33  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
I am terribly confused. I cannot discern which part of the codes in my mono WAV file is part of the header and which parts I need to edit. The layout in Hexedit or WinHex does not resemble what you've put down. Can you please put it in simpler terms, step-by-step for Hexedit? Sorry for being such a bother!
Sakuya is offline   Reply With Quote
Old 8th March 2005, 20:48   #34  |  Link
])r. Mario
Registered User
 
Join Date: Feb 2005
Posts: 10
hello
im also trying to go form aac 5.1 to ac3 5.1
ive used nero to go from aac to a 6 channel wav, then besplit to make 6 mono files. i have soft encode but it doesnt seem to work.
when i encode it it only does the first 7 minutes
are there other progs out there that can take 6 wavs and make an ac3 file? or is there something im doing wrong in soft encode?
any help would be greatly appreciated.


p.s. i thought something might be wrong with my wav files, so i looked into your method of makeing the 6 hannel wav. how do u do that using faad2? i think i downloaded it, but there isnt an .exe anywhere, i cant seem to find anything online either on how to use it
])r. Mario is offline   Reply With Quote
Old 8th March 2005, 21:09   #35  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
First I want to explain the wav header with the Winhex tools.
Winhex layout of a 48 KHz mono PCM canonical wav:

Of|_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F| Literal
___________________________________________________________________
00|52 49 46 46 Xx xx xx xx 57 41 56 45 66 6D 74 20|RIFF....WAVEfmt
10|10 00 00 00 01 00 01 00 80 BB 00 00 00 77 01 00|................
20|02 00 10 00 64 61 74 61 Yy yy yy yy Ss ss Ss ss|....data........

The bytes must be grouped in fields in order to understand the meaning. Here I identify the fields by order and by name. Example: [10] BlockAlign. Disregard the "_", is only for align.

First line:
[01] First 4 bytes: ChunkID______ (literal, 4 bytes) Chunk "RIFF"
[02] Next_ 4 bytes: ChunkSize____ (integer, 4 bytes)
[03] Next_ 4 bytes: Format_______ (literal, 4 bytes) Format "WAVE"
[04] Next_ 4 bytes: Subchunk1ID__ (literal, 4 bytes) Subchunk "fmt "
Second line:
[05] First 4 bytes: Subchunk1Size (integer, 4 bytes)
[06] Next_ 2 bytes: AudioFormat__ (integer, 2 bytes)
[07] Next_ 2 bytes: NumChannels__ (integer, 2 bytes)
[08] Next_ 4 bytes: SampleRate___ (integer, 4 bytes)
[09] Next_ 4 bytes: ByteRate_____ (integer, 4 bytes)
Third line:
[10] First 2 bytes: BlockAlign___ (integer, 2 bytes)
[11] Next_ 2 bytes: BitsPerSample (integer, 2 bytes)
[12] Next_ 4 bytes: Subchunk2ID__ (literal, 4 bytes) Subchunk "data"
[13] Next_ 4 bytes: Subchunk2Size (integer, 4 bytes)
[14] Next_ 2 bytes: First_ sound sample (signed integer, 2 bytes)
[15] Next_ 2 bytes: Second sound sample ...

When I say "literal" you can see the value in column literal.
When I say "integer, 4 bytes" you can see the decimal value in the small window Data Interpreter in the line 32 Bit (+)
When I say "integer, 2 bytes" you can see the decimal value in the small window Data Interpreter in the line 16 Bit (+)
When I say "signed integer, 2 bytes" you can see the decimal value in the small window Data Interpreter in the line 16 Bit (ñ)
When I say "Offset" (position of the actual byte in the file, beginning by 0, in hexadecimal) you can see the value in the Status line.

Now the explanation of all fields (group of bytes):
(You can see also http://ccrma.stanford.edu/courses/42...ts/WaveFormat/)

[01] ChunkID = "RIFF"
Identify the file like Resource Interchange File Format

[02] ChunkSize = File length - 8 (Xx xx xx xx in the example)
All size fields contains the value of the REST of data. At this moment we are read 8 bytes (ChunkID + ChunkSize) in the file.
This field have 4 bytes, then the max value is FFFFFFFF hex = 4294967295 dec = 4 GB
Check this value (cursor in Offset 04, value in Data Interpreter) with the value in Menu File->Properties->Size in bytes (-8)
If this values don't match, you have a corrupt wav. And the 6 mono wav must have the same File length

[03] Format = "WAVE"
Identify the file like Waveform data (.WAV). The "WAVE" format consists of two subchunks: "fmt " and "data".
The "RIFF" chunk can have other formats more complex, like "AVI " Audio/visual interleaved data (.AVI).

[04] Subchunk1ID = "fmt "
The "fmt " subchunk describes the sound data's format.

[05] Subchunk1Size = 16
If this value is greater than 16, we have a header WAVE_FORMAT_EXTENSIBLE (not canonical) with more fields in the "fmt " subchunk.
Not problem if Offset of Subchunk data = 20 (dec, 14 hex) + Subchunk1Size

[06] AudioFormat = 1
This is the normal PCM format with BitsPerSample = 16 (signed integer, 2 bytes) for channel.
There are another format well recognized, the float 32 bits with AudioFormat = 3 and BitsPerSample = 32 (float, 4 bytes). It is more accurate but with twice file size.
If the Audioformat is 65534 dec = FFFE hex, like output of faad, you have a problem. You must change to 1, like the example.

[07] NumChannels = 1
Self-explanatory 1 for mono, 2 for stereo, 6 for surround 5.1.

[08] SampleRate = 48000
If you have 44100 and need one ac3 for DVD you must resample the wav to 48000.

[09] ByteRate = 96000
Always must be: ByteRate = SampleRate x NumChannels x BitsPerSample / 8

[10] BlockAlign = 2
Always must be: BlockAlign = NumChannels x BitsPerSample / 8
A bug in BeSplit fix this value to 6. You must change this value to 2 (like example).

[11] BitsPerSample = 16
If Audioformat = 1 this value must be always 16.

[12] Subchunk2ID = "data"
The "data" subchunk contains the size of the data and the actual sound

[13] Subchunk2Size = (Yy yy yy yy in the example)
The size of the data sound.
In this case must be = File length - Subchunk1Size - 28

[14] First sound sample = (Ss ss in the example)
In format signed integer, 2 bytes
In a stereo waw, the first sound sample of the Left channel

[15] Second sound sample ...
In a stereo waw, the first sound sample of the Right channel, ...

-----------------------------------------------
Now in simpler terms, step-by-step for Hexedit.
1) Open a 6 channel wav 48 KHz generated by faad. Look like this:

00|52 49 46 46 Xx xx xx xx 57 41 56 45 66 6d 74 20|RIFF....WAVEfmt
10|28 00 00 00 fe ff 06 00 80 bb 00 00 00 ca 08 00|................
20|0c 00 10 00 ... |....

First and third lines Ok. Modify at 14 and 15 (hex) like this

10|28 00 00 00 01 00 06 00 80 bb 00 00 00 ca 08 00|................

Save the file

If the wav is 44.1 KHs offsets 18 to 1F are different but not problem.

2) Use BeSplit to generate the 6 mono wav and open each of them in Hexedit:

00|52 49 46 46 Xx xx xx xx 57 41 56 45 66 6d 74 20|RIFF....WAVEfmt
10|28 00 00 00 01 00 01 00 80 bb 00 00 00 77 01 00|................
20|06 00 10 00 ... |....

Modify the third line like this

20|02 00 10 00 ... |....

Save the files

3) If you need to convert 44.1 to 48 KHz run ssrc for each wav.

4) Open the files, in correct order, in Soft Encode.
tebasuna51 is offline   Reply With Quote
Old 8th March 2005, 21:17   #36  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
@])r. Mario

For any question over aac 5.1 to ac3 5.1 put Samplerate and minutes of the aac, and filesize of the 6 channel wav.
tebasuna51 is offline   Reply With Quote
Old 9th March 2005, 05:24   #37  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
@Tebasuna:

Thanks for writing all that for me, it was very helpful! I followed your Hexedit guide using a 44100Hz 6-channel WAV file. I made the changes but the 6-channel WAV after that was sped up. The original length was 25 minutes and 1 second. After processing in Hexedit, it became 22 minutes and 59 seconds. I'm thinking of converting to 48000Hz using Soft Encode when I'm making my AC3. So what do I change for a 44100Hz 6-channel WAV?
Sakuya is offline   Reply With Quote
Old 9th March 2005, 13:57   #38  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
@Sakuya

I don't understand this change in lenght.
What program say you this lengths of wav6?
Can you send me the wav6 header?
(In Hexedit mark from first byte to the four next to "data", then Copy (Ctrl+C) and Paste (Ctrl+V) in the post reply)

This is a wav 6 channels 44.1 KHz faad generated

00|52 49 46 46 3c a0 a1 00 57 41 56 45 66 6d 74 20|RIFF....WAVEfmt
10|28 00 00 00 fe ff 06 00 44 ac 00 00 30 13 08 00|................
20|0c 00 10 00 16 00 10 00 3f 00 00 00 01 00 00 00|................
30|00 00 10 00 80 00 00 aa 00 38 9b 71 64 61 74 61|............data
40|00 a0 a1 00 ... |....

Duration in seconds = Subchunk2Size / ByteRate
Where:
Subchunk2Size (offset 40 hex, 4 inverse order bytes) = 00a1a000 = 10592256
ByteRate (offset 1C hex, 4 inverse order bytes) = 00081330 = 529200
Duration in seconds = 10592256 / 529200 = 20.0156
tebasuna51 is offline   Reply With Quote
Old 9th March 2005, 21:49   #39  |  Link
])r. Mario
Registered User
 
Join Date: Feb 2005
Posts: 10
wow thx for fast response

ok the .aac file is 22:50 long
sample rate is 44100 Hz
after conversion 6 channel wave comes out as ~708 MB
split the 6 mono files are about 118 MB
])r. Mario is offline   Reply With Quote
Old 10th March 2005, 03:33   #40  |  Link
Sakuya
Registered User
 
Sakuya's Avatar
 
Join Date: Dec 2002
Posts: 218
My 6ch 44100Hz WAV header in Hexedit is a bit different from the one that you put in your post above:

00|52 49 46 46 3c 00 5b 2f 57 41 56 45 66 6d 74 20|RIFF<.[/WAVEfmt
10|28 00 00 00 fe ff 06 00 44 ac 00 00 30 13 08 00|(.......D...0...
20|0c 00 10 00 16 00 10 00 3f 00 00 00 01 00 00 00|........?.......
30|00 00 10 00 80 00 00 aa 00 38 9b 71 64 61 74 61|.........8.qdata

The dots to the very right are copied exactly as it is seen in Hexedit. I used FAAD2 to convert my 6ch HE-AAC to 6ch WAV. This is the code I used in FAAD2:

faad.exe -o output.wav input.aac

Last edited by Sakuya; 10th March 2005 at 03:40.
Sakuya is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.