diff --git a/Makefile b/Makefile
index c28de12e8bfae32d63a90a8ece23c7475c2a4777..4f2ff34aa234aa15be5c021dfc676aa8544b54ee 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ include config.mak
 
 VPATH=$(SRC_PATH)
 
-CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 ifeq ($(CONFIG_DARWIN),yes)
 LDFLAGS+= -g -d
 FFSLDFLAGS= -Wl,-bind_at_load
@@ -33,9 +33,9 @@ EXTRALIBS+=-lmedia -lbe
 endif
 
 ifeq ($(BUILD_SHARED),yes)
-DEP_LIBS=libavcodec/libavcodec.so libav/libavformat.a
+DEP_LIBS=libavcodec/libavcodec.so libavformat/libavformat.a
 else
-DEP_LIBS=libavcodec/libavcodec.a libav/libavformat.a
+DEP_LIBS=libavcodec/libavcodec.a libavformat/libavformat.a
 ifeq ($(CONFIG_MP3LAME),yes)
 EXTRALIBS+=-lmp3lame
 endif
@@ -60,10 +60,10 @@ all: lib $(PROG) $(VHOOK)
 
 lib:
 	$(MAKE) -C libavcodec all
-	$(MAKE) -C libav all
+	$(MAKE) -C libavformat all
 
 ffmpeg_g$(EXE): ffmpeg.o $(DEP_LIBS)
-	$(CC) $(LDFLAGS) -o $@ ffmpeg.o -L./libavcodec -L./libav \
+	$(CC) $(LDFLAGS) -o $@ ffmpeg.o -L./libavcodec -L./libavformat \
               -lavformat -lavcodec $(EXTRALIBS)
 
 ffmpeg$(EXE): ffmpeg_g$(EXE)
@@ -71,7 +71,7 @@ ffmpeg$(EXE): ffmpeg_g$(EXE)
 
 ffserver$(EXE): ffserver.o $(DEP_LIBS)
 	$(CC) $(LDFLAGS) $(FFSLDFLAGS) \
-		-o $@ ffserver.o -L./libavcodec -L./libav \
+		-o $@ ffserver.o -L./libavcodec -L./libavformat \
               -lavformat -lavcodec -ldl $(EXTRALIBS) 
 
 ffplay: ffmpeg$(EXE)
@@ -97,7 +97,7 @@ $(prefix)/lib/vhook:
 
 installlib:
 	$(MAKE) -C libavcodec installlib
-	$(MAKE) -C libav installlib
+	$(MAKE) -C libavformat installlib
 
 dep:	depend
 
@@ -106,7 +106,7 @@ depend:
 
 clean: $(CLEANVHOOK)
 	$(MAKE) -C libavcodec clean
-	$(MAKE) -C libav clean
+	$(MAKE) -C libavformat clean
 	$(MAKE) -C tests clean
 	rm -f *.o *~ .depend gmon.out TAGS ffmpeg_g$(EXE) $(PROG) 
 
@@ -118,7 +118,7 @@ distclean: clean
 	rm -f config.mak config.h
 
 TAGS:
