torstaina, heinäkuuta 27, 2006

iTunes plays Divx videos but does not stream

(Written in English in the hope of reaching a wider audience than my normal scribblings.)

I was trying to get iTunes to play Divx encoded videos. I thought it might be nice to grab the Windows laptop with iTunes and have it play streaming videos over the wlan from my Mac. I could then take the laptop to the sofa, on the balcony or perhaps on the grass on the front of the house.

The problem was that I could not add the Divx videos to iTunes library. Apparently iTunes only wants to include videos in the Apple standard formats (even if QuickTime Player plays Divx.)

The trick to go around that is to open the Divx video in QuickTime Player and export it as a QuickTime media link file. This is a small (4 - 8 kB) file that only points to the original file. Now iTunes will happily import the link file into its library and it plays nicely.

(By the way: The export as QuickTime media link file only works if you have purchased QuickTime Pro. Fortunately the QuickTime Player can be cajoled to perform the function by asking it nicely via AppleScript. I managed to do it for one video with a script with hard-coded pathnames. My AppleScript knowledge does not yet allow me to make a general-purpose utility that processes a multitude of files and exports them with nice file names.)

Now I can see the QuickTime media link file over the network on the Windows laptop but the laptop refuses to play that file. Bugger. It might be because the laptop does not play Divx videos even from the local disk.

I fell back to using brute force and converting the Divx videos to .mov videos. FfmpegX will do that for you, pretty easily. It just takes time to transcode the video, not to mention some loss of quality.

The next hurdle I discover is that streaming videos from iTunes to iTunes does not always seem to work. On the Mac I have in my iTunes library a couple of music videos purchased from iTunes Music Shop. They start playing immediately when I double-click on them in iTunes on the Windows laptop. In the playback window I can see the video being streamed while it plays.

The same happens for couple of MPEG-1 music videos I have imported from my CDs.

But when I try to play videos that are .mov files, either converted from Divx or video podcasts in my library, they do not stream. The Windows iTunes application hangs for a long, long time and when it finally recovers, it starts playing the video but it seems to have been fully downloaded before playback started.

This has left me with such a bad taste in mouth that I started investigating if I could use VLC instead of iTunes. It seems to sort-of-work:

I set up the Mac VLC player to be a streaming server (using HTTP) and on the Windows laptop I tell VLC to play from an HTTP network stream. It works, except the playback pauses every minute or so for 5 seconds and drops those 5 seconds of video before commencing.

Could it be that my wlan is not fast enough for streaming Divx? Or perhaps there is some weirdness in the VLC HTTP transport. They do not recommend using it but it is the only transport that does not require me to modify the firewall of the Windows laptop, which I cannot do because the laptop is owned by my employer and the IT department has seen it fit to disallow doing that.

It is now after 4 in the morning and I think I'll continue this later.

Ei kommentteja: