13

I'm trying to setup a simple mobile page for a client with a link to an .mp4 video file. Lke so:

<a href="My_Video_File.mp4" target="_blank">Watch MP4 Video</a>

And then I've obviously got my video file sourced properly and the .mp4 has the following characteristics:

Dimension: 480 * 272
Codecs: AAC, H.264, MPEG-4 SDSM, MPEG-4 ODSM
Channel Count: 2
Total Bitrate: 991
Size: 11.4MB

But, the problem is when I click on the link iPhone says "Movie cannot be played." and doesn't tell me why.

Any help?

2
  • have you tried copying the file to your iphone via iTunes and seeing if it plays that way?
    – Alan
    Commented Jul 19, 2010 at 22:20
  • 1
    And..what happens when you try the HTML5 video tag: w3schools.com/html5/tag_video.asp
    – Alan
    Commented Jul 19, 2010 at 22:21

5 Answers 5

22

The problem was partially to do with encoding but more to do with the dimensions.

I found out that if your .mp4 file is larger in dimension than 640*360 then the iPhone (iPad, iPod) won't even give the user the option to attempt to play it. They just get the X'd out play button icon.

Also, these devices only support .mp4's that are encoded with the baseline H.264 profile, or they can't be played.

Also, there's a bitrate limit of 1.5Mb for the iPhone, but it's suggested to keep the bitrate below 900kb.

If quality is less of a concern than size then you can use m4v's of larger dimensions but I believe the bitrate rules still apply.

5
  • 6
    The bitrate limit for the iPhone is actually 2500kbps. The iPod video had the 1500kbps limit. The iPhone 4 and iPad (both generations) and newer can play up to 720p, Main Profile at nearly any bitrate.
    – Chealion
    Commented Jun 22, 2011 at 15:33
  • your answer contradicts your facts in the question therefore it is a bad answer
    – user2587965
    Commented May 22, 2020 at 21:25
  • @francogrex You might want to check the dates on this question. It's literally a decade old now. Things have changed.
    – AJB
    Commented May 30, 2020 at 5:04
  • update 2022: a width of 1920 is accepted (at least). You can limit width without specifying height using an expression: -vf "scale='min(600,iw)':-1" -- see Ask Ubuntu answer
    – webaware
    Commented Jun 8, 2022 at 9:33
  • If it plays the mp4 video and not the audio, then the problem is that the iPhone doesn't support AAC - you need mp4a for the audio codec. Apple is known for not having backward compatibility with standard formats.
    – MC9000
    Commented Feb 26, 2023 at 3:19
9

I encountered a similar issue and my guess was encoding. I had tried the "iPhone" preset with Adobe Premiere CS4 (Adobe Media Encoder) with no luck.

Running it through ffmpeg with the following did the trick:

ffmpeg -i INPUT -s 320x240 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 -coder 0 -bf 0 -refs 1 -flags2 -wpred-dct8x8 -level 30 -maxrate 10M -bufsize 10M -acodec libfaac -ac 2 -ar 48000 -ab 192k OUTPUT.mp4

I found the above (and many other configurations) here: http://rodrigopolo.com/ffmpeg/cheats.html (I corrected a few typos in their "iPod-iPhone 640 width, without presset" [sic].)

Other searching around will probably yield more information about the encoding requirements (h.264 baseline 3.0) and size requirements for the movie to play on the iPhone.

The official Apple reference on the subject: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html

6

You need the h254 video to be progressive not lower. Choose the H.264 preset and change the video from lower to progressive.

0
3

this did it for me:

ffmpeg -an -i movie.mp4 -vcodec libx264 -codec:a libmp3lame -qscale:a 1 -pix_fmt yuv420p -profile:v baseline -level 3 output.mp4

I used mp3 codec here. This fixed my iPhone mp4 problem!

0
1

I ran into a similar situation with video that I was generating. It would play fine on my local machine, or through a browser that supports .mp4; however when I tried viewing it on my iPhone it would invariably bring up the crossed-out play button. After reading ffmpeg docs I tried using the following and it worked beautifully on my iPhone as well as the other devices I've been able to try.

ffmpeg -i input.mkv -c:v libx264 -crf 28 -preset veryslow -tune fastdecode \
  -profile:v baseline -level 3.0 -movflags +faststart -c:a libfdk_aac -ac 2 \
  -ar 44100 -ab 64k -threads 0 -f mp4 output.mp4

The video that I'm dealing with is 1280x720 at 30fps, and the option that finally got it working was

-profile:v baseline -level 3.0
1
  • It does not work for me, do you have any update for newer versions of FFMPEG?
    – ammcom
    Commented Aug 22, 2015 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.