Rockbox Technical Forums

Support and General Use => Audio Playback, Database and Playlists => Topic started by: dar02 on September 30, 2009, 03:20:31 PM

Title: Atrac3 (.rm) codec on iPod 5G
Post by: dar02 on September 30, 2009, 03:20:31 PM
I am glad that you add support for the Atrac3 format. In my opinion it is the best loss music codec. But it is not working well in Rockbox.

I am using version 3.4 of Rockbox on iPod Video 5.5G and I have following problems:
- Sometimes Rockbox is not playing rm atrac3 files and it's showing "Codec failure" message, but after reboot it's playing it again.
- at the end of every song it's showing the "Codec failure" message and because of this it's adding an extra pause before every track, so it's very annoying.
- Rockbox can't read information about title, artist, etc.. from .RA files
- in some parts of songs I can hear quiet clicks that you can't hear while listening on PC.

For coding I am using Real Converter (GUI) and Helix DNA Producer (CLI)
http://daro.tox.pl/rockbox/real_converter.rar
Its wierd that 320kbps file from DNA Producer (codecFlavor 7) is larger than file from Real Converter (it's using the same codec raac.dll)

   Is it possible to add support for Atrac3 format in .oma container? (standard for Sony SonicStage).
I know that .oma format can contain DRM protection but SonicStage is giving you the option to turn the protection off for music encoding, so I think there should be a chance to support unprotected .oma files.
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: mtee on September 30, 2009, 03:37:42 PM
Could you please upload a sample or two that have those issues ?
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: dar02 on September 30, 2009, 04:02:59 PM
OK

http://daro.tox.pl/rockbox/friend_and_foe.zip

03 - Wet and Rusting.rm 3:33 (8 688 KB)
02 - The Pelican.rm 3:39 (8 933 KB)
including file info about: name, category, genre, artist, album, cd track, year and cover art

I added a bad distortion in the middle of every song because I don't want to upload illegal music.

Encoded by DNA Producer (codecFlavor 7) 320kbps

Usually you can get a codec failure if you are jumping between formats - from atrac3 files to others mp3, ogg and go back to atrac and again.
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: saratoga on September 30, 2009, 08:47:39 PM
OK

http://rapidshare.com/files/287054793/friend_and_foe.zip

03 - Wet and Rusting.rm 3:33 (8 688 KB)
02 - The Pelican.rm 3:39 (8 933 KB)
including file info about: name, category, genre, artist, album, cd track, year and cover art

I added a bad distortion in the middle of every song because I don't want to upload illegal music.

Encoded by DNA Producer (codecFlavor 7) 320kbps

Usually you can get a codec failure if you are jumping between formats - from atrac3 files to others mp3, ogg and go back to atrac and again.

FWIW those are not ATRAC3 files.  ATRAC3 cannot be used at such high bitrates.  VLC claims they're actually AAC.  None the less these appear to be valid files and should work in Rockbox and if they don't its probably a bug.

Edit:  Can you describe in more detail how to get an error or artifact using these files?  I've listened to them a few times and haven't heard anything out of place beyond the weird distortion you added. 
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: mtee on October 01, 2009, 09:24:45 PM
.. (it's using the same codec raac.dll) ..

That shows I should have read more carefully .. raac is AAC not ATRAC3, and the files are indeed AAC encoded.
On the other hand, I was able to reproduce the bug about "codec failure", so I'll work on it soon.
Just a note, for future bug reports, please use the task tracker ("Bugs" link in the website navigation menu).
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: mtee on October 02, 2009, 09:24:03 PM
The "codec failure" bug has been fixed. Just checked various rm files an they were good. Code is in SVN.
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: dar02 on October 03, 2009, 04:33:15 AM
I am giving you an example of that clicking in sound:
http://rapidshare.com/files/288058648/wetar_rcrd01.rar [link expired]
http://rapidshare.com/files/288058983/wetar_rcrd02.rar [link expired]

in wetar_rcrd01.wav you can hear it at:
0:12
0:18
0:26-0:32

in wetar_rcrd02.wav you can hear it at:
0:05
0:13
0:18 (...And when you {CLICK!} unravel...)

On oscilloscope it is looking like this (0,012 sec):
(http://daro.tox.pl/rockbox/weavesmall.png)
[enlarge picture] (http://daro.tox.pl/rockbox/weave.png)

I've made these records from my iPod using analog input in my soundcard.
Rockbox is making quiet clicks in random places. I can't hear this problem while listening the same song coded in other audio formats or on emulated rockbox iPod video on PC.

I have a question HOW TO CREATE ATRAC3 .RA FILES???
Right now I am using this: (Real Converter (GUI) and Helix DNA Producer (CLI))
http://rapidshare.com/fil...994826/real_converter.rar
Should I use some other software?
Why "ATRAC3 cannot be used at such high (320kbps) bitrates" when Sony SonicStage is giving you that option:
(http://daro.tox.pl/rockbox/sonicstenc.png)
[enlarge picture] (http://daro.tox.pl/rockbox/sonicstenc.png)

On real.com webpage:
http://service.real.com/help/library/guides/RealProducer10/htmfiles/new.htm (http://service.real.com/help/library/guides/RealProducer10/htmfiles/new.htm)
you can read:
Quote
RealProducer 10 introduces new codecs for stereo music and stereo surround based on AAC encoding technology. These codecs replace older codecs based on ATRAC3 technology. Within the RealProducer graphical user interface, these codecs are designated as "RealAudio 10"."

Stereo music codecs that encode at rates below 96 Kbps are not based on AAC technology. They are backwards- compatible to RealPlayer G2 or RealPlayer 8, depending on the precise codec used. For more information, refer to "5.1 Multichannel Audio Codecs".

As described in "RealAudio 10 Stereo Music Codecs", AAC-based codecs have replaced ATRAC3-based codecs for streaming bit rates above 96 Kbps for stereo and stereo surround music.

So I understand that they are not using the name "Atrac3" in their software but "RealAudio 8".
I am not interested in making such low bitrate files like 96kbps so is the only way to make higer bitrates atrac3 .ra files is to install RealProducer 8?
But there is no place in the net to download it.

P.S.
I've checked the last build r22883-091003 and I don't have the "Codec Failure" problem anymore.
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: mtee on October 03, 2009, 09:42:00 AM
...
Why "ATRAC3 cannot be used at such high (320kbps) bitrates" when Sony SonicStage is giving you that option:
(http://img41.imageshack.us/img41/9448/sonicstenc.gif)
[enlarge picture] (http://img41.imageshack.us/img41/9448/sonicstenc.gif)
...

Basically, atrac3 has 2 modes; LP2 with a bitrate of 132kbps, and LP4 with a bitrate of 66kbps. The selection in your image is for ATRAC Advanced Lossless, which is - as mentioned in the info in the same image - built on atrac3 and atrac3plus.
The only bitrate at which you could encode atrac3, from that list, is 132kbps, that's why this is the only bitrate next to which you could find (ATRAC3).
At all the other bitrates, it's atrac3plus not atrac3.
I don't know how you got AAC this way. But anyway, if you want atrac3, encode the file at 132kbps and see if it makes a difference.

...
P.S.
I've checked the last build r22883-091003 and I don't have the "Codec Failure" problem anymore.

Thanks for the feedback. :)
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: dar02 on October 03, 2009, 11:04:48 AM
this picture:
(http://daro.tox.pl/rockbox/sonicstenc.png)
is from Sony SonicStage (http://support.sony-europe.com/dna/downloads/downloads.aspx?&f=sstage_dl) that can create only .oma files.
I still don't know how to encode to .ra (atrac3).
Any idea?
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: mtee on October 03, 2009, 11:54:12 AM
I have just tried Real Converter and it seems it can't encode in atrac3. Sorry, but I don't really know of a program that enables to encode a file to atrac3.rm, you could try ffmpeg though.
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: saratoga on October 03, 2009, 05:54:52 PM
I still don't know how to encode to .ra (atrac3).
Any idea?

I recommend that you not use ATRAC3.  While the rockbox ATRAC3 decoder works nicely (and I am rather pleased with how well it works), ATRAC is an old format.  Encoding to MP3/Ogg/WMA/AAC is easier and will get better quality results.   
Title: Re: Atrac3 (.rm) codec on iPod 5G
Post by: dar02 on October 03, 2009, 06:47:14 PM
Ok, finally I found a way how to create .ra/.rm atrac3 files.
The ffmpeg is not working. It can't encode to atrac3 but it can decode it or you can change container from native atrac extension .oma to .rm or .wav (ffmpeg -i test.oma -acodec copy test.rm) but after that you can't read those files with anything, so it's not working well.

The only way I found is to use my modified version of Helix DNA(TM) Producer : )
http://daro.tox.pl/rockbox/real_producer.zip
This is a version 11.0.0.2013 with older (6.0.1.1536) version of atrc.dll (the new version is not working correctly). I also removed unnecessary dll files.

With it you can make 66-352kbps Atrac3 .rm files compatible with Rockbox!
This time I am sure that I am encoding to atrac - the VLC said: "Codec: atrc".
In my zip file you can find "Convert2atrac.bat" that include:
producer -i input.wav -ad profile.rpad -dt -o output.rm
instead of input wav format you can use other format, like mp3, wma etc..
In "profile.rpad" you can change properties of the codec by changing line 10:
<codecFlavor type="uint">7</codecFlavor>

codecFlavor represent bitrate:
codecFlavor 0 = 66kbps (LP4)
codecFlavor 1 = 94kbps
codecFlavor 2 = 105kbps (LP2)
codecFlavor 3 = 132kbps (LP2)
codecFlavor 4 = 146kbps
codecFlavor 5 = 176kbps
codecFlavor 6 = 264kbps
codecFlavor 7 = 352kbps

I don't know why, but the encoder is crashing in Flavor 2-5.
I was able to play files in flavor 0, 1, 5, 6, 7 on my iPod (rbox r22903-091003).
I was not able to test flavor 2, 3, 4 because of encoder crashing.
But there is something wrong in sound quality ; /
While VLC is playing files clearly the Rockbox is making wierd noise in sound background.

I've recorded this from my iPod: http://daro.tox.pl/rockbox/ra_output.zip

in flavor0_output.ogg you can hear loud distorsion. (from Flavor 0 = 66kbps .rm)
in flavor7_output.ogg you can hear a quiet distortion in background like from high voltage device (from Flavor 7 = 352kbps .rm)

Also I think that CPU usage is very high, because everything seemed to work slow (like changing volume) while playing that files on my iPod.

Here you've got short .rm test files that I've encoded in flavor 0, 1, 5, 6, 7:
http://daro.tox.pl/rockbox/atrac3ra.zip

Here you can find unmodified versions of Helix DNA Producer: https://helix-producer.helixcommunity.org/Downloads