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"
Sean Aldrich said,
May 15, 2007 at 11:03 pm
OK, it’s been a while since I wrote that and I have a newer version running now. It excludes a few more file types and changes the video encoding to MPEG4, which seems to end up producing better quality video on the PPC.
@echo offREM 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 norecode
echo %1% | find /I ".wmv"
if %errorlevel% == 0 goto norecode
echo %1% | find /I ".wma"
if %errorlevel% == 0 goto norecode
echo %1% | find /I ".avi"
if %errorlevel% == 0 goto norecode
REM convert to AVI so media player recognizes it
mencoder.exe %1 -o %1.avi -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300 -vf scale=320:-3
:norecode
exit
If you find a better setting, please post it!
Sean Aldrich said,
May 15, 2007 at 11:05 pm
I should also mention that I solved the part about adding the files to a playlist by simply creating an “Auto Playlist” in Windows Media Player.
I have my podcasts going to a separate folder from my music, so I had to add it to the list of folders to search for new files under Library / Add To Library. Then I just created an auto-playlist called “All Podcasts” and added a filter of “Filename contains” and the name of the folder. WMP seems to find the new files and sync them up very nicely.
Note that for video podcasts you have to change it from “Music in my library” to “Video in my library” when creating the auto-playlist. I created one called “All Video Podcasts” and just put them together.
The only glitch seems to be that sometimes it gets confused when Juice expires the podcasts and deletes the files. I’ll end up with a couple of items on the playlist that aren’t there anymore and show up with exclamation points. Doesn’t bother me, though, cause it seems to fix itself next time I sync.
Scott said,
October 23, 2008 at 7:27 pm
Excellent, Sean. This is exactly what I was hoping to find. Thanks for sorting this out for the rest of us. I’ll let you know how it goes. Cheers.