There are some known limitations on Xbox 360 to play mp4 video. First of all you should update your Xbox, so if it’s not yet in the network you have to get it there. Once you’re confident that your box is up to date you can start looking into MP4 and it’s issues with Xbox. Some say that Xbox has the following special needs:
Xbox can play H.264 MP4 video, but only up to 10 Mbps with resolutions of 1920*1080, 30 frames per second. Baseline, main and high video profile (up to level 4.1). Audio profiles must be in AAC, 2-channel, Low Complexity
Xbox can also play MPEG-4 Part 2 video, but up to 5 Mbps with resolutions of 1280*720, 30 frames per second. Simple Profile and Advanced Simple Profile. Audio profiles must be in AAC, 2-channel, Low Complexity.
Last night I found out that this is only partially true. I noticed that I can play most of my MP4’s without issues, but some fail to start. It didn’t matter whether I had the files on a USB or streamed them over DLNA server.
So I took a closer look into those exceptions. For that I installed libav-tools to my Ubuntu headless server (It’s basically a fork of the well known ffmpeg, funny story with that..). This packages provides some multimedia tools, and I was interested in avprobe and avconv.
So first let’s see what we’re dealing with:
avprobe My.Awesome.Movie.mp4
avprobe version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav developers
built on Jan 24 2013 18:03:14 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'My.Awesome.Movie.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-03-06 20:38:13
Duration: 01:48:07.59, start: 0.000000, bitrate: 2911 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1280x528 [PAR 1:1 DAR 80:33], 2516 kb/s, 23.98 fps, 23.98 tbr, 66893 tbn, 47.95 tbc
Metadata:
creation_time : 2011-03-06 00:32:58
Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 391 kb/s
Metadata:
creation_time : 2011-03-06 20:42:41
Video resolution was fine. So the issue had to be in audio. Codec is aac, but the 5.1 has more like 6 channels, not 2 as required.
So, let’s convert the 6 channel aac to 2 cannel aac and we’re good to go. avconv is nice enough tool for that:
avconv -i My.Awesome.Movie.mp4 -vcodec copy -acodec aac -ab 160k -ac 2
-strict experimental output.mp4
avconv version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
built on Jan 24 2013 18:03:14 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'My.Awesome.Movie.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-03-06 20:38:13
Duration: 01:48:07.59, start: 0.000000, bitrate: 2911 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1280x528 [PAR 1:1 DAR 80:33], 2516 kb/s, 23.98 fps, 23.98 tbr, 66893 tbn, 47.95 tbc
Metadata:
creation_time : 2011-03-06 00:32:58
Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 391 kb/s
Metadata:
creation_time : 2011-03-06 20:42:41
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-03-06 20:38:13
Duration: 01:48:07.59, start: 0.000000, bitrate: 2911 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1280x528 [PAR 1:1 DAR 80:33], 2516 kb/s, 23.98 fps, 23.98 tbr, 66893 tbn, 47.95 tbc
Metadata:
creation_time : 2011-03-06 00:32:58
Stream #0.1(eng): Audio: aac, 48000 Hz, 2 channels, s16, 160 kb/s
Metadata:
creation_time : 2011-03-06 20:42:41
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac -> aac)
Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.
Can not resample 6 channels @ 48000 Hz to 2 channels @ 48000 Hz
Huston, we’ve had a problem here. It turns out that as simple as converting a 6 channel audio down to 2 seems to be, it’s still not properly solved. I spent hours finding a solution. Some of them suggested to install newer version of ffmpeg or patch it, some said to extract audio, convert it with some other tool (ie faad) and then mux audio and video back together. I also tried to use other codecs without any luck.
Out of despair I started to look into my other MP4’s as well, specially the ones that were playing nicely in Xbox. And I noticed:
avprobe More.Awesomeness.mp4
avprobe version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav developers
built on Jan 24 2013 18:03:14 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'More.Awesomeness.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf53.21.1
Duration: 00:22:38.27, start: 0.000000, bitrate: 3400 kb/s
Stream #0.0(eng): Video: h264 (High), yuv420p, 1280x720, 3011 kb/s, 23.98 fps, 47.92 tbr, 1k tbn, 47.95 tbc
Stream #0.1(und): Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
Wait, what? 5.1 and works! So it’s aac issue and ac3 seems to work. Luckily aac to ac3 is a breeze for avconv:
avconv -i My.Awesome.Movie.mp4 -vcodec copy -acodec ac3 -ab 160k output.mp4
avconv version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
built on Jan 24 2013 18:03:14 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'My.Awesome.Movie.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-03-06 20:38:13
Duration: 01:48:07.59, start: 0.000000, bitrate: 2911 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1280x528 [PAR 1:1 DAR 80:33], 2516 kb/s, 23.98 fps, 23.98 tbr, 66893 tbn, 47.95 tbc
Metadata:
creation_time : 2011-03-06 00:32:58
Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 391 kb/s
Metadata:
creation_time : 2011-03-06 20:42:41
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-03-06 20:38:13
encoder : Lavf53.21.1
Stream #0.0(und): Video: ![0][0][0] / 0x0021, yuv420p, 1280x528 [PAR 1:1 DAR 80:33], q=2-31, 2516 kb/s, 66893 tbn, 66893 tbc
Metadata:
creation_time : 2011-03-06 00:32:58
Stream #0.1(eng): Audio: ac3, 48000 Hz, 5.1, flt, 160 kb/s
Metadata:
creation_time : 2011-03-06 20:42:41
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac -> ac3)
Press ctrl-c to stop encoding
Input stream #0:1 frame changed from rate:48000 fmt:s16 ch:6 to rate:48000 fmt:flt ch:6
frame=155543 fps= 91 q=-1.0 Lsize= 2122497kB time=6487.41 bitrate=2680.2kbits/s
video:1993177kB audio:126711kB global headers:0kB muxing overhead 0.123045%
And it works.