-	etags *.[ch] libav/*.[ch] libavcodec/*.[ch]
+	etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
 
 # regression tests
 
diff --git a/libav/.cvsignore b/libavformat/.cvsignore
similarity index 100%
rename from libav/.cvsignore
rename to libavformat/.cvsignore
diff --git a/libav/Makefile b/libavformat/Makefile
similarity index 100%
rename from libav/Makefile
rename to libavformat/Makefile
diff --git a/libav/allformats.c b/libavformat/allformats.c
similarity index 100%
rename from libav/allformats.c
rename to libavformat/allformats.c
diff --git a/libav/asf.c b/libavformat/asf.c
similarity index 100%
rename from libav/asf.c
rename to libavformat/asf.c
diff --git a/libav/au.c b/libavformat/au.c
similarity index 100%
rename from libav/au.c
rename to libavformat/au.c
diff --git a/libav/audio.c b/libavformat/audio.c
similarity index 100%
rename from libav/audio.c
rename to libavformat/audio.c
diff --git a/libav/avformat.h b/libavformat/avformat.h
similarity index 100%
rename from libav/avformat.h
rename to libavformat/avformat.h
diff --git a/libav/avi.h b/libavformat/avi.h
similarity index 100%
rename from libav/avi.h
rename to libavformat/avi.h
diff --git a/libav/avidec.c b/libavformat/avidec.c
similarity index 100%
rename from libav/avidec.c
rename to libavformat/avidec.c
diff --git a/libav/avienc.c b/libavformat/avienc.c
similarity index 100%
rename from libav/avienc.c
rename to libavformat/avienc.c
diff --git a/libav/avio.c b/libavformat/avio.c
similarity index 100%
rename from libav/avio.c
rename to libavformat/avio.c
diff --git a/libav/avio.h b/libavformat/avio.h
similarity index 100%
rename from libav/avio.h
rename to libavformat/avio.h
diff --git a/libav/aviobuf.c b/libavformat/aviobuf.c
similarity index 100%
rename from libav/aviobuf.c
rename to libavformat/aviobuf.c
diff --git a/libav/barpainet.c b/libavformat/barpainet.c
similarity index 100%
rename from libav/barpainet.c
rename to libavformat/barpainet.c
diff --git a/libav/barpainet.h b/libavformat/barpainet.h
similarity index 100%
rename from libav/barpainet.h
rename to libavformat/barpainet.h
diff --git a/libav/beosaudio.cpp b/libavformat/beosaudio.cpp
similarity index 100%
rename from libav/beosaudio.cpp
rename to libavformat/beosaudio.cpp
diff --git a/libav/crc.c b/libavformat/crc.c
similarity index 100%
rename from libav/crc.c
rename to libavformat/crc.c
diff --git a/libav/cutils.c b/libavformat/cutils.c
similarity index 100%
rename from libav/cutils.c
rename to libavformat/cutils.c
diff --git a/libav/dv.c b/libavformat/dv.c
similarity index 100%
rename from libav/dv.c
rename to libavformat/dv.c
diff --git a/libav/ffm.c b/libavformat/ffm.c
similarity index 100%
rename from libav/ffm.c
rename to libavformat/ffm.c
diff --git a/libav/file.c b/libavformat/file.c
similarity index 100%
rename from libav/file.c
rename to libavformat/file.c
diff --git a/libav/framehook.c b/libavformat/framehook.c
similarity index 100%
rename from libav/framehook.c
rename to libavformat/framehook.c
diff --git a/libav/framehook.h b/libavformat/framehook.h
similarity index 100%
rename from libav/framehook.h
rename to libavformat/framehook.h
diff --git a/libav/gif.c b/libavformat/gif.c
similarity index 100%
rename from libav/gif.c
rename to libavformat/gif.c
diff --git a/libav/grab.c b/libavformat/grab.c
similarity index 100%
rename from libav/grab.c
rename to libavformat/grab.c
diff --git a/libav/http.c b/libavformat/http.c
similarity index 100%
rename from libav/http.c
rename to libavformat/http.c
diff --git a/libav/img.c b/libavformat/img.c
similarity index 100%
rename from libav/img.c
rename to libavformat/img.c
diff --git a/libav/jpeg.c b/libavformat/jpeg.c
similarity index 100%
rename from libav/jpeg.c
rename to libavformat/jpeg.c
diff --git a/libav/mov.c b/libavformat/mov.c
similarity index 100%
rename from libav/mov.c
rename to libavformat/mov.c
diff --git a/libav/mpeg.c b/libavformat/mpeg.c
similarity index 100%
rename from libav/mpeg.c
rename to libavformat/mpeg.c
diff --git a/libav/mpegts.c b/libavformat/mpegts.c
similarity index 100%
rename from libav/mpegts.c
rename to libavformat/mpegts.c
diff --git a/libav/ogg.c b/libavformat/ogg.c
similarity index 100%
rename from libav/ogg.c
rename to libavformat/ogg.c
diff --git a/libav/raw.c b/libavformat/raw.c
similarity index 100%
rename from libav/raw.c
rename to libavformat/raw.c
diff --git a/libav/rm.c b/libavformat/rm.c
similarity index 100%
rename from libav/rm.c
rename to libavformat/rm.c
diff --git a/libav/rtp.c b/libavformat/rtp.c
similarity index 100%
rename from libav/rtp.c
rename to libavformat/rtp.c
diff --git a/libav/rtp.h b/libavformat/rtp.h
similarity index 100%
rename from libav/rtp.h
rename to libavformat/rtp.h
diff --git a/libav/rtpproto.c b/libavformat/rtpproto.c
similarity index 100%
rename from libav/rtpproto.c
rename to libavformat/rtpproto.c
diff --git a/libav/rtsp.c b/libavformat/rtsp.c
similarity index 100%
rename from libav/rtsp.c
rename to libavformat/rtsp.c
diff --git a/libav/rtsp.h b/libavformat/rtsp.h
similarity index 100%
rename from libav/rtsp.h
rename to libavformat/rtsp.h
diff --git a/libav/rtspcodes.h b/libavformat/rtspcodes.h
similarity index 100%
rename from libav/rtspcodes.h
rename to libavformat/rtspcodes.h
diff --git a/libav/strptime.c b/libavformat/strptime.c
similarity index 100%
rename from libav/strptime.c
rename to libavformat/strptime.c
diff --git a/libav/strptime.h b/libavformat/strptime.h
similarity index 100%
rename from libav/strptime.h
rename to libavformat/strptime.h
diff --git a/libav/swf.c b/libavformat/swf.c
similarity index 100%
rename from libav/swf.c
rename to libavformat/swf.c
diff --git a/libav/tcp.c b/libavformat/tcp.c
similarity index 100%
rename from libav/tcp.c
rename to libavformat/tcp.c
diff --git a/libav/udp.c b/libavformat/udp.c
similarity index 100%
rename from libav/udp.c
rename to libavformat/udp.c
diff --git a/libav/utils.c b/libavformat/utils.c
similarity index 100%
rename from libav/utils.c
rename to libavformat/utils.c
diff --git a/libav/wav.c b/libavformat/wav.c
similarity index 100%
rename from libav/wav.c
rename to libavformat/wav.c
diff --git a/vhook/Makefile b/vhook/Makefile
index 296127daeca2d94c658c5d27540a27b4f17f5304..d217e00b2f49b001f8e27d45884deb7c18674bdc 100644
--- a/vhook/Makefile
+++ b/vhook/Makefile
@@ -1,6 +1,6 @@
 include ../config.mak
 
-CFLAGS=-fPIC $(OPTFLAGS) -g -Wall -I.. -I../libav -I../libavcodec -DHAVE_AV_CONFIG_H
+CFLAGS=-fPIC $(OPTFLAGS) -g -Wall -I.. -I../libavformat -I../libavcodec -DHAVE_AV_CONFIG_H
 
 ifeq ($(CONFIG_DARWIN),yes)
 LDFLAGS+=-bundle -flat_namespace -undefined suppress