Skip to content

Instantly share code, notes, and snippets.

@donmelton donmelton/batch.sh
Last active Dec 18, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.