Bohl's Blog

my digital life

Adaptec AHA-3940 and Windows7-x64

I happened to have an Adaptec AHA-3940UW-card lying around, and wanted to use it with Windows7-x64 (in order to operate a DLT-tape drive). Yes, I am using good-old tapes for archiving things - I have high hopes that the data on the tapes will last for decades. Now the trouble was - I was unable to find a driver for this card. It seems that only x86-drivers are available. I was about to resign (and either install Windows7-x86 or buy a new card) - when I ran across this thread.

For me this driver works like a charm - I haven't tested it with a hard-drive or so, but with my trusted DLT-tape-drive it works flawlessly.

Adaptec78xx_x64.rar (45.34 kb)

building ffmpeg on Windows (2 of n)

In the last post we built an ffmpeg-binary using the cygwin-gcc-compiler. One of the drawbacks is that it is dependent on a cygwin-environment - it relies on the cygwin-DLLs and can work only inside a complete cygwin-installation. 

The binary cannot deal with traditional Windows-filenames - it will use the translation into "cygwin"-paths. On the one hand, this is an advantage - inside the cygwin-environment everything works smooth.

So, next we will build ffmpeg with the mingw-gcc-compiler. This will give us a binary which will work outside of the cygwin-environment.

The mingw-gcc-compiler is available as a cygwin-package, and we could probably go that way - however, I chose a different approach. We use Zeranoe's mingw-build-script in order to download and build the mingw-gcc-compiler ourselves. This script should do it in one sweep:



