PHP-FFMpeg: Apple iDevices do not display mp4 videos when served without special treatment

Q A
Bug? no
New Feature? no
Version Used Not related to
FFmpeg Version Not related to
OS Not related to

According to http://www.iphonefaq.org/archives/97961 (I’ve also found this information in other places) videos have to be encoded with H.264 video up to 720p, 30 fps and audio: AAC-LC up to 160 Kbps, 48kHz, stereo, to be viewable from iDevices.

When I encode the video using x264 + libfdk_aac and gets information from VLC, I have for audio MPEG AAC Audio (mp4a) / 44100 Hz / 16 bits / 1411 kbit/s.

It seems that MPEG AAC and AAC-LC are the same but it looks like the KiloBitrate is too much. I’ve found an option to set it when saving only the audio, but can’t find one when saving the video. Is there one ?

Is there a specific configuration to be able to save video to be viewable from iDevices ? Thanks

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 51 (44 by maintainers)

Most upvoted comments

Ah… It works better like this! I still can’t read the video on iDevices, but now I can search and “play” with data. I’ll let you know. Additionally, I’ve found extra-spaces in the examples, I’ve made a PR (#318) to correct them.

I think I’d might got it.

https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility

Use simple filters to get what you want 😉

But I’m already making a pr for this.

Hi @Laurent3170, I’m not an expert on iPhone encoding… I’ll check if I can find some help on this…

So it’s confirmed… The problem was not only with the settings of the saved video but also with the Response sent by Symfony (in fact even with PHP directly it doesn’t work). Using Response + file_get_contents() doesn’t work on iDevice, but using Symfony\Component\HttpFoundation\BinaryFileResponse works and displays the video correctly.

We still have to use special settings to format videos for iDevices.

Finding a bug (without knowing it) is not the main part of the problem 😉 Thanks to you!

Oh. Thanks for searching this, there is a mistake… You’d found a bug!

Hi @Laurent3170, There is currently no option to set the KiloBitrate option in the X264 interface.

May I create a PR? I’d searched after this, but didn’t found anything.

Thanks. The thing is that I don’t know what my command line should look like… But I’ll make investigations.