/usr/bin/v4l2loopback-ctl is in v4l2loopback-utils 0.10.0-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | #!/bin/bash
usage() {
## ugly linebreaks in order to make help2man more happy
    cat <<!
Usage:
    $0 [command] [args]
Commands:
     set-fps <FPS> /dev/videoX  Set device fps (if format is already
                                negotiated).
     set-timeout-image <IMAGE> /dev/videoX  Set timeout on device, and 
                                            optionally the placeholder picture,
                                            instead of default null frame.
     set-caps <CAPS> /dev/videoX  Fix format for the device (using GStreamer
                                  caps), so it will be maintained until reset,
                                  regardless of future readers/writers.
Options:
    FPS      frames per second, either as integer ('30') or fraction ('50/2')
    IMAGE    image file ("no-input.png"), or 'videotestsrc'
    CAPS     GStreamer caps ("video/x-raw-yuv, width=640, height=480"),
             or 'any'
    /dev/videoX  the v4l2-loopback device file you want to act on
!
    exit 1
}
version() {
cat <<!
$0 0.6
Copyright (c) 2012 IOhannes m zmoelnig <zmoelnig@iem.at>
Copyright (c) 2012 Anton Novikov (random.plant@gmail.com)
!
    exit 1
}
die() {
    echo "$@" 1>&2
    exit 1
}
parse_device() {
    if [ -e "$1" ]; then
        device="$1"
    elif [ -e "/dev/video$1" ]; then
        device="/dev/video$1"
    else
        die "can't parse device"
    fi
    sysfs=/sys/devices/virtual/video4linux/${device##*/}
}
check_application() {
 which $1 > /dev/null || die "can't find $1"
}
set_fps() {
    fps="$1"
    parse_device "$2"
    [ -z "$fps" ] && usage
    echo "@$fps" | sudo tee "$sysfs/format" >/dev/null || die "Set fps failed"
    echo OK
}
set_caps() {
    caps="$1"
    parse_device "$2"
    [ -z "$caps" ] && usage
    [ "$caps" = 'any' ] && {
        check_application v4l2-ctl
        v4l2-ctl -d $device -c keep_format=0
        return
    }
    [ -n "`cat $sysfs/format`" ] && die "Device is busy"
    declare -a params
    declare -a nofps_params
    IFS=',' read -ra params <<< "$caps"
    for p in "${params[@]}"; do
        if echo "$p" | grep -q framerate; then
            fps=`echo "$p" | sed -r 's/.*(=|\))//g'`
            echo "$fps" | grep -q '[^0-9/]' && die "could not parse framerate param"
            echo "@$fps" | sudo tee $sysfs/format >/dev/null || die "could not set fps attr"
            #echo "fps: $fps"
        else
            nofps_params=("${nofps_params[@]}" "$p")
        fi
    done
    {
        IFS=','
        nofps_caps="${nofps_params[*]}"
    }
    #echo "nofps_caps: $nofps_caps"
    check_application v4l2-ctl
    check_application gst-launch-1.0
    v4l2-ctl -d $device -c keep_format=1 || exit 1
    v4l2-ctl -d $device -c sustain_framerate=1 || exit 1
    gst-launch-1.0 videotestsrc num-buffers=1 ! "$nofps_caps" ! v4l2sink device=$device || die "output to $device failed"
}
set_timeout_image() {
    imagefile="$1"
    parse_device "$2"
    [ -z "$imagefile" ] && return
    [ -n "`cat $sysfs/format`" ] || die "Device has no format negotiated"
    check_application v4l2-ctl
    check_application gst-launch-1.0
    v4l2-ctl -d $device -c timeout_image_io=1
    if [ "$imagefile" = 'videotestsrc' ]; then
        gst-launch-1.0 videotestsrc num-buffers=1 ! v4l2sink device=$device
    else
        uri="file://`readlink -f $imagefile`" || die "no file"
        echo "Reading from $uri"
        gst-launch-1.0 uridecodebin uri=$uri ! videoconvert ! videoscale ! imagefreeze ! identity error-after=2 ! v4l2sink show-preroll-frame=false device=$device
    fi
    timeout=`v4l2-ctl -d $device -C timeout | sed -n 's/^timeout: //p'`
    [ -n "$timeout" ] || die "couldn't get timeout"
    echo "timeout: $timeout"
    [ "$timeout" = 0 ] && {
        echo 'Timeout is currently disabled; you can set it to some positive value, e.g.:'
        echo "$ v4l2-ctl -d $device -c timeout=3000"
    }
}
command="$1"
shift
case "$command" in
    "-h"|"--help")
	usage
	;;
    "-v"|"--version")
	version
	;;
    "set-fps")
        set_fps "$@"
        ;;
    "set-caps")
        set_caps "$@"
        ;;
    "set-timeout-image")
        set_timeout_image "$@"
        ;;
    *)
        usage
        ;;
esac
 |