At first I made some conversion experiments using ffmpeg (I like it more than mencoder), but all the movies it converted had the problem of skipping the last 6/7 seconds of the video, as they were played on the Zen.
After some searching, what I came to is that this is due to ffmpeg producing always VBR videos (variable bitrate), instead of CBR (constant bitrate) ones, which the Zen requires. If someone knows a way to make ffmpeg produce CBR movies (it seems to not work setting minrate and maxrate to the same value), please post here how to do it.

Due to this problem with ffmpeg, I used mplayer/mencoder.

Note: during my last experiments with gnomad2, I verified that the movie length doesn't get transfered along with the movie on the Zen, making it impossible to pause a video and resume playing it back at a later time from the same position it was at. Instead, the movie length is correctly transfered along with the movie if you use the Windows software which comes alongside with the Zen.

Description

This script is able to convert one or more movies from any video format to a Zen-compatible AVI format, but is not restricted to only that. If you modify it, you can adjust it to your own transcoding needs. For example, you can adjust it so it can re-encode a bunch of movies so that you can play them on your DVD-Divx player attached to the TV etc.

The encoding process is made in 2 pass.

You can use this script alongside my other script to display the progress of the encoding process. You can find it here.

Current version

Current version is 1.02, released on 02/10/2008 (date is in dd/mm/yyyy format).

Dependencies

GNU Bash

In order to execute the script.

Mplayer/mencoder

Used to encode. It must be compiled against the lame library, in order to encode audio tracks in mp3 format.

awk, grep and other programs

They're used to gather/elaborate information. An initial check inside the script looks for them and, if one's missing, it alerts you.

Configuration

Inside an appropriate section (Editable Section) of the script there are some parameters, which are already set to the right values to produce Zen playable movies. In case you need this script to encode movies which are not to play on the Zen, you probably just need to adjust only these parameters.

RESOLUTION

The desired resolution. The display of the Zen has a 320x240 pixel resolution. To the conversion extents, only the X resolution will be used, because the Y resolution will be automatically determined by mencoder, in order to preserve the aspect ratio of the original movie.

EXTENSION

Contains the extension of the file to be produced. It's set to "avi" by default.

ARATE

Contains the audio bitrate in thousands of bits per second (kb/s). Only in case the movie needs a great audio quality (live performance, musical video), it should be set to 128 (kb/s). Otherwise, you can set it to 64 or 32.

OUTDIR

Points to the folder in which the converted movies will be put. If you don't declare it as an enviroment variable before you fire up the script, it will be set to "~/ZenOut", where ~ means the user's home folder. If this folder doesn't exist yet, it will be created.

MAXFRAMERATE

Contains the maximum framerate which the destination target supports, in frames per second (fps). The Zen supports movies with a framerate up to 30 fps. If the source content has a greater framerate, it will be set to the value contained inside this variable during the encoding process.

FOURCC

Contains the FOURCC to force in the converted movie header. The Zen requires the FOURCC to be XVID, but most Divx players requires it to be DIVX, DX40, DX50 etc. For a list of the available FOURCCs, see here.

VCODEC

The video codec to use. By default it is set to mpeg4, in order to use the libavcodec library and its options. If you change it to "xvid" or something else, you'll have to adjust the encoding parameters used below by the script.

BITRATE

The video bitrate to use, in bit per second (b/s). The Zen supports videos with a bitrate up to 1 Mb/s.

LOGFILE

Points to the log file which will contain error messages (if any) and other info.

PROGRESS_SCRIPT

Contains the name of the script to use to display the progress of the conversion. If it's set and it's contained inside the PATH, it will be used. Otherwise mencoder's output will be shown with no filter on standar output. If you want to use my script, go here.

Installation

You just need to put the script inside a path contained in the PATH enviroment variable, and grant it execution permission. I suggest to create a folder (bin, for example) inside your home folder and put it in your PATH, editing/creating the ~/.bashrc and ~/.bash_profile files with the following

export PATH+=":~/bin"

Changelog

1.00

initial version of the script.

1.01

fixed a little error regarding the progress script.

1.02

fixed a little error which prevented files with spaces (' ') inside their name to be correctly saved;

fixed some strings inside the log file.

Feedback

If you've got something to say/report, please do it here. It's an italian Slackware forum.