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 10th June 2021, 04:50   #1  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
ATRAC3Plus .WAV files: how to unbork them

As everybody already knows, since Sony released the command-line .EXEs at3tool and PS3at3tool ages ago,
it's possible for anyone to convert 16-bit 44.1 & 48 kHz PCM audio to .WAV-wrapped atrac3plus streams.
The problem is, such .WAV files contain an irregular FACT chunk, which "confuses" the normal AVI muxers and makes these generate broken .AVI files.
So those borked .WAV files must be fixed through a hex editor.

In a "normal" 44.1 kHz at3+ WAV, the dwSampleLength field is 8 bytes long and the cksize field says "08 00 00 00".
In a "normal" 48 kHz at3+ WAV, the dwSampleLength field is 12 bytes long and the cksize field says "0C 00 00 00".
So all one has to do is
1) delete the last 4 or 8 bytes between the actual dwSampleLength value and the data chunk
&&
2) overwrite "08" or "0C" with "04" in the cksize field.

Then the fixed at3+ .WAV file is processed normally by VirtualDub
— but not by AVI-Mux GUI nor by ffmpeg

NOTICE: the resulting .AVI files are demuxed correctly by LAV Splitter, Microsoft AVI Splitter, MPlayer and MPV,
but not by the current internal AVI splitter of MPC-BE (1.5.7.6180) :-/

sample file: https://www.mediafire.com/file/zntw0...0x720.avi/file

Last edited by filler56789; 10th June 2021 at 06:50. Reason: update
filler56789 is offline   Reply With Quote
Old 10th June 2021, 09:25   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
I'm not sure if your sample avi have the problematic atrac3p track or the already edited and correct track.

ffmpeg inform of the .avi file:

Quote:
0: mpeg4 (DX50 / 0x30355844), yuv420p, 960x720 [SAR 1:1 DAR 4:3], 4302 kb/s, 29 .97 fps, ...
1: atrac3p, 44100 Hz, stereo, fltp, 192 kb/s
I used VirtualDub2 to Save audio... like wav, and I obtained a correct wav like this:
Code:
File ........: C:\tmp\0136MF-intro-interview-960x720.wav
Size ........:  75916208 bytes

---------------------------------------------- Header Info
ChunkID .....: RIFF
RiffLength ..:  75916200
Container ...:  WAVE
SubchunkID ..: fmt  (Length: 40)
AudioFormat .:  65534 (WAVE_FORMAT_EXTENSIBLE)
NumChannels .:  2
SampleRate ..:  44100
ByteRate ....:  352800
BlockAlign ..:  8
BitsPerSample:  32
ValidBitsPS .:  32
MaskChannels :  3 (FL FR)
SubType .....:  3 (Float)
SubchunkID ..: JUNK (Length: 52)
SubchunkID ..: data (Length: 75916080)
Offset data .:  128
Duration ....:  215.18163 sec., (0h. 3m. 35.18163s.)
------------------------------------------------- End Info
Have a extra chunk 'JUNK' (filled with '0'), but must be ignored for any correct soft, and the rest of data is all OK.

The .wav play without problems in mpc-hc, vlc, foobar2000, Audacity and GoldWave

Can you upload the problematic track?
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 10th June 2021 at 09:38.
tebasuna51 is offline   Reply With Quote
Old 10th June 2021, 11:59   #3  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
tebasuna, With what program do you get the information of the audio track?
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 10th June 2021, 12:25   #4  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
My LeeAudBi
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 10th June 2021, 13:16   #5  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Thanks, I can't downloading it, says in Sendspace "Failed to fetch data, please retry". By the way, is it 64 bit only?
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 10th June 2021, 15:47   #6  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
Quote:
Originally Posted by tebasuna51 View Post
I'm not sure if your sample avi have the problematic atrac3p track or the already edited and correct track.
This .AVI has the "fixed" one.
To make things clearer: the atrac3+ stream itself was not modified at all,
what I had to change is its .WAV header
— otherwise VirtualDub would generate an unplayable .AVI file :-/

Whereas both AVI-Mux GUI and ffmpeg always fail at muxing,
regardless of how correct is the .WAV header of the .at3+ track.

Quote:
Can you upload the problematic track?
I'll send you a private message, because that's not exactly the point.

Last edited by filler56789; 10th June 2021 at 18:10. Reason: more clarity
filler56789 is offline   Reply With Quote
Old 10th June 2021, 18:05   #7  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
Quote:
Originally Posted by tebasuna51 View Post
Can you upload the problematic track?
Hopefully this image will be more useful than another "sample file"...
for the time being, at least.

