Skip to content

Instantly share code, notes, and snippets.

@lg3bass
lg3bass / padVideosTo16:9
Last active May 31, 2022
ffmpeg to pad videos to 16:9
View padVideosTo16: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:8442225
Last active Nov 26, 2021
FFMPEG - extract srts from all .m4v files in a directory.
View gist:8442225
//THE ONE-LINER-COMBO-MAGIC
for FILENM in *; do ffmpeg -i $FILENM -vn -an -codec:s:0.1 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 / gist:93b9a24ce678bc1acf54
Last active Dec 23, 2020
MACOS>UNIX>GIT>Create Repository From Existing
View gist:93b9a24ce678bc1acf54
///NEW (2020-12-23)
1. Create a new repo on github. Make sure to not create a readme, licence, or git ignore. New repo MUST BE EMPTY!!!!
2. If you added NOTHING you will see the "Quick Setup" screen.
3. In your local repo (the folder you want to create the project from) run these commands in order:
LG3-MBP:ADSR lg3$ git init
LG3-MBP:ADSR lg3$ git add .
LG3-MBP:ADSR lg3$ git commit -m "enter a comment. What are you committing"
LG3-MBP:ADSR lg3$ git branch -M main
-- REF: https://docs.github.com/en/free-pro-team@latest/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line
View jitter-jxs-notest.txt
//bind parmams cannot have "1" at the start of the var name.
//good: <param name="boxSize" type="float" default="0.4" />
//bad : <param name="1boxSize" type="float" default="0.4" />
@lg3bass
lg3bass / gist:429fea9288c06471131d4a058cea1393
Created Aug 27, 2020
get directory size | archive files and folders on a mac
View gist:429fea9288c06471131d4a058cea1393
//how-to-create-a-split-zipped-archive-from-mac-os-x-terminal
//source:
//https://www.addictivetips.com/mac-os/how-to-create-a-split-zipped-archive-from-mac-os-x-terminal/
//zip -r -s MaximumSize ArchiveName.zip FolderName/
zip -r -s 1g usheproduction-pearsoned-com usheproduction.pearsoned.com/
//Added Bonus: Get directory size and sort
@lg3bass
lg3bass / gist:127befd3ca8e2d4ed33020cc435d34ec
Last active Aug 13, 2020
FFMPEG - convert (MAX)AVRECORDR > Instagram
View gist:127befd3ca8e2d4ed33020cc435d34ec
//one line combo magic. all the .mov p422 files in a directory
for FILENM in *; do ffmpeg -i $FILENM -c:v libx264 -c:a aac -vf format=yuv420p -crf 1 -movflags +faststart ${FILENM%.*}.mp4; done;
//To convert the .h264 (.mov) output, keeping the same codec,bitrate, etc.
//DIRECT OUT OF AVRECORDR (60fps,h.264)
//with faststart
ffmpeg -i 20200611-480x-h264.mov -c copy -movflags +faststart output2.mp4
//no faststart
View gist:65f4c863ad8ffe951cadbccaaf7e5ea6
//Use FFprobe to get data.
//source (and other things to query.)
https://trac.ffmpeg.org/wiki/FFprobeTips
//get the bitrate on a list of files.
for FILENM in *.flv; do ffprobe -v error -show_entries format=bit_rate -of csv $FILENM; done;
//result
format,509845
format,519899
format,504639
@lg3bass
lg3bass / gist:ad65309e79e8d9a730f9acef345856c7
Last active Apr 16, 2020
FFMPEG - Convert all videos in a directory (Examples)
View gist:ad65309e79e8d9a730f9acef345856c7
//Convert all videos in a directory FLV > M4V (don't care bout quality)
for FILENM in *; do ffmpeg -y -i $FILENM ${FILENM%.*}.m4v; done;
//Converts all legacy .mov files in a directory to .mp4
//"-max_muxing_queue_size" source: https://trac.ffmpeg.org/ticket/6375
for FILENM in *;do ffmpeg -y -i $FILENM -crf 5 -max_muxing_queue_size 400 ${FILENM%.*}.mp4;done;
@lg3bass
lg3bass / gist:9faadde4f75f26f621f5bed9718ea367
Created Jan 28, 2020
Using CURL + GREP to get a link out of a webpage
View gist:9faadde4f75f26f621f5bed9718ea367
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"
@lg3bass
lg3bass / Midi2MayaAnimation.mel
Last active Jan 19, 2020
MEL - Midi 2 Maya Animation
View Midi2MayaAnimation.mel
#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"