BBC mp4 on Palm TX How (not) to

April 22nd, 2007

Have I got news for youIn these Web 2.0 days, I watch less and less TV – in fact the only programme I watch regularly is the satirical news quiz Have I got news for you on Friday nights. This week they announced that there was a downloadable version with extras, so I decided to I’d download it and watch it on the Palm TX I bought with some bonus vouchers from work last year.

So, no problem, I downloaded the clip – an 18.4Mb mp4 – onto an SD card (note: the Palm expects to find files in \DCIM). The Palm didn’t like it: “Unable to display this video. It may be too large, corrupted, or stored in an incompatible format.

A hunt around the Palm site and found this page which showed me that .mp4′s are not supported. I’ve just done a fresh install of Ubuntu 7.04 on this laptop, so it’s a bit light on applications, but a quick Google suggested mencoder might do the trick of converting an mp4 to something supported.

Now, I don’t want to get a PhD in video encoding technology, I just wanted to convert an .mp4 into something the TX will recognize. The mplayer documentation is clearly intended for the aspiring PhD. No problem, I thought, let’s find an Introductory Guide. It told me to try:

mencoder hignfy-videopodcast_20070420-2100_40_st.mp4 -o hignfy.avi -ovc lavc -oac lavc

which didn’t look too painful, except the 18.5Mb .mp4 expanded to a 70.1Mb .avi. Unfortunately, the Palm gave me the same error message (although it played fine in totem in Ubuntu). Reading the manual further (the bit I didn’t want to have to do) it explained that specifying a .avi container was one thing; specifying what goes in the container is something else. Maybe I was putting an mp4 file in a .avi box. Or a wolf in sheep’s clothing. Or something.

Going back to the PhD manual, it suggested for creating an MPEG-1 file suitable to be played on systems with minimal multimedia support the following incantation (let’s call it spell #1):

mencoder hignfy-videopodcast_20070420-2100_40_st.mp4 \
-of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \
-o hignfy.mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

and amazingly it worked (once I’d corrected a minor typo in the documentation). Now why didn’t I think to type that in in the first place :-) Two minor problems: the picture is a wee bit dark, and the mpg file is five times the size of the original mp4 (97Mb).

Further on, the documentation suggests an alternative spell (spell #2):

mencoder hignfy-videopodcast_20070420-2100_40_st.mp4 \
-o hignfy.mpg -ofps 25 -vf scale=352:288,harddup -of lavf \
-lavfopts \
format=mpg:i_certify_that_my_video_stream_does_not_use_b_frames \
-oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vrc_buf_size=327:keyint=15:vrc_maxrate=1152:vbitrate=1152:vmax_b_frames=0

which also worked, with a slightly smaller file (93Mb). This time the audio track was slightly out of synch with the video, so bigger isn’t always better… So, back to the spell #1 and see I can create my own spell and reduce the file size by using an mp2 format (spell #3):


mencoder hignfy-videopodcast_20070420-2100_40_st.mp4 \
-of mpeg -mpegopts format=mpeg2:tsaf:muxrate=2000 \
-o hignfy.mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg2video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

Well, this time the file was 97Mb, and the Palm couldn’t read it. So, back to spell #1, and see if it worked without all those options (spell #4):

mencoder hignfy-videopodcast_20070420-2100_40_st.mp4 \
-of mpeg -mpegopts format=mpeg1 -o hignfy.mpg \
-oac lavc -ovc lavc -lavcopts vcodec=mpeg1video

This gave a better file size of 71Mb; it worked, but still had that annoying time lag.

So, by this stage it was patently obvious I had’t a clue what I was doing; I was also getting “are you still messing on that computer” messages coming through the ether; so I decided to settle for spell #1.

I don’t know what I’m doing, but it works for me.

Here endeth today’s reading from the book of open source.