This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "attempting to kill all PTPCamera processes..." | |
# releases camera from the OS so we can use it | |
killall PTPCamera | |
gphoto2 \ | |
--folder "time-lapse" \ | |
--capture-image-and-download \ | |
--set-config "/main/imgsettings/imageformat=5" \ | |
--filename "frames/"%Y%m%d%H%M%S.%C \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This command converts audio according to the specifications listed in the Spark docs: | |
# https://sparkar.facebook.com/ar-studio/learn/documentation/docs/audio | |
# mono m4a, 44.1kHz sample rate, 16-bit-depth resolution | |
# Usage: | |
# convert-audio.sh myaudio.mp3 converted.m4a | |
# Notes: | |
# Always use m4a for output file type | |
# Change "64k" to a higher value to improve bitrate/quality. e.g. 96k 128k 192k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Lens Studio video asset encoder. Max dimension of 1280 using H.264 / AVC / MP4 | |
# https://lensstudio.snapchat.com/guides/2d/video/ | |
# USAGE: ./encode-lens-studio.sh myvideo.mov | |
ffmpeg -i $1 \ | |
-vf "scale='if(gt(iw, ih), min(1280, iw-mod(iw, 16)), -16)':'ifnot(gt(iw, ih), min(1280, ih-mod(ih, 16)), -16)'" \ | |
-c:v libx264 \ | |
-crf 23 \ | |
-preset veryslow \ | |
-c:a copy \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for project in **/*.arproj; | |
do /Applications/Spark\ AR\ Studio.app/Contents/MacOS/sparkTerminalAppleMac export $project; | |
done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Scene = require('Scene') | |
const {log} = require('Diagnostics') | |
const {RGBA} = require('Reactive') | |
;(async function () { | |
const light = await Scene.root.findFirst('ambientLight0') | |
log(light) | |
light.color = new RGBA(1, 1, 179/255, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://trac.ffmpeg.org/wiki/Encode/VP9 | |
# Converts video file to webm using two-pass encoding | |
# Installation on Mac: add script to /usr/local/bin | |
# Usage: | |
# webm ./path/to/video.mp4 | |
# Outputs ./path/to/video.mp4.webm | |
# Max size is 720 pixels wide. Change -vf scale to adjust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec4 getLutColor(vec2 rg, float sliceNo, std::Texture2d colorLutTex, vec2 gridSize) { | |
vec2 pixelSize = 1.0 / colorLutTex.size; | |
vec2 scale = 1.0 / gridSize; | |
float row = floor(sliceNo * scale.x); | |
float col = sliceNo - row * gridSize.x; // mod(sliceNo, gridSize.x); | |
vec2 colorLutCoords = (vec2(col, row) + rg) * scale; | |
// offset by 0.5 pixel and fit within range [0.5px, width-0.5px] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vignette = function (canvas) { | |
var alpha = .7, | |
context, | |
visible, | |
data; | |
(function initView() { | |
context = canvas.getContext("2d"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# export all arproj found in sub directories. e.g. you want to export several projects in one folder | |
for i in */*.arproj | |
do | |
echo "============================" | |
/Applications/Spark\ AR\ Studio/Spark\ AR\ Studio.app/Contents/MacOS/sparkTerminalAppleMac export "$i" -d ./ | |
echo "============================" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Batch encode webm files in a directory | |
for i in *.webm; | |
do | |
ffmpeg -y -i $i -b:v 0 -crf 30 -pass 1 -an -f webm /dev/null | |
ffmpeg -y -i $i -vf scale=640:640:force_original_aspect_ratio=decrease -b:v 0 -crf 30 -pass 2 "_${i}" | |
done |