Skip to content

Instantly share code, notes, and snippets.

@lisamelton
Last active December 18, 2015 05:59
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lisamelton/5737083 to your computer and use it in GitHub Desktop.
Save lisamelton/5737083 to your computer and use it in GitHub Desktop.
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.
#
# Input is read from a file named "queue.txt" which must be in the same
# directory as this script.
#
# The queue format is just a carriage return-delimited list of full paths to
# media files. The paths can contain spaces and shouldn't be quoted.
#
# The path is first deleted from the "queue.txt" file and then passed as an
# argument to the "transcode-video.sh" script.
#
# To pause after the "transcode-video.sh" script returns, simply insert a
# blank line at the top of the "queue.txt" file.
#
# Usage:
#
# ./batch.sh
#
readonly queue="$(cd "$(dirname "$0")" && pwd)/queue.txt"
input="$(sed -n 1p "$queue")"
while [ "$input" ]; do
sed -i '' 1d "$queue" || exit 1
transcode-video.sh "$input"
input="$(sed -n 1p "$queue")"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment