eRacks Systems Tech Blog

Open Source Experts Since 1999

I recently purchased a Vidego28 handheld MP4 player with a 2.8” display – which is actually a rebranded ONDA VX858 – and discovered that it has very specific requirements for the videos it plays.

The manufacturer provides a Windows binary-only utility for converting your videos to something the Vidego28 can read, but because I don’t use Windows, and because I prefer using the command line for automating these sorts of tasks, I immediately set out to discover exactly what format my videos should adhere to.

Googling around, I found that the videos it plays should be 12bpp XviD encoded AVIs at or below 24 fps (frames per second) with a maximum bitrate (for the video) of 800kbit/s and a resolution of 320×240 (which is the size of the display, in pixels.) I also found that the audio portion of the AVI should be encoded in the MP2 format. Using mencoder (http://en.wikipedia.org/wiki/MEncoder), I cobbled together the following command to do the job, partly from experiment and partly from what I had found in someone else’s blog (all on one line):

mencoder -mc 0 -noodml inputfile.avi -of avi -o outputfile.avi -ofps 24 -vf-add scale=320:240 -vf-add expand=320:240:-1:-1:1 -srate 44100 -ovc xvid -xvidencopts bitrate=400:max_bframes=0:quant_type=h263 -oac twolame -twolameopts br=160

At this point, I had partial success. I was able to take my videos and convert them to a format the Vidego28 could read. The problem was that almost immediately during playback on either my computer or the MP4 player, the audio and video became so out of sync that it was impossible to make use of the files mencoder produced. I spent hours on Google looking for a solution and tweaking the above command, without success.

At some point during my experimenting, I discovered that ffmpeg (http://ffmpeg.mplayerhq.hu/) could produce AVI files as well, and decided to give it a shot. Unfortunately, the files it produced were not in a format the Vidego28 could read, but out of curiosity, I decided to see what would happen if I used mencoder to take the output of ffmpeg and re-encode it per the original command I had tried earlier, since the files ffmpeg produced were in sync when played back on my laptop. To my astonishment, for whatever reason, mencoder was able to output an AVI in which the audio and video remained at all times in sync when played on the Vidego28!

Finally, I decided to write a simple script so that I could automate the process of calling ffmpeg, followed by mencoder, the result of which is listed below:

vidego.bash:

#!/bin/bash
FPS=$1
INPUT=$2
OUTPUT=$3

# Make sure all the required arguments were passed
if [ -z $FPS ] || [ -z $INPUT ] || [ -z $OUTPUT ]; then
   echo
   echo "Usage: $0 [fps] [input file] [output file]"
   echo
   exit 1
fi

# Make sure $FPS is valid
if [ $FPS -lt 1 ] || [ $FPS -gt 24 ]; then
   echo
   echo "error: frames per second should be between 1 and 24"
   echo
   exit 1
fi

# Let's do our stuff!
ffmpeg -i $INPUT -r $FPS /tmp/$OUTPUT

mencoder -mc 0 -noodml /tmp/$OUTPUT -of avi -o $OUTPUT -ofps $FPS -vf-add \
scale=320:240 -vf-add expand=320:240:-1:-1:1 -srate 44100 -ovc xvid \
-xvidencopts bitrate=400:max_bframes=0:quant_type=h263 -oac twolame \
-twolameopts br=160

rm /tmp/$OUTPUT

The above script takes as parameters the desired FPS (which should be between 1 and 24), the source file (which can be any format that mencoder supports) and the destination (the file that will go on your MP4 device). A sample call would look like this:

vidego.bash 24 input.file output.avi

Just copy output.avi to your Vidego28 (or ONDA VX858), and you’ll be good to go!

April 28th, 2008

Posted In: multimedia

Tags: , , , , , , , ,

3 Comments

NOTE: Do NOT install the ports tree during the installation. We’re going to install the latest ports tree (complete with security updates) later on.

*** Step 1: Install FBSD 6.3 or 7.0

1. Insert the CD
2. Choose the standard install
3. When the installation is finished, you’re done!

*** Step 2: Installing the Nvidia Drivers

NOTE: The open source ‘nv’ driver doesn’t work on the GeForce 8 series of cards, so don’t even bother trying.

1. Type the command ‘sysconfig’ and install the ‘compat5x’ package via FTP. This is a pre-requisite for the nvidia driver package.

2. Download the FreeBSD x86 drivers from www.nvidia.com for the GeForce 8 series.

3. Untar, cd to the resulting directory and type the command ‘make install’

4. Type the command ‘nvidia-xconfig.’ You’ll get some errors about Gnome libraries not being installed, but it still manages to create a good xorg.conf anyway.

5. Open /etc/X11/xorg.conf and change the following:

In Section “Input Device:”
Change Option “Device” “/dev/sysmouse” to “/dev/psm0”
Change Option “Emulate3Buttons” “no” to “yes”

6. Test the xorg server by typing ‘startx’ and verify that you get a working display

7. Close xorg and pat yourself on the back for a job well done 😉

*** Step 3: Install the Ports Tree

1. Go to ftp.freebsd.org and download the latest 6.3 or 7.0 ports.tgz file (under /pub/releases/6.3 or /pub/releases/7.0 I believe, but I can’t remember exactly.)

2. Cd to /usr and extract ports.tgz

*** Step 4: Configuring the Soundcard

1. Edit the file /boot/loader.conf and add the line “snd_hda_load=”YES”

2. Reboot and grep dmesg for Realtek. If it shows up, try to play an MP3 to make sure sound is really working.

*** Step 5: Wireless Configuration

We no longer need to do anything. As of FreeBSD 7.0, the wpi driver works by default! Wireless will not work,
however, under 6.3

March 31st, 2008

Posted In: Laptop cookbooks

One Comment

Ubuntu 7.10 Installation on the Micro Express IFL90 Laptop

1. Go into the BIOS by hitting the F2 key during post and make sure it can boot from CD

2. Insert the Ubuntu CD and reboot the system (make sure you use the amd64 version, since Intel's Core 2 Duo is x86_64.)

3. When the install menu for Ubuntu comes up, choose "Safe graphics mode install."  DO NOT try the normal install, or the system will hang.

4. Once the LiveCD is fully booted, you will see a desktop with an icon labeled "Installer."  Double click on it and wait for the installation application to open.

5. You will be presented with a series of questions related to the configuration of the system.  Making sure you setup the proper timezone and the sysadmin username, leave everything else at their default values.  When it tells you it's ready to install, click "ok" and wait for it to finish.

6. When the installation is complete, click on the "reboot" button.  The disk will be ejected, and the system will boot from the CD.

7. When you have booted successfully from the hard drive, and are presented with the graphical login prompt, hit ALT-F1 to drop down to virtual terminal and login as sysadmin.

8. As the sysadmin user, type the command "sudo passwd root."  Enter sysadmin's password when prompted to do so, then enter the root password for the system (eracks.)

9. Logout of the virtual terminal and hit F7 to go back to the graphical console and login as sysadmin.

10. You will be notified that there are updates available.  Go ahead and install them.

11. You will be notified that there are "restricted drivers" available.  Click on the little icon on the top right that looks like a little circuit board and click on the "Restricted Drivers" tab.

12. Make sure the intel wireless adapter is enabled, and also enable the Nvidia accelerated graphics driver.

13. On the system menu at the top, click on "System -> Administration -> Synaptic Package Manager"

14. Install the package "linux-backport-modules."  This is required to make the sound card work.

15. Edit the file /etc/modprobe.d/alsa-base, and add the following line at the bottom: "options snd-hda-intel model=toshiba"

16. Reboot the computer, and make sure to test the wireless adapter and sound card (by playing a sound) 

You're done!

March 31st, 2008

Posted In: Laptop cookbooks

Tags: , , ,

Leave a Comment

How to Install FreeBSD 6.2 on an Acer Aspire 3690

First Step: Install a fresh copy of FreeBSD 6.2

1) Getting the sound card to work:

The soundcard uses the snd-hda module, which is not supported by the 6.2 kernel. However, the latest snapshot of the 6.x series kernel does support it, so we must update our kernel. To do so, do the following:

1. Create a CVS sup called supfile file with the following:

*default tag=RELENG_6 #(do NOT use RELENG_6_2, or you won’t get the new kernel)
*default host=ftp.freebsd.org
*default prefix=/usr/local
*default base=/var/db
*default release=cvs delete use-rel-suffix compress
src-sys

2. Now, issue the command ‘cvsup supfile’

3. When the updated kernel source tree is fully downloaded, copy /usr/src/sys/crypto to /usr/local/src/sys/crypto (for some reason, this subdirectory is missing from the more up-to-date version of the kernel source tree, which results in compile-time errors.)

4. Edit the file /usr/local/src/sys/conf/newvers.sh and change ‘RELEASE’ from 6.3 to 6.2 and ‘BRANCH’ from PRERELEASE to RELEASE. This is a rather clumsy hack, but it’s the only way to ensure that the user will continue to be able to download packages for the 6.2 RELEASE version of FreeBSD, since, while the userland is 6.2, the OS’s version is determined by the kernel’s version.

5. Copy /usr/local/src/sys/i386/conf/GENERIC to /usr/local
src/sys/i386/conf/ERACKS

6. Open the ERACKS kernel configuration file and do the following:

– delete all the ‘cpu’ directives at the top except for I686_CPU
– change ‘ident GENERIC’ to ‘ident ERACKS’
– disable unneeded device drivers (be careful to only disable those you know for a fact won’t be used; you can get rid of the serial and parallel port drivers for example, since there are no serial or parallel ports on the laptop)

7. When the source tree is prepared, move /usr/src/sys to /usr/src/sys.old, and move /usr/local/src/sys to usr/src/sys

8. cd to /usr/src and type the command “make buildkernel KERNCONF=ERACKS”

9. If the build was successful, type the command “make installkernel KERNCONF=ERACKS”

10. Reboot the computer and make sure it comes up successfully

Now, the sound card should be working.

2) Getting the wireless to work:

Unfortunately, there are no native FreeBSD drivers for the wireless. However, there is an ndis wrapper in the FreeBSD kernel that will allow us to use Windows drivers for this card.

1. Download the file http://ftp.us.dell.com/network/R94827.EXE. Just in case this link doesn’t work, a copy of this driver will also be kept at eRacks. Even though the laptop is an Acer, trying to use the Acer driver will fail (not sure why.) The Dell driver, while intended for another laptop, supports the same wireless chipset, and will suit our needs.

2. On a Windows machine (or with WINE), run the self extracting archive, and copy bcmwl5.inf and bcmwl5.sys to the FreeBSD laptop (these files will be extracted when you run R94827.EXE.)

3. In the directory where the two above mentioned files are stored, issue the command “ndisgen bcmwl5.inf bcmw5l.sys”. Accept all the defaults, pressing enter for each one, and a resulting .ko kernel object will be built. This is the “FreeBSDized” Windows driver that will support the wireless card.

4. Copy the resulting object file to /boot/modules

5. Edit /boot/loader.conf and add the following line: “bcmwl5_sys_load=”YES”

6. Reboot the machine, and verify the wireless card is working by issuing the command “ifconfig -a.” Observe that there is a device named ndis0.

That’s it! All the other devices are supported out of the box. The only exception is that the graphics adapter is only supported through generic VGA. The Intel 945GVM is supported in FreeBSD 7.0, but that is currently unstable.

March 31st, 2008

Posted In: Laptop cookbooks

Tags: , , ,

4 Comments

« Previous Page