Opened 6 years ago

Last modified 4 years ago

#2809 new defect

AAC output does not play on Nintendo devices

Reported by: playingwithmusic Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: aac mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by cehoyos)

Summary of the bug: When converting files of any input format to AAC audio (in .mp4, .m4a, or aac .3gp containers), the files will not play on Nintendo DSi/DSi XL/3DS/3DS XL. The files are detected, but when selected, they display "Could not play." It does not matter which AAC encoder is used. The fact that files encoded with libfaac in ffmpeg fail to play while the standalone faac works flawlessly suggests a problem in ffmpeg rather than the encoder.

How to reproduce: Convert any file to AAC audio with frequency 41000-48000 Hz and bitrate 16-320 kbps, copy to SD card, and attempt to play on a Nintendo handheld. One of the commands that I tried is listed below, but any variation (such as with ffmpeg command and -c:a aac and -strict -2 parameters) should produce the same results.

for f in *.webm; do ffmpeg -i "$f" -acodec libfaac -b:a 128k -ar 44100 -vn -af volume=1.50 "${f%.webm}.m4a"; done
ffmpeg version 1.2.1
built on Jul 11 2013 07:32:35 with gcc 4.8 (Debian 4.8.1-6)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr  libavutil

I've attached an output file of this command. The corresponding input may be found at https://www.youtube.com/watch?v=ALuCtudUHhs

Attachments (7)

Nervous_Breakdown.m4a (2.0 MB) - added by playingwithmusic 6 years ago.
latest_ffmpeg.m4a (2.0 MB) - added by playingwithmusic 6 years ago.
faac.m4a (2.4 MB) - added by playingwithmusic 6 years ago.
faac3gp4.3gp (2.4 MB) - added by cehoyos 6 years ago.
faacisom.m4a (2.4 MB) - added by cehoyos 6 years ago.
faacmp41.m4a (2.4 MB) - added by cehoyos 6 years ago.
faacnoiods.m4a (2.4 MB) - added by cehoyos 6 years ago.

Change History (31)

Changed 6 years ago by playingwithmusic

comment:1 Changed 6 years ago by playingwithmusic

The 128 kbps output file was too large, so the version I attached was encoded at 96 kbps.

comment:2 Changed 6 years ago by cehoyos

  • Keywords nintendo unplayable encoding removed
  • Priority changed from important to normal

Please test current git head and please provide the command line together with the complete uncut console output to make this a valid ticket.

And please encode a sample with faac (confirm that if works) and provide the sample and the working faac command line.

comment:3 Changed 6 years ago by playingwithmusic

  • Version changed from 1.2.1 to git-master

Changed 6 years ago by playingwithmusic

Changed 6 years ago by playingwithmusic

comment:4 Changed 6 years ago by playingwithmusic

The command used to create "latest_ffmpeg.m4a" was

for f in *.webm; do ffmpeg -i "$f" -c:a libfaac -b:a 96k -ar 44100 -vn "${f%.webm}.m4a"; done

I manually renamed the file prior to upload. The output of

ffmpeg -v 9 -loglevel 99 -i Nervous_Breakdown.webm

was

ffmpeg version git-2013-07-25-de0a1f6 Copyright (c) 2000-2013 the FFmpeg developers

built on Jul 25 2013 13:59:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --prefix=/home/gary/ffmpeg_build --extra-cflags=-I/home/gary/ffmpeg_build/include --extra-ldflags=-L/home/gary/ffmpeg_build/lib --bindir=/home/gary/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libvorbis --enable-libvpx --enable-libfaac --enable-nonfree --enable-x11grab

libavutil 52. 40.100 / 52. 40.100
libavcodec 55. 19.100 / 55. 19.100
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 81.103 / 3. 81.103
libswscale 2. 4.100 / 2. 4.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument 'Nervous_Breakdown.webm'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file Nervous_Breakdown.webm.
Successfully parsed a group of options.
Opening an input file: Nervous_Breakdown.webm.
[matroska,webm @ 0x24aa0c0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0x24aa0c0] File position before avformat_find_stream_info() is 4204
[matroska,webm @ 0x24aa0c0] All info found
[matroska,webm @ 0x24aa0c0] File position after avformat_find_stream_info() is 143660
Input #0, matroska,webm, from 'Nervous_Breakdown.webm':

Duration: 00:02:49.47, start: 0.000000, bitrate: 1831 kb/s

Stream #0:0, 1, 1/1000: Video: vp8, yuv420p, 1280x720, 1/1000, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)

Stream #0:1, 1, 1/1000: Audio: vorbis, 44100 Hz, stereo, fltp (default)
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0x24b2780] Statistics: 143660 bytes read, 0 seeks

"faac.m4a" plays just fine. The command used to create it was

for f in *.webm; do ffmpeg -i "$f" -ar 44100 -vn -af volume=1.50 "${f%.webm}.wav"; done && faac -c 44100 -q 50 -w *.wav && rm *.wav

comment:5 Changed 6 years ago by cehoyos

Don't you agree that it would be much easier to reproduce your problem if you'd use actual command lines (with actual file names) instead of shell scripts with variables?

What happens if you use -aq 50 with ffmpeg or -b 96 with faac?

comment:6 Changed 6 years ago by playingwithmusic

I didn't stop to think about that. Sorry.

