Skip to content

Instantly share code, notes, and snippets.

@lisamelton
lisamelton / kramdown_dashes_patch.rb
Created March 10, 2012 23:11
Monkey patch kramdown to behave more like `wptexturize` from WordPress # instead of SmartyPants when parsing dashes.
# Hack by Don Melton, based on portions of kramdown by Thomas Leitner.
#
# Monkey patch kramdown to behave more like `wptexturize` from WordPress
# instead of SmartyPants when parsing dashes.
#
# Now double and single hyphen-minus character sequences surrounded by spaces,
# i.e. `' -- '` and `' - '`, are converted to em and en dashes, respectively,
# still surrounded by spaces. Old and new dash conversions are:
#
# `'---'` => em dash
@lisamelton
lisamelton / encode.sh
Last active March 31, 2024 21:13
This is the shell script I use to drive HandBrakeCLI to re-encode video files in a format suitable for playback on Apple TV, Roku 3, iOS, OS X, etc.
#!/bin/bash
# encode.sh
#
# Copyright (c) 2013 Don Melton
#
# This version published on June 7, 2013.
#
# Re-encode video files in a format suitable for playback on Apple TV, Roku 3,
# iOS, OS X, etc.
@lisamelton
lisamelton / batch.sh
Last active December 18, 2015 05:59
Batch control for the "transcode-video.sh" script.
#!/bin/bash
# batch.sh
#
# Copyright (c) 2013-2014 Don Melton
#
# This version published on October 22, 2014.
#
# Batch control for the "transcode-video.sh" script.
#
@lisamelton
lisamelton / transcode-video.sh
Last active May 24, 2024 17:42
Transcode video file (works best with Blu-ray or DVD rip) into MP4 (or optionally Matroska) format, with configuration and at bitrate similar to popular online downloads.
#!/bin/bash
#
# transcode-video.sh
#
# Copyright (c) 2013-2015 Don Melton
#
about() {
cat <<EOF
$program 5.13 of April 8, 2015
@lisamelton
lisamelton / detect-crop.sh
Last active May 24, 2024 17:42
Detect crop values for video file to use with `mplayer` and `transcode-video.sh` (a wrapper script for `HandBrakeCLI`).
#!/bin/bash
#
# detect-crop.sh
#
# Copyright (c) 2013-2015 Don Melton
#
about() {
cat <<EOF
$program 3.3 of January 22, 2015
@lisamelton
lisamelton / convert-mp4-to-mkv.sh
Last active May 24, 2024 17:41
Convert MP4 video file into Matroska format without transcoding.
#!/bin/bash
#
# convert-video.sh
#
# Copyright (c) 2013-2014 Don Melton
#
about() {
cat <<EOF
$program 2.0 of December 3, 2014
@lisamelton
lisamelton / convert-mkv-to-mp4.sh
Last active October 17, 2021 13:51
Convert Matroska video file into MP4 format without transcoding.
#!/bin/bash
#
# convert-video.sh
#
# Copyright (c) 2013-2014 Don Melton
#
about() {
cat <<EOF
$program 2.0 of December 3, 2014
@lisamelton
lisamelton / gist:f7f002ee20a534faf1f1
Last active October 17, 2021 13:58
Output from `transcode-video --help`
Transcode video file or disc image directory into format and size similar to
popular online downloads. Works best with Blu-ray or DVD rip.
Automatically determines target video bitrate, number of audio tracks, etc.
WITHOUT ANY command line options.
Usage: transcode-video [OPTION]... [FILE|DIRECTORY]...
Input options:
--scan list title(s) and tracks in video media and exit
@lisamelton
lisamelton / experimental-abr-transcode-video.sh
Last active November 29, 2017 22:48
A wrapper script for `transcode-video` with an experimental average bitrate (ABR) ratecontrol system.
#!/bin/bash
#
# experimental-abr-transcode-video.sh
#
# Copyright (c) 2013-2017 Don Melton
#
die() {
echo "$(basename "$0"): $1" >&2
exit ${2:-1}
@lisamelton
lisamelton / experimental-simple-transcode-video.sh
Created June 27, 2018 21:07
A wrapper script for `transcode-video` with an experimental simple constrained ratecontrol system.
#!/bin/bash
#
# experimental-simple-transcode-video.sh
#
# Copyright (c) 2013-2018 Don Melton
#
die() {
echo "$(basename "$0"): $1" >&2
exit ${2:-1}