getmingwscript() {
cat <<EOF
Now downloading the mingw-installer script from
After the download has completed, the script will be executed.
if [ -f $scriptname ];
	rm $scriptname
wget $zeranoe_url/$scriptname
mkdir mingw

# for whatever reasons, the svn-checkout sometimes fails (most of the time on a slow machine) -> just run an update in case of failure
sed 's/svn checkout http:\/\/\/svnroot\/mingw-w64\/trunk || exit 1/svn checkout http:\/\/\/svnroot\/mingw-w64\/trunk || svn update trunk\/ || exit 1/' <$scriptname >mingw/$scriptname 
rm $scriptname

cd mingw
chmod +x ./$scriptname
./$scriptname --build-type=win32 --cpu-count="$(grep -c processor /proc/cpuinfo)" --default-configure
cd ..

getffmpeg() {
cd source
git clone git:// ffmpeg
cd ..

cleanmingw() {
rm -rf $ROOTDIR/mingw

cleansource() {
rm -rf $ROOTDIR/source

cleansoftware() {
rm -rf $ROOTDIR/software

makesoftwarefolders() {
[ -d $ROOTDIR/software ] || mkdir $ROOTDIR/software
[ -d $ROOTDIR/software/packages ] || mkdir $ROOTDIR/software/packages
[ -d $ROOTDIR/software/packages/win32 ] || mkdir $ROOTDIR/software/packages/win32
[ -d $ROOTDIR/software/packages/win32/lib ] || mkdir $ROOTDIR/software/packages/win32/lib
[ -d $ROOTDIR/software/packages/win32/pkgconfig ] || mkdir $ROOTDIR/software/packages/win32/lib/pkgconfig
[ -d $ROOTDIR/software/packages/win32/include ] || mkdir $ROOTDIR/software/packages/win32/include

buildffmpeg() {
cd source/ffmpeg
[ -f config.mak ] && make distclean
export PKG_CONFIG_PATH="$ROOTDIR/software/packages/win32/lib/pkgconfig" 
export LDFLAGS="-L$ROOTDIR/software/packages/win32/lib" 
export CFLAGS="-I$ROOTDIR/software/packages/win32/include"
./configure  --prefix="$ROOTDIR/software/packages/win32" --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-gpl --enable-nonfree 
make install

yes_no_sel () {
unset user_input
while [[ "$user_input" != [YyNn] ]]; do
    echo -n "$question"
    read user_input
    if [[ "$user_input" != [YyNn] ]]; then
        echo "Your selection was not vaild, please try again."; echo ""

yes_no_sel "Would you like to start from scratch (download and build mingw)? [y/n]: "
if [[ "$user_input" = [Yy] ]]; then

[ -d source ] || mkdir source


export PATH="$PATH:$ROOTDIR/mingw/mingw-w64-i686/bin"



You have to place this script into some folder (and name it e.g., then run it. It will ask you whether you want to download and build mingw from scratch - the first time you run it, you will have to say "y[es]", when running it a second time you may choose to skip this step (and use the already existing mingw-gcc-compiler).

After the script has finished its job (without errors I assume...) you should find three new folders: mingw (the sources and the binaries for the mingw-gcc-compiler), source (the ffmpeg-sources) and software (the results from the ffmpeg-build). The ffmpeg-binary is to be found at ...\software\packages\win32\bin.

OK, now the harder part is to run this binary through the FATE-test-suite - the problem is that binary is now expecting Windows-filenames, and FATE (being a Unix-script) is passing Unix-filenames to the executable. We might be able to get away by arranging our directory-layout in a way that Windows- and Unix-syntax come out to the same result, but there is another way: FATE allows to specify a wrapper ('TARGET_EXEC') which is used to run the tests, and we can use this wrapper to convert the paths passed to the executable. This script will do the trick:

#! /bin/sh
 function tweakcygwinpath()
	local tweaked
	if [[ $1 == *./tests/data/lavf/lavf.gxf ]];
		echo "./tests/data/lavf/lavf.gxf"
		if [[ $1 == *./tests/data/lavf/lavf.mkv ]];
			echo "./tests/data/lavf/lavf.mkv"
			if [[ $1 == */tests/vsynth1/00.pgm ]];
				echo "./tests/vsynth1/00.pgm"
				tweaked="$(cygpath -w $1)"
				echo "$tweaked"
 declare -a argstweaked
 shift 1
 for ARG in "$@"
    if [[ $ARG == /cygdrive/* || $ARG == /home/* ]];
		argstweaked[$index]=$(tweakcygwinpath $ARG)
		if [[ $ARG == amovie=*/amrwb/seed-12k65.awb,silencedetect=d=-20dB ]];
			filename=`echo "$ARG" | sed -E 's/amovie=(.*),.*|.*/\1/'`
			if [ ! -d "./temp" ]; then
				mkdir ./temp
			cp "$filename" ./temp/
			if [[ $ARG == amovie=*/filter/seq-3341-7_seq-3342-5-24bit.flac,ebur128=metadata=1 ]];
				filename=`echo "$ARG" | sed -E 's/amovie=(.*),.*|.*/\1/'`
				if [ ! -d "./temp" ]; then
					mkdir ./temp
				cp "$filename" ./temp/

$cmd "${argstweaked[@]}"

So now we can run FATE with this command

make  TARGET_EXEC=./ fate SAMPLES=/cygdrive/z/fate-suite/

assuming we have placed the above script in a file "" and the FATE-samples are available at /cygdrive/z/fate-suite.

Some comments on the script: lines 37-53 deal with the FATE-tests "filter-metadata-silencedetect" and "filter-metadata-ebur128". The problem is that a path appears in an argument (for a filtergraph iirc), and the parser cannot handle a Windows-path (this is something to look into...). The desperate workaround is to copy the file, so that it can be accessed using a relative path. TODO: we should delete the copied files afterwards.

building ffmpeg on Windows (1 of n)

Now it is time to set up Cygwin: go to and run the installer setup.exe. For our purposes, the following packages need to be installed:

  • subversion
  • wget
  • yasm
  • bison
  • flex
  • cvs
  • git
  • gcc-core
  • gcc-g++
  • rsync
  • bc
  • make

You will need to select all these packages by hand (at least I do not know about a way to script this).

Here are some screenshots of what you have to select: cygwin-selections.png (378.92 kb)


Now launch a Cygwin-shell, make a new folder (where you will build ffmpeg, say "cygwin"). Then get the Git-repository, and you are ready to configure and make ffmpeg - like so:

cd ~
mkdir cygwin
cd cygwin

git clone git:// ffmpeg

cd ffmpeg

./configure --enable-memalign-hack


 This should work without any flaw, and after a while you should find a newly-built ffmpeg.exe in the folder. If you happen to have more than one CPU on your machine, you might want to use 'make -j <number_of_parallel_jobs>' in order to speed up the build - where number_of_parallel_jobs should be around the number of cores you have. So, if you have 4 cores, then try 'make -j 4'.

Next, let's test-drive the binary and run the FATE-test-suite. This requires to download some test-data, around ~700MB. You may choose to download it to the ffmpeg-folder right away, or you may keep the samples in a separate folder (and re-use it for other builds). In the first case, with this command the samples will be downloaded to a folder "fate-suite" which is created in the ffmpeg-folder

make fate-rsync SAMPLES=fate-suite/

Or if you prefer to download it manually, try something like

rsync -vrltLW --timeout=60 --contimeout=60 rsync:// fate-suite/

Now it is time to run the tests:

make fate  SAMPLES=fate-suite/

You need to tell the path where the FATE-samples are to found as an argument to the SAMPLES-variable.

All tests should work ok, and now have done it: you built the ffmpeg-binary yourself! Of course, this is just the start...

building ffmpeg on Windows (0 of n)

I will try to collect some step-by-step instructions how to build ffmpeg on a Windows-machine. I still find it tedious, and is of course not really a viable solution. Above all, it is cumbersome to keep it up-to-date.

OK, my plot is:

  • Describe the setup of Cygwin in order to build ffmpeg with gcc
  • Make the ffmpeg-build work with icl

Stay tuned...