Anatiferous blog | Move every zig.

Meta-Site

Welcome to Anatiferous: Using barnacles to make geese since 1689!

Howdy! This is my (William Reading's) webpage. At the moment, I only have this blog script and my gallery up, but I hope to get more stuff on this page at some point, or so I thought when I created this site years ago. Updates and shiny new copy to eventually go here. If you'd like to contact me to point out that I've done something to break XHTML/CSS standards or heaven forbid--look at my Vita--drop me a line at my e-mail address bill +spam @ [ELEPHANT] aggienerds.org. Simply remove "+spam", the spaces and the pachyderm along with its brackets and that address will reach me. I'm also available on Jabber/GChat/AIM/MSN with the same address above.

10/13/2009

Playing Video on the XBox 360 Over the Network

Filed under: — bill @ 4:38 am

In my last post, I talked about how I’d converted an AppleTV into a Linux server. Once I packed up the server with media, the next thing that I wanted to do was deliver it to the living room via my XBox 360. There’s a few problems with getting this to work:

  • The XBox 360 only recognizes shares as a Windows Media Center Extender, from the Zune software and via UPnP Shares
  • The XBox 360 is picky about the codecs that it plays in what container: December 2007 Video Playback FAQ
  • Getting my share exposed via UPnP is straightforward enough, I can use UShare to share it out. Astute readers will observe that while UShare supports both UPnP and DLNA, we only need UPnP for use with the XBox, so we eliminate a lot of the headache of compiling it under Debian by supplying “–disable-dlna” as an argument to the configuration script. Also of note, “libupnp3-dev” is used in Lenny to satisfy the libixml requirement, as unintuitive as that may seem. As an aside, if we use libupnp4-dev, it fails to compile. The remainder of the configuration is left as an exercise to the reader, but “ushare -x” is a reasonable way to get started.

    The second problem involves the codecs supported by the 360. We’d really like to minimize transcoding wherever possible because it is computationally expensive, and typically means a loss of quality. However, we see that only the most common codec pairings are supported by the XBox. For the special cases, we can still play them on the XBox by using ffmpeg to do a stream copy and then transcode the audio.

    The wrinkle to doing that on Debian revolves around codecs. If we’re say, given an h.264 file with an mp3 audio track, we find that we cannot play it because h.264 with mp3 is not a supported configuration. We must pair AAC with h.264, but ffmpeg on Debian doesn’t ship with an AAC codec by default. The solution is to use the Debian Multimedia repositories. Once we’ve installed an ffmpeg from that, it becomes far easier.

    Now we can pull the trick to fix the above file up for playback using AAC:

    ffmpeg -i input-h264-mp3.avi -vcodec copy -acodec libfaac -ab 128kb -f mp4 output-h264-aac.m4v

    Update: I spoke too soon above. AVI and MP4 containers use different conventions for how to store certain things, and simply copying the stream like above seems to work until you play the video. For now, we follow the process (slightly tweaked) described in Using MEncoder to create QuickTime-compatible Files:

    mplayer video.avi -dumpaudio -dumpfile video.mp3
    mplayer video.avi -dumpvideo -dumpfile video.h264
    ffmpeg -i video.mp3 -acodec libfaac -ab 128k video.aac
    mp4creator -create=video.aac video.mp4
    mp4creator -create=video.h264 -rate=29.97 video.mp4
    rm -f video.{mp3,h264,aac}

    In the above example, I use 128kbit audio, but you can adapt it to whatever is suitable based on the input file. Note that I used .m4v in the above example. If you’re using UShare, you’ll find that the mime types defined only consider mp4 to be an audio file. You can change this by patching up mime.c, but I decided that it wasn’t worth the effort to change and test it if I can just use a different extension.

Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Bot-Check

(required)

(required)

(required)


 

Google
 
Web anatifero.us
aggienerds.org

Powered by WordPress