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.