Skip to content

Instantly share code, notes, and snippets.

@yellowled
yellowled / ffmpeg-html5
Created December 6, 2011 19:39
Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg. Will probably convert this to a bash script later, but for the time being, here's some examples. Not sure there have actually sensible dimensions and bitrates for web video.
# webm
ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm
# mp4
ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4
# ogg (if you want to support older Firefox)
ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend
@tlehman
tlehman / threeio.rb
Created June 4, 2012 01:56
List all available three-character .io domain names (depends on colorize)
require 'net/http'
require 'colorize'
# find all available three-letter .io domains
alph = ('a'..'z')
# generate all three-character strings
threes = alph.map { |a| alph.map { |b| alph.map { |c| "#{a}#{b}#{c}" } } }.flatten
def io_available?(tld)
url = URI.parse("http://www.nic.io/cgi-bin/whois?query=#{tld}.io")
@dajoho
dajoho / html5.sh
Created March 7, 2013 13:52
Shellscript to create HTML5 <video> MP4/OGV/WEBM/FLV/JPG versions of any video. The size, bitrate, cropping and sharpening can all be defined at the top of the script. Requirements: ffmpeg with libx264/libvpx/libtheora codecs (can be installed via homebrew). And flvtool2 (sudo gem install flvtool2).
#!/bin/bash
FILTERS="-filter:v crop=504:374:6:4,unsharp=5:5:1.0:5:5:0.0";
RESIZE="512x384";
VIDEO_BITRATE="1024k";
AUDIO_BITRATE="64k";
############################################################
for f in "$@"
do
@robwierzbowski
robwierzbowski / gitcreate.sh
Last active July 2, 2024 15:43
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)
@erikccoder
erikccoder / ffmpeg.sh
Last active January 27, 2016 01:28
ffmpeg to html5 video.
http://johndyer.name/ffmpeg-settings-for-html5-codecs-h264mp4-theoraogg-vp8webm/
REM mp4 (H.264 / ACC)
ffmpeg -i %1 -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 -s 640x360 %1.mp4
REM webm (VP8 / Vorbis)
ffmpeg -i %1 -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 -s 640x360 %1.webm
REM ogv (Theora / Vorbis)
ffmpeg -i %1 -b 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 -s 640x360 %1.ogv
REM jpeg (screenshot at 10 seconds)
ffmpeg -i %1 -ss 00:10 -vframes 1 -r 1 -s 640x360 -f image2 %1.jpg
@jmwhittaker
jmwhittaker / gist:8516514
Last active May 2, 2024 03:16
Use FFmpeg to resize and generate .mp4 & .webm videos from any source video.
/**
Scaling
- Scale can be used as is which will set the height to 560 but keep aspect ratio for width.
- Other options include setting both with & height
- Watch out for sizing errors when not divisible by 2
**/
/** MP4 1st pass **/
ffmpeg -i input.mov -vcodec libx264 -vprofile high -preset veryslow -b:v 225k -maxrate 300k -bufsize 1000k -vf scale=-1:560 -threads 2 -pass 1 -an -f mp4 /dev/null
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@hissy
hissy / clear_empty_workflow_progress.php
Last active March 14, 2023 19:58
[concrete5] A job to deletes empty "Compare Versions" alerts.
<?php
namespace Application\Job;
use Job as AbstractJob;
use Concrete\Core\Workflow\Progress\PageProgress;
use Concrete\Core\Workflow\EmptyWorkflow;
class ClearEmptyWorkflowProgress extends AbstractJob
{