Skip to content

Instantly share code, notes, and snippets.

@lg3bass
lg3bass / gist:7705931
Last active December 29, 2015 17:39
OF>drag-n-drop file path
//--------------------------------------------------------------
void testApp::setup(){
setGUI();
}
//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(255);
float dx = dragPt.x;
@lg3bass
lg3bass / gist:8362336
Last active January 2, 2016 21:19
Using CURL + GREP to get a link out of a webpage
xxxxxxxx$ curl -s 'http://media.pearsoncmg.com/ph/hss/hss_manza_sociologyproject_1/applyingvideos/applying01.html' | grep -o 'script src="[^"]*"'
script src="http://mediaplayer.pearsoncmg.com/_ph_ssa3_cc_img_set.autoplay.false___set.width.768___set.height.432___embed.mytarget/ph/streaming/ssa/mysoclab/social_imagination/01_applying.m4v"
Unix command:
curl -s 'http://media.pearsoncmg.com/ph/hss/hss_manza_sociologyproject_1/applyingvideos/applying01.html' | grep -o 'script src="[^"]*"'
Result:
script src="http://mediaplayer.pearsoncmg.com/_ph_ssa3_cc_img_set.autoplay.false___set.width.768___set.height.432___embed.mytarget/ph/streaming/ssa/mysoclab/social_imagination/01_applying.m4v"
Source:
@lg3bass
lg3bass / gist:8442225
Last active August 7, 2023 16:52
FFMPEG - extract srts from all .m4v files in a directory.
//THE ONE-LINER-COMBO-MAGIC (updated 20230807)
for FILENM in *; do ffmpeg -i $FILENM -vn -an -codec:s srt ${FILENM/.m4v/}.srt; ffmpeg -i $FILENM -c copy ${FILENM/.m4v/}.mp4; done;
//convert all the videos to a low bandwidth version and place alongside the original video.
//source: https://addpipe.com/blog/flv-to-mp4/
for FILENM in *; do ffmpeg -i $FILENM -crf 45 -movflags faststart -profile:v baseline -level 3.1 ${FILENM/.mp4/}_3play.mp4; done;
//*** make sure the original video doesn't have spaces in the file name.
//MACOS UNIX
//Extract all the .srt files
@lg3bass
lg3bass / Midi2MayaAnimation.mel
Last active January 19, 2020 21:36
MEL - Midi 2 Maya Animation
#maya.py [maya 2014]
#midi to animation script
import sys
import math
#sys.path.append('/Users/lg3bass/BW_MCP/BW_PROJECTS/BW_3D/MAYA_projects/MIDI_PY/midi/Up1_LR.mid')
#put the midiparser.py file in X:/Program Files/Autodesk/Maya2011/Python/lib so you don't need to specify the path explicitly
import midiparser
import pymel.core as pm
start_note="C,1"
@lg3bass
lg3bass / loftCurves.mel
Created February 1, 2014 04:40
MEL - Loft Curves and Rig
//2014-01-31
//SELECT 4 CURVES, LOFT, ADD TO RIG NODE.
//bob white [bobwhitemedia.com]
//create the loft
string $geo[];
string $selection[];
$selection = `ls -sl`;
$geo = `loft -ch 1 -u 1 -c 1 -ar 1 -d 1 -ss 2 -rn 1 -po 1 -rsn true $selection`;//loft it
@lg3bass
lg3bass / gist:8852053
Last active January 14, 2016 14:24
Convert Avermedia Game Recorder .avi (H.264) to .mp4 (H.264) - Passthrough
//basic usage
ffmpeg -i 140203-1229.avi -vcodec copy -acodec copy avi_cog.mp4
//add faststart (progressive DL)
ffmpeg -i inflation-intro-3000.3gp -vcodec copy -acodec copy -movflags +faststart inflation-intro-3000.mp4
//see my response here:
//http://avp.stackexchange.com/questions/3876/how-can-i-use-ffmpeg-to-lower-the-quality-of-h264-video-but-keep-it-in-h264-form
//EDIT:
@lg3bass
lg3bass / GitCommands.txt
Last active January 30, 2018 03:48
MyGitList
//Create a new git repo. Concise instruction right from Git.
//Use this BOB!!!!!!!!!
//https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
//http://stackoverflow.com/questions/3311774/how-to-convert-existing-non-empty-directory-into-a-git-working-directory-and-pus
//RESOURCES:
//http://rogerdudler.github.io/git-guide/
//assuming your remote branch is up-to-date. Get rid of all your local changes and revert back to what is on the server.
git checkout -- .
//convert all the files in a directory to unix line endings. from "\r\n" to "\n".
for f in *; do [[ -f $f ]] && dos2unix "$f" "$f"; done
...and if you want it to be recursive do:
find . -type f -exec dos2unix {} {} ';'
@lg3bass
lg3bass / padVideosTo16:9
Last active May 31, 2022 11:13
ffmpeg to pad videos to 16:9
//source: https://lists.ffmpeg.org/pipermail/ffmpeg-user/2011-July/001746.html
//source: http://ffmpeg.org/ffmpeg-filters.html#pad
//works
ffmpeg -i PAN_17-1_Final.m4v -filter:v 'pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2' -aspect 16:9 PAN_17-1_Final_auto1.m4v
//works but calculates manually (pad=<width output>:<height output>:<x upper-left-corner>:<y upper-left-corner>
ffmpeg -i PAN_17-1_Final.m4v -filter:v 'pad=939:528:22:0' PAN_17-1_Final_PADTEST2.m4v
@lg3bass
lg3bass / gist:d2ece9fe48909ff02aaf
Last active August 29, 2015 14:06
MACOS>UNIX>FFMPEG>convert .mp4 to animated .gif
ffmpeg -i input.flv -vf scale=320:-1 -t 10 -r 10 output.gif
//source: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality