Skip to content

Instantly share code, notes, and snippets.

View uotw's full-sized avatar

Ben Smith uotw

View GitHub Profile
@uotw
uotw / osd_dji_hd.c
Last active January 27, 2020 02:53
options for iNav DJI FPV CRAFT_NAME tele insertion
//this snippet of code is from inav-2.4.0-RC1/src/main/io/osd_dji_hd.c
case DJI_MSP_NAME:
{
/* DIRECTION TO HOME, DIST TO HOME, SPEED, ALT */
int speed = (int)(gpsSol.groundSpeed * 0.0223694); // centimeters per second to MPH
int altitude = (int)lrintf(getEstimatedActualPosition(Z) * 0.0328084); // centimeters to feet
static char dirAndDist[16];
static char arrow[7];
@uotw
uotw / quad.sh
Last active August 7, 2019 04:00
combine 4 clips into one 2 x 2 grid video mosaic
#!/usr/bin/env bash
finalwidth=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of csv=p=0 $1)
finalheight=$(ffprobe -v error -select_streams v:0 -show_entries stream=height -of csv=p=0 $1)
halfwidth=$(echo "$finalwidth/2" | bc)
halfheight=$(echo "$finalheight/2" | bc)
x="x"
ffmpeg -i $1 -i $2 -i $3 -i $4 -filter_complex "nullsrc=size=$finalwidth$x$finalheight [base]; [0:v] setpts=PTS-STARTPTS, scale=$halfwidth$x$halfheight [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=$halfwidth$x$halfheight [upperright]; [2:v] setpts=PTS-STARTPTS, scale=$halfwidth$x$halfheight [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=$halfwidth$x$halfheight [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=$halfwidth [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=$halfheight [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=$halfwidth:y=$halfheight" -c:v libx264 quad_vid.mp4