Wednesday, January 02, 2008

play movies on xbox 360

So, you have got a Xbox 360. And you are tired of playing games on it. You would also like to use it as a Video and Audio player. Hmmm... Audio player is cool. Just plug in a USB pen drive with your favourite songs and playlist and play them out...

But what about video. Every Time you want to play a video, you have to "rent/buy/borrow" a DVD and play it. Do you have movies (DIVX/Avi) on your laptop and you wish you could play those movies on the XBox and enjoy the movie on your home theater.

Here is the ultimate solution.

The recipe requires you to have a linux (i am using ubuntu here. But you can use any flavour of linux) loaded pc with a net connection. A USB mass storage drive (pen drive or hdd). And an Xbox 360 - ofcourse.

The commands here are for ubuntu gusty. If you are not using ubuntu, then you will have to get the source and compile the files for yourself.

The magic software over here, which does our work is ffmpeg.

So what do you do???

  • download ffmpeg.
    svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

  • Get the required libraries
    sudo apt-get install libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libdts-dev liblame-dev lame
    In case you are running something other than ubuntu, then please google for the libraries and install them from source.

  • compile
    cd ffmpeg
    ./configure --enable-gpl --enable-pp --enable-libvorbis --enable-liba52 --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libxvid
    make
    sudo make install

  • choose the movie you want to convert into Xbox - playable format
    cd I.Am.Legend

  • convert the movie to wmv format
    ffmpeg -i I.Am.Legend.XviD.avi -vcodec wmv1 -acodec wmav2 IAmLegend.wmv
    This will take some time

  • Copy the movie into the USB device

  • Plug the USB drive into your Xbox 360.

  • Play the movie and enjoy



But, you would say, the picture quality is not that good. What happened to the picture quality and the sound. It was better on the lappy.

check out this information:

jayant@jayantbox:~/movies/I.Am.Legend$ ffmpeg -i I.Am.Legend.DVDSCR.XviD-THS.avi -vcodec wmv1 -acodec wmav2 IAmLegend_bad.wmv
FFmpeg version SVN-r11364, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-libvorbis --enable-liba52 --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libxvid
libavutil version: 49.6.0
libavcodec version: 51.49.0
libavformat version: 52.3.0
built on Jan 1 2008 22:13:58, gcc: 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (24000/1001)
Input #0, avi, from 'I.Am.Legend.DVDSCR.XviD-THS.avi':
Duration: 01:41:23.5, start: 0.000000, bitrate: 966 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 640x272 [PAR 1:1 DAR 40:17], 23.98 tb(r)
Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s
Output #0, asf, to 'IAmLegend_bad.wmv':
Stream #0.0: Video: wmv1, yuv420p, 640x272 [PAR 1:1 DAR 40:17], q=2-31, 200 kb/s, 23.98 tb(c)
Stream #0.1: Audio: wmav2, 48000 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 3473 fps=274 q=10.0 Lsize= 5014kB time=144.9 bitrate= 283.6kbits/s


Here, you could see that the audio and video bitrate has been reduced from 128kb/s to 64kb/s and 966 kb/s to 283.6kb/s respectively.

To get the same quality, all you have got to do is match the output bitrate with the input bitrate. So when we convert the movie from avi/divx to wmv, we need to pass arguments so that the bitrate for audio and video remain the same. So lets do that.

ffmpeg -i I.Am.Legend.XviD.avi -vcodec wmv1 -acodec wmav2 -b 989184 -ab 131072 IAmLegend_gud.wmv

Remember: the bitrate is put here in bytes so 989184b/s = 989184/1024 = 966kb/s. And 131072 b/s = 131072/1024 = 128kb/s.

To identify the source bitrates, just do:

jayant@jayantbox:~/movies/I.Am.Legend$ ffmpeg -i I.Am.Legend.DVDSCR.XviD-THS.avi
FFmpeg version SVN-r11364, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-libvorbis --enable-liba52 --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libxvid
libavutil version: 49.6.0
libavcodec version: 51.49.0
libavformat version: 52.3.0
built on Jan 1 2008 22:13:58, gcc: 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (24000/1001)
Input #0, avi, from 'I.Am.Legend.DVDSCR.XviD-THS.avi':
Duration: 01:41:23.5, start: 0.000000, bitrate: 966 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 640x272 [PAR 1:1 DAR 40:17], 23.98 tb(r)
Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s
Must supply at least one output file


So, now relax. No need to go to the nearby DVD rental shop. No need to purchase DVDs. If you have got a good quality movie on your computer, you can play the movie on your large screen TV and home theater and enjoy...

3 comments:

wmv videos to mp4 osx said...

Nice post. although i have no xbox360, i am always using ffmepeg on my Mac to convert video files.
thx.

Unknown said...
This comment has been removed by a blog administrator.
computer monitoring said...

your solution for enjoy movie on xbox360 work well for me. thank you very much.