ffmpeg -i Nervous_Breakdown.webm -c:a libfaac -aq 50 -ar 44100 -vn Nervous_Breakdown.m4a

results in an unplayable file.

ffmpeg -i Nervous_Breakdown.webm -ar 44100 -vn -af volume=1.50 Nervous_Breakdown.wav && faac -c 44100 -b 96 -w *.wav && rm *.wav

plays fine.

comment:7 Changed 6 years ago by playingwithmusic

I've tried these commands with and without the -af volume=1.50 parameter, and it makes no difference.

comment:8 Changed 6 years ago by cehoyos

Does the Nintendo device only support mp4 files or also aac?
What happens if you remove -w from the faac command line and encode to .aac with FFmpeg?

comment:9 Changed 6 years ago by llogan

  • Description modified (diff)
  • Summary changed from AAC files encoded with ffmpeg/avconv do not play on Nintendo devices to AAC output does not play on Nintendo devices

Please confirm if native AAC encoder also fails:

ffmpeg -i input -c:a aac -strict -2 -ar 44100 -vn output.m4a

Does remuxing the working output from faac produce a non-working file?

ffmpeg -i faacoutput -c copy output.m4a

comment:10 follow-up: Changed 6 years ago by playingwithmusic

They all support .mp4, .m4a and .3gp files. The .aac files do not appear. Upon renaming the files to the supported extensions, they still do not play, regardless of whether faac or FFmpeg was used.

Using either of the commands listed above still results in an unplayable file.

comment:11 in reply to: ↑ 10 Changed 6 years ago by cehoyos

Replying to playingwithmusic:

They all support .mp4, .m4a and .3gp files. The .aac files do not appear. Upon renaming the files to the supported extensions, they still do not play, regardless of whether faac or FFmpeg was used.

I did not mean renaming but using faac with its default adts mode:
$ faac -b 96 Nervous_Breakdown.wav

comment:12 Changed 6 years ago by playingwithmusic

I did remove the -w portion and use the default adts mode. The files would not appear. I'm unaware of how to edit the original summary, but it seems that .3gp should take the place of .aac; only .m4a, .mp4 and .3gp extensions are supported by Nintendo's devices. Upon finding this out, I renamed the .aac files to each of the supported extensions in turn, and they still did not play despite half of them being encoded using faac.

comment:13 Changed 6 years ago by cehoyos

  • Description modified (diff)

comment:14 Changed 6 years ago by cehoyos

  • Description modified (diff)

Please test the following command lines:

$ ffmpeg -i faac.m4a -acodec copy out.mp4
$ ffmpeg -i faac.m4a -acodec copy out.3gp

comment:15 Changed 6 years ago by playingwithmusic

Neither of the files play.

Changed 6 years ago by cehoyos

Changed 6 years ago by cehoyos

Changed 6 years ago by cehoyos

comment:16 Changed 6 years ago by cehoyos

  • Keywords mov added

I attached three files to test: Do any of them play on your Nintendo device?

comment:17 Changed 6 years ago by playingwithmusic

All three play.

comment:18 Changed 6 years ago by cehoyos

Please test the following:

$ ffmpeg -i faac.m4a -acodec copy -skip_iods 0 test.m4a
$ ffmpeg -i faac.m4a -acodec copy -skip_iods 0 test.mp4
$ ffmpeg -i faac.m4a -acodec copy -skip_iods 0 test.3gp

comment:19 Changed 6 years ago by playingwithmusic

None of them play.

Changed 6 years ago by cehoyos

comment:20 Changed 6 years ago by cehoyos

Could you test another sample - faacnoids.m4a - where I removed the iods atom from the faac sample?

Sorry, this would need somebody who either knows or can make an educated guess about what is missing / unexpected from Nintendo's pov, I can only make wild guesses.

comment:21 Changed 6 years ago by playingwithmusic

It plays.

I don't know much about encoding audio, but if it makes any difference, I remember Nintendo's president being quoted as saying that they went with AAC over other audio formats because AAC is easier to manipulate (fast forward, change pitch, etc). I hope this helps in some way.

Last edited 4 years ago by playingwithmusic (previous) (diff)

comment:22 follow-up: Changed 5 years ago by jh

Using this I had success getting the m4a file working on the Nintendo DSI XL.

(The key being the skipiods flag, per above, the rest is just converting an mp3 to m4a)

avconv -i test.mp3 -acodec aac -strict -2 -skip_iods 0 test.m4a
Last edited 5 years ago by jh (previous) (diff)

comment:23 in reply to: ↑ 22 Changed 4 years ago by playingwithmusic

Replying to jh:

Using this I had success getting the m4a file working on the Nintendo DSI XL.

(The key being the skipiods flag, per above, the rest is just converting an mp3 to m4a)

avconv -i test.mp3 -acodec aac -strict -2 -skip_iods 0 test.m4a

Which version of avconv did you use/are you using?

comment:24 Changed 4 years ago by playingwithmusic

  • Component changed from undetermined to avformat

I suspect that the issue is in avformat; if I encode with FFmpeg and then use MP4Box to create the m4a container, the m4a file plays on 3DS without a problem. FAAC is not necessary at all using this method. An example command would be:

ffmpeg -i input.webm -strict -2 -c:a aac -b:a 128k -ar 44100 -vn ffmpeg.mp4 && MP4Box -add ffmpeg.mp4 final.m4a

Note: See TracTickets for help on using tickets.