# See also: convert-color-profile.sh for proper method of sorting file input and output
convert *.png -crop 600x324+209x0 o/*.png
# Append metadata to WebM video
#
# 1. https://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata#QuickTime.2FMOV.2FMP4.2FM4A.2Fet_al.
# 2. http://www.webmproject.org/docs/container/
ffmpeg -y -i ch1.webm -metadata title="Awesome Title" -metadata Tags="gulp!" -metadata Date=2016-10 -metadata WritingApp="ffmpeg 3.1.3" -c:v copy -c:a copy ch1t.webm
# Previews & Poster frames
ffmpeg -ss 00:01.275 -i clip000.mp4 -t 5.35 -vf scale=320:-1 clip000t.gif
# deinterlace old Sony DV -- field order **must** start at the bottom!
ffmpeg -y -i ${INPUT_DIR}/${VIDEO_INPUT} -b:v 8M -vf yadif=parity=bff ${OUTPUT}
Last active
September 26, 2016 16:55
-
-
Save i8degrees/962e008abbe271cb236155d853d9993e to your computer and use it in GitHub Desktop.
a few of my video editing scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
COLOR_PROFILE="${HOME}/.colors/displays/ProPhoto.icm" | |
INPUT_DIR=$(pwd) | |
OUTPUT_DIR="o" | |
cd "${INPUT_DIR}" || exit 1 | |
mkdir -pv "${OUTPUT_DIR}" | |
for i in $(seq 1 145); do | |
INPUT_FILE="f${i}.png" | |
INPUT_PATH="${INPUT_DIR}/${INPUT_FILE}" | |
OUTPUT_FILE="f${i}.png" | |
OUTPUT_PATH=${OUTPUT_DIR}/${OUTPUT_FILE} | |
# echo "${INPUT_PATH} ${OUTPUT_PATH}" | |
# convert f${i}.png -crop 600x324+209x0 o/f${i}.png | |
convert -verbose "${INPUT_PATH}" -profile "${COLOR_PROFILE}" "${OUTPUT_PATH}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WAV='.wav' | |
MP3='.mp3' | |
AUDIO_BITRATE=224 | |
flac -d *.flac | |
for oldfilename in *$WAV | |
do | |
newfilename="${oldfilename/%${WAV}/${MP3}}" | |
lame -b "${AUDIO_BITRATE}" "$oldfilename" "$newfilename" && rm "$oldfilename" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# anim2webm.sh: Animation sequenced media, i.e.: GIF, mp4, etc. | |
# to WebM conversion | |
# | |
# See also, | |
# https://trac.ffmpeg.org/wiki/Encode/VP8 | |
# | |
# References | |
# 1. https://gist.github.com/ndarville/10010916 | |
APP_FILE=$0 | |
INPUT_FILE=$1 | |
OUTPUT_FILE=$2 | |
usage_info() | |
{ | |
local SCRIPT_NAME | |
SCRIPT_NAME=$(basename ${APP_FILE}) | |
echo "Usage:\t${SCRIPT_NAME} <input> <output>" | |
# echo | |
echo " i.e.:\t${SCRIPT_NAME} input.gif output.webm" | |
exit | |
} | |
VIDEO_CODEC=libvpx | |
# Video quality quantifier should be between 4..63. The lower values | |
# equate to better video quality. | |
VIDEO_QUALITY=12 | |
# Video quality cap; maximum bit-rate | |
VIDEO_BITRATE=2000K | |
AUDIO_CODEC=libvorbis | |
if [ -z "${INPUT_FILE}" ] || [ -z "${OUTPUT_FILE}" ]; then | |
usage_info | |
else | |
ffmpeg -threads 9 -i "${INPUT_FILE}" -c:v "${VIDEO_CODEC}" \ | |
-crf 12 -b:v "${VIDEO_BITRATE}" -c:a "${AUDIO_CODEC}" "${OUTPUT_FILE}" | |
# ffmpeg -threads 9 -i "${INPUT_FILE}" -c:v "${VIDEO_CODEC}" \ | |
# -b:v "${VIDEO_BITRATE}" -c:a "${AUDIO_CODEC}" "${OUTPUT_FILE}" | |
# ffmpeg -i your_video.mkv -ss 00:00:10.000 -to 00:00:20.000 -c:v libvpx -crf 4 -b:v 1500K -vf scale=640:-1 -an output.webm | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# to_dvd.sh:jeff | |
# SOURCE: http://ffmpeg.gusari.org/viewtopic.php?f=25&t=1235 | |
function usage_info() { | |
local SCRIPT_NAME | |
SCRIPT_NAME=$0 | |
echo "./${SCRIPT_NAME}: <dvd_input>" | |
} | |
OUTPUT_FILE=out.mpg | |
# TODO(jeff): escape input with printf | |
ffmpeg -i "${1}" -filter:v "scale='if(gt(a,720/480),720,-1)':'if(gt(a,720/480),-1,480)',pad=w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2" -target ntsc-dvd ${OUTPUT_FILE} | |
# Environment setup for dvdauthor | |
export VIDEO_FORMAT=NTSC | |
if [[ -z $1 ]]; then | |
usage_info | |
exit 0 | |
fi | |
mkdir -p dvd | |
DVD_ROOT=dvd | |
dvdauthor --title -o ${DVD_ROOT} -f ${OUTPUT_FILE} | |
# Setup the table of contents | |
dvdauthor -T -o ${DVD_ROOT} | |
DVD_ROOT=$(pwd) | |
# DVD_NAME="THE_BIG_LEBOWSKI" | |
DVD_NAME=$1 | |
ISO_IMAGE=dvd5_${DVD_NAME}.iso | |
hdiutil makehybrid -iso -udf -udf-version 1.02 -joliet \ | |
-udf-volume-name "${DVD_NAME}" -o "${ISO_IMAGE}" "${DVD_ROOT}" | |
# dvdxchap /dev/dvd > ${OUTPUT_FILE}_chapters.txt | |
# dvdxchap /Volumes/DVD/VIDEO_TS > ${OUTPUT_FILE}_chapters.txt | |
dvdxchap dvd5_${DVD_NAME}.iso > ${DVD_NAME}_chapters.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment