#9930 closed defect (fixed)

opus audio in caf container won't play on iOS

Reported by: donald_i Owned by:
Priority: important Component: avformat
Version: git-master Keywords: opus ios caf
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

There appears to be a regression in ffmpeg 5 whereby opus audio, packaged as a caf (apple core audio), will not play in mobile safari. By contrast, the same input file, encoded with the same ffmpeg command line (but using the latest v4 build) will play.

(I am aware I lack the full knowledge to be sure this is an ffmpeg issue as opposed to something to do with the way Apple interpret the format. But I am moved to report it somewhere as I've spent a few days puzzling over why my audio wouldn't play and I'd like to spare others the same pain.)

I attach the full ffmpeg log for generating a working caf (using ffmpeg 4) and a non-working caf (using latest ffmpeg 5). I also attach the sample input MP3 file and the working and not-working caf files.

The ffmpeg command line is the same for both files, the only change is using ffmpeg v4 and ffmpeg v5.

ffmpeg -i 1.mp3 -y -map_metadata -1 -movflags +faststart -c:a libopus -b:a 24k -application voip 1.caf

The iOS syslog entries for the non-playing caf show these messages:

Sep 19 12:16:02 mediaserverd(MediaToolbox)[3913] <Notice>: <<<< FAQ >>>> subaq_buildCAAudioQueue: [0x13f831b20:0x13d644b60] Creating AudioQueue with format:'supo', framesPerPacket:962, sampleRate:48000

Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame

Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  1 ch,  48000 Hz, Float32

Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  1 ch,  24000 Hz, Float32
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  1 ch,  16000 Hz, Float32
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  1 ch,  12000 Hz, Float32
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  2 ch,  48000 Hz, Float32, interleaved
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  1 ch,   8000 Hz, Float32
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  2 ch,  24000 Hz, Float32, interleaved
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  2 ch,  16000 Hz, Float32, interleaved
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  2 ch,  12000 Hz, Float32, interleaved
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13707a640) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 962 frames/packet, 0 bytes/frame
Sep 19 12:16:02 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13707a640) Output format:  2 ch,   8000 Hz, Float32, interleaved
Sep 19 12:16:02 mediaserverd(AudioToolbox)[3913] <Error>:      AudioQueueObject.cpp:401   AudioConverterNew from AudioQueueNew returned 1718449215

(The error code 1718449215 apparently indicates an unknown audio format.)

The working caf entry from the iOS syslog is much shorter:

Sep 19 12:21:52 mediaserverd(MediaToolbox)[3913] <Notice>: <<<< FAQ >>>> subaq_buildCAAudioQueue: [0x13d08fb50:0x141efb5e0] Creating AudioQueue with format:'supo', framesPerPacket:960, sampleRate:48000
Sep 19 12:21:52 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:120   (0x13708c040) Input format:  1 ch,  48000 Hz, opus (0x00000000) 0 bits/channel, 0 bytes/packet, 960 frames/packet, 0 bytes/frame
Sep 19 12:21:52 mediaserverd(AudioCodecs)[3913] <Notice>:         ACOpusDecoder.cpp:123   (0x13708c040) Output format:  1 ch,  48000 Hz, Float32
Sep 19 12:21:52 mediaserverd(AudioToolbox)[3913] <Notice>:      AudioQueueObject.cpp:534   aq@0x13707e600: reporterID=0

Please note that both files play back fine with ffplay, and even work on Safari on macOS. It is necessary to open them in safari on an iOS device to see the behaviour reported. (My test was on an iPhone 7 running iOS 15.6.1) The easiest way to test the files is to run up a local webserver on a pc and then open them from the iOS device.

Attachments (5)

working_ffmpeg-20220920.log (6.2 KB ) - added by donald_i 20 months ago.
FFMPEG log for the working CAF file (using FFMPEG v4)
not_working_ffmpeg-20220920-114709.log (6.3 KB ) - added by donald_i 20 months ago.
FFMPEG log for the not-working caf file, using FFMPEG v5
1.mp3 (20.6 KB ) - added by donald_i 20 months ago.
The input file used to generate both opus CAFs.
works.caf (4.7 KB ) - added by donald_i 20 months ago.
The CAF file that plays on iOS Safari.
doesntwork.caf (4.7 KB ) - added by donald_i 20 months ago.
The CAF file that will not play back on mobile safari.

Download all attachments as: .zip

Change History (7)

by donald_i, 20 months ago

Attachment: working_ffmpeg-20220920.log added

FFMPEG log for the working CAF file (using FFMPEG v4)

by donald_i, 20 months ago

FFMPEG log for the not-working caf file, using FFMPEG v5

by donald_i, 20 months ago

Attachment: 1.mp3 added

The input file used to generate both opus CAFs.

by donald_i, 20 months ago

Attachment: works.caf added

The CAF file that plays on iOS Safari.

by donald_i, 20 months ago

Attachment: doesntwork.caf added

The CAF file that will not play back on mobile safari.

comment:1 by James, 20 months ago

Component: undeterminedavformat
Priority: normalimportant
Reproduced by developer: set
Status: newopen

comment:2 by James, 20 months ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.