2
votes

I wanted to convert some old Flash videos to 1 video format so the content will show on a mobile phone. I got some mp4 and it doesn't work on Android, specifically Chrome 32 running on Android 4.3.

Click this link to a fiddle

It is loading the mp4 file on Chrome 32 on Android 4.3, but I thought there is no support for H.256

Then I went to a this site http://techslides.com/sample-webm-ogg-and-mp4-video-files-for-html5/

and the mp4 video there works on Android/Chrome.

I used VLC to check the codecs and they look the same

H264 - MPEG-4 AVC (part 10) (avc1)
Resolution: is different (working one is 560x320
Resolution: mp4 not working is 640x480
Framerate: working is 30, not working is 12
Decoded format: Planar4:2:0 YUV

I then searched the codec then with ffmpeg and I see that there is a property called compatible_brands: mp42icomavc1

which is different than the non-working mp4 which has this property set to compatible: mp42mp41

The file sizes are quite different as well. Could this be an issue.

When I load http://html5test.com the Chrome on Android browser says MPEG-4 is not supported by H.264 is. it doesn't say anything about the container.

ok here is some source code, I thought chrome on android doesn't support mp4 files, but when I load the following on Chrome 32 running on Sony Xperia Tablet running Android 4.3. I had an mp4 file that I converted to webm, but chrome still could not run it. It is 8 MB so perhaps the size is an issue....this mp4 has a different size and frameframe. Other than that I only see compatible version different as mentioned above.

<html>
<head>
    <meta name="viewport" content="width=device-width">
</head>
<body>
    <h4>This is mp4 video</h4>
    <video id="small" controls="controls" autoplay="autoplay" preload="auto" name="small">
        <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
    </video>
</body>
</html> 
2
Is this a programming question? It seems you're simply trying to use the stock browser to play videos rather than writing your own code.Squonk
well actually I putting the video inside of a jquery mobile page. However the .mp4 file doesn't seem to play. So I stripped it down to a basic html file which I then loaded on Chrome32 on Android4.3. The video doesn't play, but then I saw another mp4 file which does as per the website mentioned. I can give you the basic html if you want, but it appears this is something to do with Codecs. I read that Chrome is going with .webm, but I converted the video and still doesn't work, then I found that the .mp4 above does work in it, so I am really confused.matthewbaskey

2 Answers

7
votes

Just to follow up. The H.264 codec for video and AAC for codec for sound is wrapped in the MP4 container. According to wikipedia there are 5 different 'profiles' for the mp4 video file extension using the H.264 codec. Google wanted to move to the royalty free Webm but it seems they are half in half out. Anyway the mp4 video encoded with the 'Main' profile worked on the Apple IPhone but not any of the Android mobile devices I tested: Sony Xperia, Google Nexus, Samsung Galaxy and Motorola MotoG.

Changing the profile to 'Constrained Baseline Profile' allowed the video to played on all these Android devices as well as the Apple IPhone.

ffmpeg is a command line program with alot of switches. The easiest thing to do was download Handbrake and select 'Universal' from the list of pre-rolled encoding settings.

This means I can have broader support using just 1 video file.

It even worked on Firefox running on Android, although I had read that Firefox and Opera were definitely not supporting this codec. Not sure could be down to the device, not the browser.

2
votes

This produces an mp4 with Constrained Baseline Profile. Video also runs using MediaPlayer with Android 4.1.1 on older Xperia:

> ffmpeg -i in.mp4 -profile:v baseline out.mp4