/mceDivX360

Stream DivX movies to your XBox 360 using MediaCenter

http://www.brains-N-brawn.com/mceDivX360 1/13/2006 casey chesnut

comment(s) 

NOTE this article is now only useful for developers. if you just want to stream DivX, then i recommend Transcode 360. this was my hope from the beginning, because it frees me up to work on different stuff.

Introduction

this article shows how to stream DivX (and XviD) movies to an XBox 360 using a Media Center. for the picky people, it doesn't actually stream DivX ... it converts to WMV on the fly to stream. the core process for accomplishing this is taken from a thread found on the XBox forums : Playing DivX movies without having to Re-encode, through media centre. and this might be the original post (in German) : Divx mit Mediaencoder auf die Xbox360 streamen!, so they get credit for pioneering this approach. it works fine, but has the disadvantage that you have to manually set up the encoding process on your Media Center and then move over to the XBox 360 to watch it. so all this article really does is provide an MCE interface so you can control everything from your XBox 360 being used as an MCE Extender. i.e. its for lazy people. it was also an excuse for me to write a ListMaker AddIn for MCE ... which i hadn't done yet. not to mention my MCE setup doesnt have a TV Tuner and only has 32 megs of video RAM, so i cannot play video on it at all :(

NOTE this is not a mod solution or an xbox 360 hack. this works purely using the extensibility points of Media Center and freely available tools from MS. i.e. no warranties will be voided. and when Vista MCE comes out, we'll be able to radically improve this. aren't APIs wonderful? also, i don't have the hardware to test it, but supposedly this will work with the original XBox and Media Center Extender add-on.

have to say that the limited edition remote absolutely sucks. bought the Universal Remote and its pretty crappy too, but with backlit keys and more buttons. my old MCE remote can work with the X360 too, and it seems to work slightly better. the wireless controllers are much more reliable. i'm thinking that MS should make a remote that uses the same tech as the wireless controllers.

ASX

first, i created the _MediaEncoder.asx text file with the line mms://COMPUTER-NAME:8080. NOTE you can use an IP Address to the Media Center Computer too. this file goes in your 'My Videos' file and it is what you use to view whatever is being streamed using Media Encoder.

you can also tweak the ASX file a bit to include a thumbnail image (just add both to your 'My Videos' folder). download below

Media Encoder

second, i downloaded and installed Windows Media Encoder 9 and the Windows Media Encoder 9 SDK. with the ASX file and the WM9 Encoder installed, you can manually test to see that it works with the files that you are interested, and to judge quality etc... NOTE the code below streams to port 8080, so no other program can be using that port. if you change it do a different port, then you need to change the .asx file as well. this will create an error in the log file that looks like : An attempt to acquire a network resource failed.

Codecs

originally, i had the ffdshow codecs installed, but it was not working with Media Encoder. from the thread above, i switched to DivX 6.1 and AC3 1.01a RC5. if you've got a file that won't play, first make sure you can play it with Media Player. then try to stream it manually with Windows Media Encoder. this makes it easier to experiment with different codecs. the GSpot Coded Information Appliance also comes in handy. also, see the 'Extended Windows' and 'Permissions' sections below.

NOTE i did not try any HD DivX movies because it requires a 64 meg video card which i don't currently have. a buddy of mine did try to stream HD on his newer system and it worked fine after he adjusted the profile to reduce the resolution to encode to. it will stream DivX with Advanced Features too (e.g. Revelations : Star Wars), but it just plays the menu sequence and you cannot interact with it

Encoder Profile

third step was to create a higher quality encoding profile that the end user can tweak and can be referenced from code. created this with the 'Windows Media Profile Editor' which is either installed with Windows Media Encoder or the SDK. named the file DVD_Quality_Video.prx which needs to be placed in the folder : C:\Program Files\Windows Media Components\Encoder\Profiles\. if the profile is not placed in that location, then the code will fail over to a lower quality profile. you can modify the profile to improve or reduce the streaming quality. e.g. you might switch from Constant Bit Rates to Variable Bit Rates.

NOTE i changed the Video size to 'Same as video input' and let the XBox do the scaling to fit the TV. this works for me, but if you have files with a really high resolution, then you'll need to reduce the quality to avoid skipping (e.g. anything over 720x480 might be too big to encode on the fly)

ListMaker

the fourth step was to automate the process through MCE in a manner that works over an XBox Extender. the main part of the UI involves a type of MCE AddIn called a ListMaker. the ListMaker provides the UI to select the video(s) that you want to view, and then it kicks off some process. for this app, the processing just uses the Windows Media Encoder SDK to automate streaming of a video file (or a series of video files). to install, see the 'Source' section below

Extended Windows

DivX 6.1 did give me some other problems though, because it was trying to open a window ... which a Media Center Extender session does not allow. to get past this i ran the 'DivX Toolbar Toggle Tool' to turn it off. you can tell if you have this problem by checking the Event Log for Applications. it will look say something like 'Unauthorized window was detect while running the Media Center Experience, '', with file name 'C:\WINDOWS\system32\DivXsm.exe'. the MS AntiSpyware Beta had this same problem. looks like some other people have run into it too. hopefully this will be fixed when MS AntiSpyware is released

Usage

after everything is installed (detailed above), go to your XBox 360 and start a Media Center Session. then go into 'More Programs' and select the /mceDivX360 icon. NOTE the adultdvdempire icon next to it ... that's called research :) er, um ... i have to see how other people are developing MCE Add-Ins. going to have to try and write off a dirty movie this year

this will bring up a display asking for a list name, currently 'Untitled'. the list does not get saved, and the list name does not matter, so just click 'OK'. i wish there was a way that i could bypass that screen altogether, but it doesn't look like i can.

then it will display the 'My Videos' folder which you can drill into to select which videos you want to be streamed. NOTE you can select multiple videos to play back to back. after selecting the videos, click 'View List'. NOTE wish i could remove the 'Select All' button or add an 'Unselect All' button

the next screen will show the list of videos to stream. you can change the order and remove videos from the list here. finally, click 'Stream List' to start Media Encoder in the background. NOTE when selecting multiple files, make sure they are all of the same aspect ratio, else they will be distorted. NOTE wish i could remove the 'Change Name' button

this will bring up a dialog with a progress bar. NOTE that the progress bar will be incorrect for DivX files. alot of times it will just stay at 0% even though it really is streaming. i think it has problems with the codec? regardless, dismiss the dialog by pressing 'OK'. Media Encoder will still be streaming in the background. NOTE wish that i could change the text of that dialog to show that it was streaming, and not copying

NOTE if the progress dialog opens up real quicks and immediately goes away, then you've got a problem and streaming has stopped. first, check the permissions on the file(s) you are trying to play (see below). second, check that you've got the proper codecs installed by trying to stream it manually using the Media Encoder UI from your MCE PC.

now use your remote to exit 'My Programs' and go to 'My Videos'. select the _MediaEncoder.asx file to start watching the stream. NOTE it will take a couple seconds to display as the stream is buffered. NOTE if you do this real quick, sometimes the Media Encoder hasn't fully started yet, and you'll get a 'Video Error'. just select the _MediaEncoder.asx again and it should work the 2nd time.

wish that i could automatically redirect you to the 'My Videos' screen, but the ListMaker Add-In does not provide access to the Host in the same manner that other MCE AddIns do. tried to send the corresponding keystrokes for that remote event too, but the Media Center Extender user account can only be controlled by remote control commands. having a reference to Host would have been nice to let me popup my own dialog for exceptions too.

when the stream is complete, it will display a dialog asking if you want to process the list again. if you click 'Create' then it will start the video streaming again. else you can just click 'Done'. NOTE wish that i could change the text of that dialog

if you want to exit the stream, then just back out of 'My Videos' and go to 'My Programs' and select the /mceDivX360  icon again. this will bring up the progress dialog again, allowing you to stop the stream. NOTE if the video is still playing in the preview window (bottom left), then it will take a couple seconds for it to stop, because of the buffer. after stopping the stream, you can reselect the /mceDivX360 icon to choose a different video to stream. NOTE wish that i could change the text of that dialog.

Permissions

one other problem i had was with file permissions for some files in 'My Videos'. this is for any file type, not just DivX and XviD. even without streaming, i could not play some .wmv files and they were giving me a 'Disk Error' screen. and when trying to stream a DivX or XviD file using the AddIn above, it just opens the progress dialog for a second, and then immediately closes it. the problem was that the media center extender user account was not getting permission to view these files. what i had to do was manually select these files as a group and then view their properties - security tab. this would pop up the dialog below

say 'Yes' to that dialog, and the file permissions should end up looking like the following. because this was getting annoying to debug, the AddIn now writes a log file to : C:\Documents and Settings\All Users\Documents\mceDivX360.txt. look for the name of the file that did not play and this exception text : System.UnauthorizedAccessException: Access is denied.

Version 2 Update - 1/21/06

Progress Bar - this now uses the Media Player SDK to get duration and resolution of video files. so now the progress bar will work for DivX/XviD files. it previously was stuck at 0% all the time.

More Logging - extra info is now written to the error log. NOTE the file name is no longer written to the file (for privacy)

Multiple Profiles - there are now 3 profiles (pass through, reduced widescreen, and reduced fullscreen). these coincide with a registry setting for when to reduce quality. the problem from version 1 is when people were trying to stream videos with a high resolution, there would be frame skipping because the real time encoding could not keep up. so now it checks the registry setting and compares it to the resolution (width * height) of the source video. if the source video is lower, then it uses the pass through profile. it it is higher then it uses one of the reduced profiles (reduced fullscreen or widescreen) based on aspect ratio. if you set the reduced quality cut off setting to 0, then the source will always be higher, so the pass through profile will never be used. if you set the reduced quality cut off setting to a high setting (2147483647), then the source will always be lower, so the pass through will always be used (like version 1).

e.g. the default cut off value is 307200 pixels (for 640x480). so if the source file is 800x600 = 480000. 480000 is greater than the cutoff value, so one of the reduced profiles will be used. and since the aspect ratio for 800x600 is 4:3, then the reduced fullscreen profile will be used.

Output Modes - the new output modes (3) are StreamOnly, ArchiveOnly, and StreamAndArchive. NOTE if you end the Extender session while archiving to file is taking place, then encoding will stop the moment you end the session, so you will end up with only part of the video.

  1. StreamOnly - is like version 1 (this is the default registry setting). no reencoded file is written to disk.
  2. ArchiveOnly - will not stream, but it will reencode to .wmv and save to the encode direcory. if the .wmv file already exists, it will be deleted and reencoded.
  3. StreamAndArchive - will stream the file and also save the reencoded .wmv to the encode directory. if the .wmv file already exists, then it will not be archived.

EncodeDir - specifies the directory where reencoded files should be saved to. if the EncodeDir is an empty string, then it will just save to the same directory as the source file and append the .wmv extension to the filename.

SkipMinutes - this is in case you want to restart a movie that you had to stop in the middle. so if you were half way through the movie, set skip minutes to 60, and when you restart streaming it will begin at the 60 minute mark in the movie (instead of starting over at the very beginning). this feature really should have a Media Center Extender UI built for changing it from the XBox.

mceDivX360Config - used to change the (4) new registry settings

Troubleshooting

these are the issues that came up from the first release :

so the rule of thumb is to check the debug file first (C:\Documents and Settings\All Users\Documents\mceDivX360.txt), then try to manually encode the file (to see if Windows Media Encoder gives you an error), finally check the event log ('control panel' - 'administator tools' - 'event log' - 'applications').

if you have other questions, please ask at :

Video

this shows a video of the /mceDivX360 AddIn being used. the DivX format Aeon Flux trailer being played was downloaded from divx.com

 (4 megs zipped)

Conclusion

that shows how to install and use the /mceDivX360 plugin to stream DivX (and XviD) videos from your Media Center PC to your XBox 360. so now you can watch all sorts of porn (not hot coffee) and bootlegged movies on your XBox 360. this is a little trickier then i wanted it to be. the user has to be particular about what codecs they have installed, apps that might interfere with a Media Center Extender session by opening a window, and they have to make sure that file permissions are correct for the videos they want to view. the good news is that the quality is great and i haven't experienced any skipping. the network usage isn't that bad either, because i've been testing it on an 802.11g network. both the MCE box and XBox 360 are wireless with 'Very Good' to 'Excellent' connections.

Source

if you have version 1, please try to uninstall it before installing the new version.

here are the the steps for running the installer (source code is below)

if you use the installer, make sure you change the radio button to 'Everyone', else it will not be visible to the XBox 360 Extender

this is what the installer does

here are the steps for installing with install.bat (or deploy.bat) and the source code. NOTE that the code is for VS.NET 2003, .NET 2.0 is not currently supported by MCE.

Updates

released 1/13/06. updated 1/21/06. probably won't do anymore updates until Vista MCE comes out. in the meantime, you are welcome to take over the code

Alternate Solutions

if you don't like streaming or are having problems with performance, then you can convert your files using software like the Videora XBox 360 Converter. it takes some time to convert and the files will be larger, but it works great from the couple videos i tried out. did i mention its free!

and after you convert the vids, you can use bits from the kiosk disk (bittorrent) to burn them to a DVD which can be played on the X360.

advantage to the streaming approach is you don't have to wait for the entire video to be encoded before watching it, nor do you create a 2nd (larger) video file to manage. disadvantage to the streaming approach is that you don't get to fast forward or rewind. you can pause by pressing down on the right button ... but just not for that long. haven't been able to use it that long, but i paused a movie for about 30 minutes and when i came back it played for about 5 minutes, skipped 3 times back to back, and then it skipped about 8 minutes forward in the stream to start playing again.

also, if you like petitions, then there is a Divx Petition for the Xbox 360 , which would make this AddIn unnecessary and provide a better user experience

Future

no clue what's next? later