05.15.07
Repost from old blog: Video Podcasts for my Pocket PC
I’m working on a script that would allow me to subscribe to video podcasts intended for playback on an iPod. I have a Cingular 8125 Pocket PC with Windows Mobile 5.0. (This model is also known as the HTC Wizard.)
The main problem is Windows Media Player. The only automatic way to synchronize media to a Windows Mobile device is to use WMP and MS ActiveSync. Windows Media Player is very restrictive about what it will play and even more restrictive about what it will sync. The mobile version will only play a few select types of media. There are third party programs for the PPC that will play .MOV and .M4V files, but how do you get them on the device without dragging them there manually?
So far the only solution I have come up with is to transcode. I’ve created a batch file that runs mencoder (from the mplayer project) to transcode the video files into .AVI’s. I can then add the files to a playlist and WMP will sync them to my PPC, but only after converting them again to WMV’s. I know what each transcode causes a loss of quality, but I’m encoding at such a low quality setting that it’s not noticeable. My script works pretty well with one part missing: How do I add the resultant files to a WMP library/playlist as part of the batch file?
I’ve been scouring Google with no results that make sense. Microsoft wants me to program with complicated object models and such just to add a file to a playlist. I’m currently using Juice for podcast aggregation, so I was considering a quick look at the source code for how it adds the items to the playlist… Problem is I often have trouble with Juice not properly updating the WMP playlists so I think whatever method they are using is broken to start with.
Here’s the batch file. It’s pretty simple/crude. Anyone have input?
@echo off
REM Video Podcast conversion script, by Sean Aldrich
c:\
cd "C:\Program Files\mplayer\"
REM check to see if it's a video file
echo %1% | find /I \".mp3\"
if %errorlevel% == 0 goto notvideo
REM convert to AVI so media player recognizes it
mencoder.exe %1 -o %1.avi -oac mp3lame -ovc lavc -lavcopts vcodec=wmv2:vbitrate=300
REM add to playlist so media player will sync it
:notvideo
FYI, If you try to set this up with Juice there seems to be a problem with quotes in the “Run this command after each download” text box. It will only tolerate one set of quotes. I had to use this method so that my quotes would allow spaces in the podcast path:
c:\progra~1\mplayer\vrecode.bat "%f"