#!/bin/sh

test $# -ne 1 && echo "usage: gstreamer-ogg-vs-avi.sh 30" && exit

num=$1
AVIGST="jhbuild run gst-launch-0.10 v4l2src num-buffers=$num ! \
	video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! \
       	queue ! videorate ! jpegenc ! avimux ! \
	filesink location=video.avi "

OGGGST="jhbuild run gst-launch-0.10 v4l2src num-buffers=$num ! \
	video/x-raw-yuv,width=640,height=480 ! \
       	queue ! videorate ! theoraenc bitrate=500 keyframe-force=10 speed-level=2 ! \
       	queue ! \
       	oggmux max-delay=10000000 ! filesink location=video.ogg"

WEBMGST="jhbuild run gst-launch-0.10 v4l2src num-buffers=$num ! \
	video/x-raw-yuv,width=640,height=480 ! \
       	queue ! vp8enc bitrate=500000 max-keyframe-distance=10 speed=2 ! \
       	queue ! webmmux ! filesink location=video.webm"

#print $OGGGST
time $OGGGST

time $AVIGST

time $WEBMGST

du -h video.avi
du -h video.ogg
du -h video.webm
