Jump to content
Gabriella Katona

LOAS/LATM -> ADTS Conversion

Recommended Posts

Gabriella Katona

Hello!

 

Since I cannot find a better way (except PM) to reach Griga I post here:

 

I'm trying to write a simple command line tool that converts LOAS/LATM packeted AAC into ADTS packeted AAC.

 

The idea is simple: read each raw frame from LOAS/LATM (ReadLATMPacket) and write each frame with ADTS header. I've used your UParser.pas extended with some code. (I've attached my code).

Since the ADTS header is ok lot of tools can recognize the file but nothing can play it. :wacko: Even neroAacDec tells me data incomplete. Probably I miss something.

Do you have any idea?

 

regards,

NA

 

ps. LOAS/LATM sample was extracted with DGAVCDec from a TS capture (DVBViewer) - ts can be played with DVBViewer fine

LOAS_LATM_to_ADTS.zip

Share this post


Link to post
Griga

I've tested your tool with one of my Norwegian AAC samples. The output couldn't be played. Libfaad2 doesn't accept it. A debugging session revealed that initializing the library fails. So I've examined the ADTS headers a bit closer in a hex editor. That's what I've found out:

 

In TAACParser.WriteADTSHeader your tool sets AudioObjectType as AAC profile

 

   bsr.SetBits(config[0].AudioObjectType, 2);		// AAC profile

 

yielding 2 in this case (AFAIK = AAC SSR Scalable Sample Rate profile in ADTS headers), and I think that's not correct - AudioObjectType read from LATM headers is a 5 bit value, and it doesn't seem to be identical with the AAC profile in ADTS headers.

 

However, when I simply set the profile bits to 0 (AAC main profile) or 1 (AAC LC low complexity profile) in your code, TSPlayer & libfaad2 wrapper as decoder are playing the output of your tool quite happily.

 

BTW: Rather use the 1.1.3 parser source code, since it additionally covers explicit SBR signaling (AudioObjectType = 5, e.g. used by Brazilian DVB-T).

Share this post


Link to post
Gabriella Katona

Ok. Now tool is ready and working fine. (Also made a ADTS to RAW and LOAS/LATM to RAW converter)

I think it interest lot of people should I post it somewhere here or it is totally off-topic? If yes where should I since it is not a plugin/mod.

Share this post


Link to post
Griga

Well, I think this sub-forum is the best place for this discussion. Feel free to attach your code and/or binary here.

Share this post


Link to post
Gabriella Katona

Hello!

 

I've attached my simple command line AAC Tools (lossless converters). Contents of the zip file:

 

AAC_Tools_NA_source.7z: source code of the binaries (Delphi 2009 but I think will work with even Delphi7)

LOAS_LATM_to_ADTS.exe: LOAS/LATM packeted AAC to ADTS packeted AAC conversion

ADTS_to_RAW.exe: ADTS packeted AAC to RAW AAC conversion

LOAS_LATM_to_RAW.exe: LOAS/LATM packeted AAC to RAW AAC conversion

 

verison is 0.1 so error handling is minimal (almost nothing) so be sure what you're doing :wacko:

AAC_Tools_NA_0.1.zip

Share this post


Link to post
frnando

Hi, Gabriella!

 

I'd tried to convert an LOAS/LATM AAC stream (Brazilian HDTV), but I allways get an error on line #771 on UParser module (It gets streamindex=14 at first read).

 

My aac file I got thru DGAVCDec.

 

I'm serching for more info on LATM encapsulating, but unsuccessfull until now.

 

Any news on the code?

 

Best Regards.

 

Fernando

Edited by frnando

Share this post


Link to post
GuSTaVauM

Does this tool still a thing?

I never managed to get it work with my recordings :(

The attached file is the error I'm getting

cmd_2018-01-03_08-51-59.png

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×