The latest versions of ffmpeg (>=5.x) produces not playable on Apple devices .caf files
|Reported by:||Sergey||Owned by:|
|Version:||git-master||Keywords:||opus caf ios macos|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Source file contains opus audio stream inside, and it's playable on iOs and Mac OS.
But if do
% ffmpeg -y -i playable.caf -c:a copy converted.caf
(i.e. I just trying to duplicate content of audio stream to another file) I get not playable .caf file.
After some investigation I found result file has
struct CAFAudioFormat: https://developer.apple.com/library/archive/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html) different from 960 (comparing to
playable.caf). If I change that piece of file to 960 - both iOs and Mac OS starts play this file without any issue.
After further investigation I found problem is on https://github.com/FFmpeg/FFmpeg/blob/75b1a555a70c178a9166629e43ec2f6250219eb2/libavformat/cafenc.c#L262
packet_size = st->duration / (caf->packets - 1);
And if I replace that line to
packet_size = st->duration / caf->packets;
it fixes output file, but I'm not sure if it's right fix.
Change History (6)
by , 2 months ago