#!/bin/bash

w=$1
h=$2
fmt=$3
dev=$4
port=$5

if [[ ! $w ]] || [[ ! $h ]] || [[ ! $fmt ]] || [[ ! $dev ]] || [[ ! $port ]]; then
    echo "Usage: $0 <width> <height> <fourcc> <devnode #> <udp port>"
    exit 1
fi

gst-launch-1.0 v4l2src device=/dev/video$dev ! "video/x-raw,format=$fmt,width=$w,height=$h" ! jpegenc ! queue ! avimux name=mux ! udpsink host=192.168.1.59 port=$port
