Convert mp4 video to a format xbox 360 can play

.mp4ffmpegmencodervideo conversionxbox360

Here is a video file my Xbox 360 refuses to play:

$ MP4Box -info video.mp4
* Movie Info *
        Timescale 90000 - Duration 02:18:33.365
        Fragmented File no - 2 track(s)
        File Brand mp42 - version 0
        Created: GMT Sat Jul 21 07:08:55 2012

File has root IOD (9 bytes)
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: ISO Reserved Profile (0x7f)
Audio PL: High Quality Audio Profile @ Level 2 (0x0f)
No streams included in root OD

iTunes Info:
        Encoder Software: HandBrake 0.9.6 2012022800

Track # 1 Info - TrackID 1 - TimeScale 90000 - Duration 02:18:33.235
Media Info: Language "Undetermined" - Type "vide:avc1" - 199318 samples
Visual Track layout: x=0 y=0 width=1280 height=688
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1280 x 688
        AVC Info: 1 SPS - 1 PPS - Profile High @ Level 4.1
        NAL Unit length bits: 32
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 02:18:33.365
Media Info: Language "English" - Type "soun:mp4a" - 389689 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 6 Channel(s) - SampleRate 48000
Synchronized on stream 1

$ avconv -i video.mp4
avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav     developers
  built on Nov  6 2012 16:51:33 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2012-07-21 07:08:55
    encoder         : HandBrake 0.9.6 2012022800
  Duration: 02:18:33.36, start: 0.000000, bitrate: 2299 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x688, 1973 kb/s, 23.98 fps, 90k tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2012-07-21 07:08:55
    Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 319 kb/s
    Metadata:
      creation_time   : 2012-07-21 07:08:55
At least one output file must be specified

What tool, such as ffmpeg or mencoder, and what magic command line incantation should I use to transcode this file into a format Xbox 360 can play? I want the transcode process to retain as good video quality as possible.

With the help from slhck, I've managed to create a new mp4 file with the audio changed to two channels. However Xbox 360 still refuses to play it for some reason. Here is what MP4Box and ffmpeg says about the new file:

$ MP4Box -info final.mp4
* Movie Info *
        Timescale 1000 - Duration 02:18:33.343
        Fragmented File no - 2 track(s)
        File Brand isom - version 512
        Created: GMT Sat Jul 21 07:08:55 2012

File has root IOD (9 bytes)
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: Not part of MPEG-4 Visual profiles (0xfe)
Audio PL: Not part of MPEG-4 audio profiles (0xfe)
No streams included in root OD

iTunes Info:
        Encoder Software: Lavf53.21.0

Track # 1 Info - TrackID 1 - TimeScale 90000 - Duration 02:18:33.193
Media Info: Language "Undetermined" - Type "vide:avc1" - 199318 samples
Visual Track layout: x=0 y=0 width=1280 height=688
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1280 x 688
        AVC Info: 1 SPS - 1 PPS - Profile High @ Level 4.1
        NAL Unit length bits: 32
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 02:18:33.343
Media Info: Language "Undetermined" - Type "soun:mp4a" - 389688 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1
Alternate Group ID 1

$ avconv -i final.mp4   
avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Nov  6 2012 16:51:33 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'final.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-07-21 07:08:55
    encoder         : Lavf53.21.0
  Duration: 02:18:33.34, start: 0.000000, bitrate: 2161 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x688, 1973 kb/s, 23.98 fps, 90k     tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2012-07-21 07:08:55
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 180 kb/s
    Metadata:
      creation_time   : 2012-07-21 07:08:55
At least one output file must be specified

Best Answer

Per the Xbox Engineering Video Playback FAQ, the h.264 requirements are:

  • Video Profiles: Baseline, main, and high (up to Level 4.1) profiles.
  • Video Bitrate: 10 Mbps with resolutions of 1920 x 1080 at 30fps. See question number 11 for more information.
  • Audio Profiles: 2 channel AAC low complexity (LC)
  • Audio Max Bitrate: No restrictions.

Now, as a general command line, this should work:

ffmpeg -i input.mp4 -c:v libx264 -profile:v high -crf 23 -c:a libfaac -q:a 100 output.mp4

Change the -crf and -q:a parameters to vary the quality. Lower CRF means better. 23 is the default, but choose something between 18 and 28 and see if you like the quality. The audio quality for FAAC is in percent, so 100% is the default and higher means better.


In your specific case, all requirements are met, except for the number of audio channels. You have 5.1 audio and need to convert it to 2.0 stereo. We therefore copy the video bitstream and change the number of audio channels using the -ac option:

ffmpeg -i input.mp4 -c:a libfaac -q:a 100 -ac 2 -c:v copy output.mp4

Change the highlighted parts depending on what encoder you haveā€”some FFmpeg versions might not bundle FAAC, so you could use the built-in encoder as well:

ffmpeg -i input.mp4 -c:a aac -strict experimental -ac 2 -c:v copy output.mp4

If you get an error about FFmpeg not being able to downmix 6-channel audio to 2-channels, what you have to do is extract the raw audio, then downsample it with FAAD.

ffmpeg -i input.mp4 -c:a copy audio-6.aac

Then, downsample to a PCM stereo WAV file:

faad -d -o audio-2.wav audio-6.aac

And remux it into the video you have. This will not re-encode the video, so it'll retain your original quality, but we'll have to encode the audio again. If you don't have libfaac, see above for the built-in alternative method using aac.

ffmpeg -i input.mp4 -i audio-2.wav -c:v copy -c:a libfaac -map 0:0 -map 1:0 output.mp4

If the video still doesn't play, you could try re-encoding the whole thing again.

Related Question