Jump to content
IGNORED

Failed AAC_HE_V2 experiment (undetected by itunes on import)


Recommended Posts

Greetings, 

 

I recently decided that Id like to assay the high efficiency features of AAC. This included a transcode of my 750GB flac library using ffmpeg (which I was unable to get to produce tracks which enabled the spectrum band replication and parametric stereo features, confirmed in VLC.) I had to use fdk-aac-enc and was able to confirm that the tracks it produced used the SBR and PS modules however itunes still would not detect these files when attempting to import them into itunes. 

 

The options I used with fdk-aac-enc were: 

-t29 -a -r64000 -s -1 -v 5 

 

all tracks were decoded from flac to wav and downsampled to 48khz or maintained to their lesser equivalent before being encoded.

 

I also tried using CBR (dropped -v 5) and maintained the default 64k bitrate and no joy.

 

This is contrary to apples claim that itunes supports aac he v2 as well as iphone. Now I cant find any options to he v2 in itunes and I see also options for bitrates higher than 64k when high efficiency is checked so i wonder if maybe they just dont support v2? The only other thing i can think of is that this is a problem specific to iTunes on Windows; no mac to test from. Any thoughts?

 

Edit: the resulting collection came out to roughly 64GB and from what I can sample from listening in vlc on my laptop it wasnt too bad (havent tried on my krks yet.) But the space efficency was very pleasing and would allow me to store my entire collection on my iphone if it were supported. I reccomend using the fdk-aac-enc to encode if not just itunes if you want to experiment. If you do use itunes please check that the AOT is in fact aac_he_2 and that its using (SBR as well as PS) by some means (mediainfo probably tells you if you have it installed.) VLC does as well. Theres a bitmask / field in the binary header of the file that indicates whether or not they were used by the encoder.

Link to comment

Wikipedia says:

 

iTunes 9.2 and iOS 4 include full decoding of HE-AAC v2 parametric stereo streams.

  • iTunes 9 thru 9.1, iPhone OS 3.1 and Fall 2009 iPods have support for HE-AAC playback for version 1 with no parametric stereo.
  • Older versions of Apple iTunes, iPod Touch, and iPhone will play HE-AAC files at reduced fidelity because they ignore the spectral-band replication and parametric stereo information, instead playing them as though they were standard AAC-LC files without the high-frequency, or "treble," information that is only present in the SBR part of the signal.[citation needed] These will report the track length as twice its actual length.[citation needed]

 

Maybe there's just something wrong with the files that ffmpeg is creating. 

I write about Macs, music, and more at Kirkville.

Author of Take Control of macOS Media Apps

Co-host of The Next Track podcast.

Link to comment
4 minutes ago, kirkmc said:

Wikipedia says:

 

iTunes 9.2 and iOS 4 include full decoding of HE-AAC v2 parametric stereo streams.

  • iTunes 9 thru 9.1, iPhone OS 3.1 and Fall 2009 iPods have support for HE-AAC playback for version 1 with no parametric stereo.
  • Older versions of Apple iTunes, iPod Touch, and iPhone will play HE-AAC files at reduced fidelity because they ignore the spectral-band replication and parametric stereo information, instead playing them as though they were standard AAC-LC files without the high-frequency, or "treble," information that is only present in the SBR part of the signal.[citation needed] These will report the track length as twice its actual length.[citation needed]

 

Maybe there's just something wrong with the files that ffmpeg is creating. 

 

Yep thats what i gathered also. Im running itunes 12.9.1.4. It doesn’t say anything about whether or not it is still supported but I cant imagine why it wouldn’t be. Theres options for it itunes import settings (but none are specific to which version of aac_he.) Perhaps its a problem with libfdk. Ffmpeg and fdk-aac-enc both use libfdk. It would be nice if I could get some error reporting or something from itunes, the failure mode im observing is that the m4a files it scans and apparently processes never show up in my library and no errors are reported, not really sure what to think of that except try to encode some aac_he_v2 with itunes and see how what it produces is different from what is produced by libfdk.

Link to comment

Interesting ^_^

 

So I converted a file from flac to alac with ffmpeg then used itunes to convert it to aac given the settings provided in the screenshots (attached.) It does indeed produce an AAC_HE file with SBR, but no parametric stereo (see attached screenshot. )

 

I think this is actually what you would consider v1 AAC_HE, because:

 

erratic@LAPTOP: /mnt/c/Users/erratic.NETCRAVECOMMUNI/Music/iTunes/iTunes Media/Music/1000 Homo DJs/Supernaut $ mediainfo 01\ Supernaut\ 2.m4a
General
Complete name                            : 01 Supernaut 2.m4a
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (M4A /mp42/isom)
File size                                : 3.18 MiB
Duration                                 : 6 min 42 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 66.3 kb/s
Album                                    : Supernaut
Track name                               : Supernaut
Track name/Position                      : 1
Performer                                : 1000 Homo DJs
Genre                                    : Industrial
Recorded date                            : 1990
Encoded date                             : UTC 2018-11-26 03:17:59
Tagged date                              : UTC 2018-11-26 03:18:38
Writing application                      : iTunes 12.9.1.4
Encoding Params                          : (Binary)

Audio
ID                                       : 1
Format                                   : AAC LC SBR
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name                          : HE-AAC
Format settings                          : Explicit
Codec ID                                 : mp4a-40-2
Duration                                 : 6 min 42 s
Bit rate mode                            : Variable
Bit rate                                 : 64.0 kb/s
Maximum bit rate                         : 104 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 21.533 FPS (2048 SPF)
Compression mode                         : Lossy
Stream size                              : 3.14 MiB (99%)
Encoded date                             : UTC 2018-11-26 03:17:59
Tagged date                              : UTC 2018-11-26 03:18:38

 

 