filler56789 is offline   Reply With Quote
Old 11th June 2021, 00:31   #8  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by GMJCZP View Post
Thanks, I can't downloading it, says in Sendspace "Failed to fetch data, please retry". By the way, is it 64 bit only?
This is a 32 bit version in Mediafire: https://www.mediafire.com/file/qllhq...Bi6_32.7z/file
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 11th June 2021, 01:06   #9  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Quote:
Originally Posted by filler56789 View Post
This .AVI has the "fixed" one.
To make things clearer: the atrac3+ stream itself was not modified at all,
what I had to change is its .WAV header...
Ok, thanks, I understand. The wav I checked before was the decoded atrac2p (the modified) by VirtualDub2

The created by the at3tool is:

Code:
File ........: C:\tmp\Test\at3\file2.wav
Size ........:  3448536 bytes

---------------------------------------------- Header Info
ChunkID .....: RIFF
RiffLength ..:  3448528
Container ...:  WAVE
SubchunkID ..: fmt  (Length: 52)
AudioFormat .:  65534 (WAVE_FORMAT_EXTENSIBLE)
NumChannels .:  2
SampleRate ..:  44100
ByteRate ....:  16021
BlockAlign ..:  744
BitsPerSample:  0 (WARNING: must be 8 multiple to verify BlockAlign)
ValidBitsPS .:  2048
MaskChannels :  3 (FL FR)
SubType .....:  43711 (Search in MMREG.H)
SubchunkID ..: fact (Length: 8)
SampleLength :  9489510 (fact Duration: 215.18163 sec.)
SubchunkID ..: data (Length: 3448440)
Offset data .:  96
Duration ....:  215.24499 sec., (0h. 3m. 35.24499s.)
------------------------------------------------- End Info
And have the big 'fact' chunk (Length: 8, when must be 4)
Quote:
00000000 52 49 46 46 D0 9E 34 00 57 41 56 45 66 6D 74 20 34 00 00 00 FE FF 02 00 RIFFÐz4.WAVEfmt 4...þÿ..
00000018 44 AC 00 00 95 3E 00 00 E8 02 00 00 22 00 00 08 03 00 00 00 BF AA 23 E9 D¬..>..è...".......¿ª#é
00000030 58 CB 71 44 A1 19 FF FA 01 E4 CE 62 01 00 28 5C 00 00 00 00 00 00 00 00 XËqD¡.ÿú.äÎb..(\........
00000048 66 61 63 74 08 00 00 00 66 CC 90 00 00 08 00 00 64 61 74 61 78 9E 34 00 fact....fÌ_.....dataxz4.
The 08, in this 44100 Hz sample, must be changed to 4, and the 00 08 00 00 bytes deleted.

But maybe the RiffLength ..: 3448528 D0 9E 34 00 must also to be modified to 3448524 -> CC 9E 34 00
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 11th June 2021, 03:17   #10  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Quote:
Originally Posted by tebasuna51 View Post
This is a 32 bit version in Mediafire: https://www.mediafire.com/file/qllhq...Bi6_32.7z/file
Thanks tebasuna, I suggest that both versions are available on the same server, and that if possible they can be found by your signature, added to BeHappy.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 11th June 2021, 03:51   #11  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
Quote:
Originally Posted by tebasuna51 View Post
But maybe the RiffLength ..: 3448528 D0 9E 34 00 must also to be modified to 3448524 -> CC 9E 34 00
You are correct.
filler56789 is offline   Reply With Quote
Old 13th June 2021, 22:31   #12  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
Quote:
Originally Posted by GMJCZP View Post
Thanks tebasuna, I suggest that both versions are available on the same server, and that if possible they can be found by your signature, added to BeHappy.
But while he doesn't do that...

LeeAudBi6, both 32-bit and 64-bit .EXEs + source-code.

https://www.mediafire.com/file/92jhv...udBi6.rar/file

Last edited by filler56789; 13th June 2021 at 22:35. Reason: more info
filler56789 is offline   Reply With Quote
Old 14th June 2021, 00:14   #13  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Quote:
Originally Posted by filler56789 View Post
But while he doesn't do that...

LeeAudBi6, both 32-bit and 64-bit .EXEs + source-code.

https://www.mediafire.com/file/92jhv...udBi6.rar/file
Thank you very much.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Reply

Tags
atrac, atrac3, atrac3plus, leeaudbi, leeaudbi6

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 12:58.


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