.MP4 video (h.264 format) is not playing in iPhone when I host the video in Amazon EC2 instance

0

I have converted my source.flv video into target.mp4 (h.264 format) by using following command:

ffmpeg -i source.flv -r 25 -b:a 128k -strict -2 -c:v libx264 -preset slow -s 320x240 -b:v 768k -ar 44100 -c:a aac target.mp4;

The target.mp4 video is playing in my computer browser's but it's not playing on the iPhone / iPad when I host my video on an Amazon EC2 instance.

The same target.mp4 video is playing in my computer browser's as well as the iPhone / iPad when I host it some place else.

QuickTime shows the following error when I try opening the video from the EC2 instance:

QuickTime
BYTE_RANGE_ERROR_MESSAGE

Shishir Mudliyar

Posted 2012-11-26T10:11:41.037

Reputation: 53

Answers

4

Finally we got the actual solution for 'Why our mp4(h.264)' videos are not playing in iphone . The solution is : remove or comment compress.conf file from httpd.conf(apache server config file).

Compress.conf file is used to compress output before send it to client , If you don't want to remove compress.conf than you may comment few lines inside compress.conf. Comment

# Load the filter module

SetEnv filter-errordocs true

FilterDeclare comp-resp

# Compress everything except for images, audio and video

#FilterProvider comp-resp DEFLATE resp=Content-Type !/^(image|audio|video)//

#FilterProtocol comp-resp change=yes

Shishir Mudliyar

Posted 2012-11-26T10:11:41.037

Reputation: 53

2

In order to stream video to these QuickTime / Apple devices, the server sends out an Accept-Ranges: bytes header. This indicates to the player that it can request certain parts of the video by sending a byte offset, which allows you to, for instance, begin streaming from the middle of a video without having to download the entire file.

Usually this works by default. However, byte range requests can also be considered a security risk, for example when a Denial of Service attack is launched against the server. For this reason, byte range requests may be blocked along the way, either through a router or firewall, or by the EC2 server itself, which would lead to the error message you're seeing.

Therefore, check the connection for possible blocked requests, or consider contacting EC2 support.

See also:

slhck

Posted 2012-11-26T10:11:41.037

Reputation: 182 472

i have contacted Amazon development support and waiting for their reply. Until their reply come, i am also doing some google search and found "qt-faststart". Is it useful in my case(i,e progressive downloading in iPhone/iPad) ?? – Shishir Mudliyar – 2012-11-27T06:42:59.927

While not entirely related to your issues, using qt-faststart to move the moov atom to the beginning of your MP4 files is definitely encouraged for all kinds of streaming. See: Understanding the MPEG-4 movie atom | Adobe Developer Connection

– slhck – 2012-11-27T06:47:20.680

The following are the headers from EC2 instance that we observed through liveheaders in firefox.

[GET /tmp/race.mp4 HTTP/1.1 Host: xxx.com User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive ]

[HTTP/1.1 200 OK Server: Apache/2.2.15 (CentOS) Etag: "1e15b2-4cf6375252c50" Accept-Ranges: bytes Content-Length: 1971634 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: video/mp4] – Shishir Mudliyar – 2012-11-29T05:58:53.797

And also not getting comprehensive reply from amazon support team , i am working with amazon support to get the appropriate solution – Shishir Mudliyar – 2012-11-29T06:03:49.597

Well, that merely tells you that the server will allow Accept-Ranges: bytes, so yeah, it must be blocked along the way. – slhck – 2012-11-29T06:04:09.020