Skip to content

Instantly share code, notes, and snippets.

View agrathwohl's full-sized avatar
👨‍🌾

Andrew Grathwohl agrathwohl

👨‍🌾
View GitHub Profile
@agrathwohl
agrathwohl / pciavailability.sh
Last active August 29, 2015 14:20
Get all PCI slots and their availability status via the terminal
sudo dmidecode -t 9 | grep -E "DMI type"\|Usage\|Type
@agrathwohl
agrathwohl / WAVMP3WAV
Last active August 29, 2015 14:22
Convert all WAVs in directory to 16/44.1 and to LAME's standard JS stereo MP3.
#!/bin/bash
FILES=*.wav
for f in $FILES
do
echo "Processing $f at 16/44.1..."
sox "$f" -b 16 "16441/$f" rate -v 44100
mv "$f" "2496/$f"
echo "Moved $f to 24/96"
echo "Processing $f as an MP3..."
lame -h "16441/$f" "MP3/$f.mp3"
@agrathwohl
agrathwohl / gifify.rb
Last active September 5, 2015 02:28
Class to create a decent-looking GIF from any video file
# gifify.rb
class Gifify
def initialize(video,start,length)
@video = video
@start = start
@length = length
end
def create_palette
`ffmpeg -y -ss "#{@start}" -t "#{@length}" -i "#{@video}" -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png`
@agrathwohl
agrathwohl / ffmpeg_ios
Last active January 4, 2026 17:54
FFmpeg options that will make your iOS video experience much better
# FFmpeg / iOS Video Taming
## General Options:
# These settings may be applied to both the INPUT and the OUTPUT
# of the FFmpeg command.
-r 30 # set the frame rate of the video to Apple's recommended 30 fps
-pix_fmt yuv420p # set the output video's pixel format
@agrathwohl
agrathwohl / FFmpeg PSNR
Last active December 13, 2022 10:37
Using fluent-ffmpeg to quickly create an MP4->WebM transcode with VP8 video. Adds the psnr flag so that we can get the transcode's peak signal-to-noise ratio. Any result greater than 35dB would be acceptable for most streaming use cases.
[fluent_ffmpeg] node ffmpeg.js
ffmpeg version N-75369-g5ba811b Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --prefix=/usr --shlibdir=/usr/lib --pkg-config-flags=--static --disable-static --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-shared --enable-x11grab
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 2.100 / 57. 2.100
libavformat 57. 2.100 / 57. 2.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 4.100 / 6. 4.100
libswscale 4. 0.100 / 4. 0.100
@agrathwohl
agrathwohl / BUILD_FFMPEG+DEPS
Last active November 3, 2015 20:24
Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# BY SACRED DATA MEDIA PARTNERS; WWW.SACREDDATA.IO
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@agrathwohl
agrathwohl / compare.rb
Last active April 8, 2016 16:14
Small ruby class that uses FFmpeg to perform PSNR analysis on two video files.
require "pathname"
require "open3"
class CompareVideo
def initialize(reference, video)
ref = Pathname.new(File.open("#{reference}", "r"))
vid = Pathname.new(File.open("#{video}", "r"))
@comp = [vid, ref] # Video first, reference file second
end
def compare(tech=['psnr','ssim'])

Moving Image Categorization

This document is intended to serve as an overview of moving image categorization best-practices. These practices are implemented by the Library of Congress, arguably the best-organized media archive on the planet. By following these practices, we enable frictionless relationships with ratings agencies, advertisers, media cataloging groups, metadata databases, etc.

Categories

The LoC has defined three types of labels for moving image genre categorization.

  • GENRE - Describes the 'plot' or 'setting' of the video, i.e. #Adventure, #Comedy, or #Romance.
  • SUBDIVISION - Another genre term, but applied as the leading subgenre of the video.
#include </home/agrathwohl/.colors/urban>
! HiDPI
Xft.dpi: 109
Xft.autohint: 1
Xft.displayfilter: lcddefault
Xft.hintstyle: hintslight
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
[options]
font = Hack 12
[colors]
foreground = #e0dadb
#foreground_bold = #ffffff