Convert mp4 video to a format xbox 360 can play
Solution 1
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.
Solution 2
I've been trying to do the same as the original poster. For whatever reason I didn't have any luck getting the instructions in slhck's answer to work. Maybe because my work laptop has ubuntu, which has replaced ffmpeg
with avconv
.
Anyway to cut a long story short, I gave up on using a command line solution and installed handbrake
and converted the files using the Universal
preset. This produced correctly formatted files in the mp4
format, but gives them m4v
extensions. Rename the files to give them mp4
extensions. It means the same thing, but the xbox doesn't know that and will only read them if the extension is mp4
.
Related videos on Youtube
Björn Lindqvist
There's a little too many busy beavers on superuser.com who likes to close perfectly valid and precise questions...
Updated on September 18, 2022Comments
-
Björn Lindqvist almost 2 years
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
-
Björn Lindqvist over 11 yearsThanks. It almost works when I use
avconv
instead offfmpeg
. But then I get the error: Can not resample 6 channels @ 48000 Hz to 2 channels @ 48000 Hz -
Björn Lindqvist over 11 yearsThanks but still no dice. Now I'm getting a different error on your last command:
[mp4 @ 0x12aea20] Tag [1][0][0][0]/0x00000001 incompatible with output codec id '65536'
-
slhck over 11 yearsHm. I'm giving up. If I only had an Xbox to try with I'd surely help you, but as far as I can tell the file seems valid. Do you have other videos that actually play on the Xbox? We could take a look at what's different. Did you try re-encoding the (stereo audio) video bitstream as well, maybe even with
ffmpeg -i input.mp4 -c:v libx264 -profile:v baseline -c:a copy output.mp4
? This would give us a video stream with a lower profile. Although the Xbox supports up to High, this could be an issue as well. Or a file with no audio (-an
option). At least we'd know if it's the video or audio part. -
Björn Lindqvist over 11 yearsYes, I've lots of other videos that play fine. But with mp4 it's definitely hit and miss. Some mp4's work, but most don't. Reencoding like in your example command has already taken 24h and I don't think it ever will complete. Plus the ffmpeg status line reads
frame=19313100 fps=233 q=33.0 size= 6625618kB time=214.59 bitrate=252934.5kbits/s dup=19307954 drop=0
and I think the "bitrate=252934.5kbits/s" part means it is doing something really insane. If there was a way to reencode this file to a more friendly format, I'd definitely use that instead but nothing I've tried with so far has worked. -
slhck over 11 yearsIf it's just a regular movie and it takes more than say half an hour, there's something wrong (bit error?) with the source video. You could try re-encoding with
-c:v mpeg4
, which should be compatible with the Xbox as well, but you need more bitrate to accomodate for the worse performing codec. Or try converting to an intermediate lossless format like Huffyuv into an AVI, and then back to x264. Just to be clear: Does the file play normally on your computer? -
Björn Lindqvist over 11 yearsNot sure how you suggest that I should reencode it?
avconv -i in.mp4 -c:v mpeg4 -profile:v baseline -c:a copy out.mp4
does not work. The original video plays without any trouble in both mplayer, totem and other players. -
slhck over 11 yearsIf you say it "does not work", what exactly happens? Does the command itslelf not work or does the video not play?
-
Björn Lindqvist over 11 yearsWhat I mean is that avconv doesn't accept the command, it says
[mpeg4 @ 0x1373ca0] [Eval @ 0x7fffba481e00] Undefined constant or missing '(' in 'baseline' Unable to parse option value "baseline"
-
slhck over 11 yearsThere's no baseline profile for MPEG-4 Visual. Simply leave out the
-profile:v baseline
. You can add the option-qscale:v 3
for quality (lower means better,qscale
goes down to 31).