fdk-aac-enc will produce:

 

erratic@LAPTOP: /mnt/c/Users/erratic.NETCRAVECOMMUNI/Desktop $ mediainfo 01\ -\ Supernaut.flac.m4a                                      [3:42:36]
General
Complete name                            : 01 - Supernaut.flac.m4a
Format                                   : ADTS
Format/Info                              : Audio Data Transport Stream
File size                                : 3.08 MiB
Overall bit rate mode                    : Variable
FileExtension_Invalid                    : aac aacp adts

Audio
Format                                   : AAC LC SBR PS
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication and Parametric Stereo
Commercial name                          : HE-AACv2
Format version                           : Version 4
Format settings                          : Implicit
Codec ID                                 : 2
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 21.533 FPS (2048 SPF)
Compression mode                         : Lossy
Stream size                              : 3.08 MiB (100%)

 

And ffmpeg will produce:

 

erratic@LAPTOP: /mnt/c/Users/erratic.NETCRAVECOMMUNI/Desktop $ mediainfo 01\ -\ Supernaut.flac.m4a                                      [3:42:47]
General
Complete name                            : 01 - Supernaut.flac.m4a
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (isom/iso2)
File size                                : 3.11 MiB
Duration                                 : 6 min 42 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 64.7 kb/s
Album                                    : Supernaut
Track name                               : Supernaut
Track name/Position                      : 1
Performer                                : 1000 Homo DJs
Genre                                    : Industrial
Recorded date                            : 1990
Writing application                      : Lavf57.83.100

Audio
ID                                       : 1
Format                                   : AAC LC SBR PS
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication and Parametric Stereo
Commercial name                          : HE-AACv2
Format settings                          : NBC
Codec ID                                 : mp4a-40-29
Duration                                 : 6 min 42 s
Duration_LastFrame                       : -45 ms
Bit rate mode                            : Constant
Bit rate                                 : 64.0 kb/s
Channel(s)                               : 2 channels
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 21.533 FPS (2048 SPF)
Compression mode                         : Lossy
Stream size                              : 3.07 MiB (99%)
Default                                  : Yes
Alternate group                          : 1


erratic@LAPTOP: /mnt/c/Users/erratic.NETCRAVECOMMUNI/Desktop $

 

EDIT:

Yeah, itunes encoder produces HE-AAC not HE-AACv2 it looks like. Maybe there is another explanation that I'm missing. The article that you cited says that it supports decoding of HE-AACv2 so that could effectively rule out why it's not able to encode HE-AACv2 but it can't play either of the two HE-AACv2 samples that I can substantiate

 

image.png

2.png

Link to comment

Interesting, after reading some instructions for another encoder that uses libfdk:

--include-sbr-delay
:   When specified, count SBR decoder delay in encoder delay.

    This is not iTunes compatible and will lead to gapless playback
    issue on LC only decoder, but this is the default behavior of FDK
    library.

    Whether counting SBR decoder delay in encoder delay or not result in
    incompatibility in gapless playback. You should pick which one will
    work for your favorite player.

    However, it's better not to choose SBR at all if you want gapless
    playback. LC doesn't have such issues.
   Dual-rate SBR is what is normally used for HE-AAC, where AAC is
    encoded at half the sample rate of SBR, hence "dual rate". On the
    other hand, downsampled SBR uses same sample rate for both of AAC
    and SBR (single rate), therefore downsampled SBR typically consumes
    more bitrate.

    Downsampled SBR is newly introduced feature in FDK encoder library
    version 3.4.12. When libfdk-aac in the system doesn't support this,
    dual-rate SBR will be used. When available, dual-rate SBR is the
    default for HE-AAC and downsampled SBR is the default for ELD+SBR.

    Note that downsampled HE-AAC is not so common as dual-rate one. When
    downsampled HE-AAC is selected, **fdkaac** is forced to choose
    explicit hierarchical SBR signaling, which (at least) iTunes doesn't
    accept.

 

(taken from https://github.com/nu774/fdkaac)

 

I'll bet that's why! I'll try this encoder in a bit.

Link to comment

Confirmed!

 

I got it working playback of AAC_HE_v2 is supported, however it doesn't encode to AAC_HE_V2 and it's a bit difficult to find an encoder that does it correctly (there's some compatibility issues with gapless playback and low delay related SBR features.) But as you can see it's working:
 

 

 

high efficiency v2.png

 

here's the settings I used:

 

nice -n -19 ffmpeg \
-i "${file}" \
-loglevel verbose \
-vn \
-ac 2 \
-ar "${sampling_rate_new}" \
-f s16le - | /root/fdkaac/fdkaac \
-p 29 \
-b 64000 \
-m 5 \
-w 18000 \
-a 1 \
-f 0 \
-L 0 \
-s 0 \
-G 0 \
-R \
--raw-channels 2 \
--raw-rate "${sampling_rate_new}" - -o "${workingdir}/${outfile}.m4a"

 

here's a link to the whole script if anybody is interested in using it:

 

http://termbin.com/szmt

Link to comment

This is sorta last second but if you do want to use that you might also want to change it so ffmpeg will transmit caf which will include tags to the encoder: 

 

nice -n -19 ffmpeg \
-i "${file}" \
-loglevel verbose \
-vn \
-ac 2 \
-ar "${sampling_rate_new}" \
-f caf - | /root/fdkaac/fdkaac \
-p 29 \
-b 64000 \
-m 5 \
-w 18000 \
-a 1 \
-f 0 \
-L 0 \
-s 0 \
-G 0 - -o "${workingdir}/${outfile}.m4a"

 

Link to comment

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



×
×
  • Create New...