BUG: Audio files fail to play on AnkiMobile

Anki fails to play audio files from my flashcard set that work fine on the desktop app. The files come from my course notes, and they weren’t encoded by me.

This is a file encoded by me, and works in AnkiMobile:

swatson@Stevens-MBP ~ ❯ file -I /Users/swatson/Library/Application\ Support/Anki2/Steven/collection.media/unit_3.2_dovere_io_devo.m4a
/Users/swatson/Library/Application Support/Anki2/Steven/collection.media/unit_3.2_dovere_io_devo.m4a: audio/x-m4a; charset=binary

file identifies a audio/x-m4a; charset=binary file. This file is working in AnkiMobile.

swatson@Stevens-MBP ~ ❯ file -I /Users/swatson/Library/Application\ Support/Anki2/Steven/collection.media/unit_3.2_5.m4a              
/Users/swatson/Library/Application Support/Anki2/Steven/collection.media/unit_3.2_5.m4a: video/quicktime; charset=binary

file identifies a video/quicktime; charset=binary file. This file is not working in AnkiMobile.

It’s worth noting that for now all the files can be made to work by running the following,

for i in *.m4a; do afconvert -f m4af -d aac "$i" -o "$i"; done

in the directory containing the audio files on macintosh.

From what you posted, it appears that the unit_3.2_5.m4a file might be a QuickTime video file improperly named with an .m4a extension?

  1. I created a QuickTime video file named test.mov, then copied it to test.m4a.
% file -I test.m4a
test.m4a: video/quicktime; charset=binary
  1. I then added test.mov and test.m4a to an Anki note.
  2. In Mac desktop Anki app, when browsing and previewing the note’s cards, both files autoplay. (A window appears, the video plays in the window, and then the window disappears. This happens for both files in sequence. Also, play buttons are seen on the card.)
  3. In iPhone AnkiMobile app, when browsing and previewing the note’s cards, the .mov file appears and autoplays. (The video apppears on the card and autoplays. The video has media control buttons, including a play button.) However, the .m4a file does not play. (A play button appears on the card, but pressing the button results in an error dialog.)
Error playing audio. This can be caused by a corrupt file, a file iOS does not support (eg. ogg), or an mp3 file incorrectly named .wav

test.m4a: Error Domain=NSOSStatus-ErrorDomain Code=1954115647 "(null)"

I suggest that you try some testing: Rename your unit_3.2_5.m4a file to unit_3.2_5.mov and also change it on a corresponding Anki card. See if Anki behaves differently with the renamed file.

(If the problem is a misnamed file, then I’m not sure if this would be considered a bug, strictly-speaking? I’m not sure if AnkiMobile has an obligation to handle misnamed media files even if desktop Anki is able to do so?)

This is basically a bug. I believe the files are old, and they use an encoding scheme that existed before m4a which is to make an mp4 with no video data. It’s a valid encoding, and it basically works everywhere except for ios (and maybe android???).

But, the fact is that this creates a parity error between these platforms. And, right now, Anki (the app) does nothing and gives you no option. It doesn’t warn you. It doesn’t make a suggestion. It doesn’t convert the files for you. It only gives a generic error toast when and if it fails.

AnkiMobile relies on iOS functionality to play media. If iOS doesn’t support the filetype, then you won’t be able to use it in AnkiMobile. This can’t be fixed in the app – you’ll have to fix the files themselves.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.