Skip to content

Instantly share code, notes, and snippets.

View KonradIT's full-sized avatar

Konrad Iturbe KonradIT

View GitHub Profile
@KonradIT
KonradIT / goprohero.py
Last active January 3, 2016 04:19 — forked from cooncesean/gopro.py
class GoProInterface(object):
"""
This is a sample API (written in Python) of how I envision
the calls to be made to the firmware.
Sample (Python) Usage:
>>> gpi = GoProInterface('~/gopro/videos/')
>>> gpi.start()
>>> gpi.stop()
/Users/sean/gopro/videos/0001.m4v
"""
This program interfaces with the GoPro camera and records footage for a
set amount period of time defined by the optional `--seconds` arg.
"""
import argparse
import time
import serial
parser = argparse.ArgumentParser(description='Captures video from GoPro for set number of seconds.')
parser.add_argument(
pi@raspberrypi ~/public_html/gopro $ cat take_picture_and_send.sh
#!/bin/bash
## volume 100%
curl "http://10.5.5.9/camera/BS?t=goprohero&p=%02"
sleep 1
## mode to photo
curl "http://10.5.5.9/camera/CM?t=goprohero&p=%01"
sleep 1
## take picture
curl "http://10.5.5.9/bacpac/SH?t=goprohero&p=%01"
# Sort pictures from GOPRO09* in img (symbolic links)
x=1;for i in GOPRO9*JPG; do counter=$(printf %04d $x); ln "$i" img_in_order/img"$counter".jpg; x=$(($x+1)); done
# Rotate pictures if needed
for file in *.jpg; do convert $file -rotate 180 rotated-$file; done
# Make a 24img/s movie
ffmpeg -i "img%04d.jpg" -r 24 -s hd720 -vcodec libx264 -b:v 4000k fflapse_hd720.mp4
class GoproClient
attr_reader :ip_address
attr_reader :password
attr_reader :delay
def initialize(ip_address, password, delay = 1.0)
@ip_address = ip_address
@password = password
@delay = delay
end
@KonradIT
KonradIT / goprofwparser.c
Created January 20, 2014 19:57 — forked from nezza/gist:2394361
GoPro FW extractor.
/* This tool extracts the sections of a supplied GoPro
* firmware image.
*
* It creates the following files in the current directory:
* bst.bin, bld.bin, pri.bin, rom.bin, dsp.bin
*
* It also shows the expected CRC32 checksum of the section and shows
* where it will be written on the device, you can use this address as
* ROM address and load address in IDA Pro.
*
@KonradIT
KonradIT / goprolive.cpp
Last active April 5, 2020 01:59 — forked from GOROman/gist:6248503
GoPro Live Preview with OpenCV in C ++
#include <opencv2/opencv.hpp>
int main()
{
cv::VideoCapture cap( "http://10.5.5.9:8080/live/amba.m3u8" );
cv::namedWindow( "GoPro" );
cv::Mat frame;
do {
cap >> frame;
@KonradIT
KonradIT / encode.sh
Last active January 4, 2016 02:19 — forked from Knio/encode.sh
GoPro Image resizer using Shell and Python.
dir=${1-.}
fps=${2-48}
if [ ! -s times.sub ]
then
find . -path "*/$dir/???GOPRO/GOPR????.JPG" -printf '%p\n' | sort | python `dirname $0`/subs.py > times.sub
fi
mplayer "mf://$dir/???GOPRO/GOPR????.JPG" -mf w=1920:h=1080:fps=$fps:type=jpg -ao null -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m --crf 21 --preset fast --muxer mkv --output GOPRO.MKV -) -vf scale=1920:-3,flip,mirror,crop=1920:1080:0:0,pp=al -sub times.sub
@KonradIT
KonradIT / 0_reuse_code.js
Created February 24, 2014 21:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@KonradIT
KonradIT / gitio
Created February 25, 2014 21:43 — forked from defunkt/gitio
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]