[FFmpeg-trac] #10465(avformat:new): The latest versions of ffmpeg (>=5.x) produces not playable on Apple devices .caf files

FFmpeg trac at avcodec.org
Tue Jul 11 16:48:11 EEST 2023


#10465: The latest versions of ffmpeg (>=5.x) produces not playable on Apple
devices .caf files
-------------------------------------+-------------------------------------
             Reporter:  Sergey       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avformat     |                  Version:  5.0.3
             Keywords:  opus caf     |               Blocked By:
  ios macos                          |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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 `mFramesPerPacket` (from
 `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.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10465>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list