Skip to content

Commit fa512db

Browse files
authored
Merge pull request #814 from amiaopensource/allow-alternate-installs
Allow alternate installs
2 parents 285c54e + e1bd261 commit fa512db

File tree

2 files changed

+76
-14
lines changed

2 files changed

+76
-14
lines changed

vrecord

Lines changed: 68 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Dependencies: cowsay, amiaopensource/amiaos/decklinksdk,
2424
xmlstarlet
2525
Optional Dependencies: deckcontrol, gnuplot, mediaconch, mkvtoolnix, mpv, qcli
2626
27-
Usage: ${SCRIPTNAME} [ -e | -r | -p | -a | -x | -v | -h ] [IDENTIFIER]
27+
Usage: ${SCRIPTNAME} [ -e | -r | -p | -a | -x | -n| -v | -h ] [IDENTIFIER]
2828
2929
IDENTIFIER will be used for the filenaming of the output files. It is only
3030
required in record mode.
@@ -39,6 +39,8 @@ Usage: ${SCRIPTNAME} [ -e | -r | -p | -a | -x | -v | -h ] [IDENTIFIER]
3939
too long.
4040
-x reset the configuration: this will replace the default configuration file
4141
at '${CONFIG_FILE}' with an empty one.
42+
-n reset Vrecord's stored environment variables. These include
43+
variables such as the paths to certain dependencies such as ffmpeg-dl.
4244
-v Run ffmpeg with '-loglevel debug'. Using this option creates a very large
4345
log file, so avoid using this option with 'Visual + Numerical' or any
4446
playback option that display the log as part of the view.
@@ -53,6 +55,9 @@ Advanced options
5355
device. For testing without a decklink device.
5456
-G Share warnings from gtkdialog and vrecord, otherwise there are suppressed
5557
by default.
58+
-D Provide a path to a directory containing dependencies to override
59+
Vrecord's default dependency paths. These new paths will be stored in
60+
Vrecord's environmental variables.
5661
-c Provide a recording configuration file, rather than the default one at
5762
'${CONFIG_FILE}'.
5863
@@ -138,7 +143,7 @@ _process_vars_for_gtk(){
138143

139144
if [[ -z "${OS_TYPE}" ]] ; then
140145
_setup_env_variables
141-
_include_var OS_TYPE RESOURCE_PATH DEFAULTFONT CORE_COUNT OPEN_COMMAND ZCAT_COMMAND COMPUTER_MODEL_NAME DIR_SELECTION_DIALOG
146+
_include_var OS_TYPE RESOURCE_PATH DEFAULTFONT CORE_COUNT OPEN_COMMAND ZCAT_COMMAND COMPUTER_MODEL_NAME DIR_SELECTION_DIALOG GTKDIALOGBIN
142147
if [[ "${OS_TYPE}" = "macOS" ]] ; then
143148
_include_var COMPUTER_MODEL_ID COMPUTER_PROCESSOR_NAME COMPUTER_PROCESSOR_SPEED COMPUTER_PROCESSOR_COUNT COMPUTER_MEMORY COMPUTER_SERIAL
144149
fi
@@ -156,7 +161,8 @@ _remove_env_vars(){
156161
unset VRECORD_VARS_FILE
157162
unset OS_TYPE RESOURCE_PATH DEFAULTFONT CORE_COUNT OPEN_COMMAND ZCAT_COMMAND COMPUTER_MODEL_NAME DIR_SELECTION_DIALOG
158163
unset COMPUTER_MODEL_ID COMPUTER_PROCESSOR_NAME COMPUTER_PROCESSOR_SPEED COMPUTER_PROCESSOR_COUNT COMPUTER_MEMORY COMPUTER_SERIAL
159-
unset CAPTURELOGSUFFIX TIMECODELOGSUFFIX BREW_PREFIX FFMPEG_BIN FFPLAY_BIN FFPROBE_BIN
164+
unset CAPTURELOGSUFFIX TIMECODELOGSUFFIX BREW_PREFIX FFMPEG_BIN FFPLAY_BIN FFPROBE_BIN GTKDIALOGBIN
165+
VRECORD_VARS_FILE="/tmp/v_$(echo "${0}" | sed -e "s/[^A-Za-z0-9.]/_/g")_variables.txt"
160166
}
161167

162168
_setup_env_variables(){
@@ -232,6 +238,13 @@ _setup_env_variables(){
232238
echo "Unsupported OS, ${QUERY_OS_TYPE}, detected. Exiting."
233239
exit 1
234240
fi
241+
# set gtkdialog path
242+
if [[ -n "${DEPENDENCYDIR}" ]] ; then
243+
GTKDIALOGBIN=$(find "${DEPENDENCYDIR}" -iname "gtkdialog" | head -n1)
244+
fi
245+
if [[ -z "${GTKDIALOGBIN}" ]] ; then
246+
GTKDIALOGBIN="$(which gtkdialog)"
247+
fi
235248
}
236249

237250
_gather_ffmpeg_vars(){
@@ -247,17 +260,25 @@ _gather_ffmpeg_vars(){
247260
BREW_PREFIX+=".reinstall"
248261
fi
249262
fi
250-
if [[ -d "${BREW_PREFIX}/bin" ]] ; then
263+
if [[ -n "${DEPENDENCYDIR}" ]] ; then
264+
FFMPEGALT=$(find "${DEPENDENCYDIR}" -iname "ffmpeg-dl" | head -n1)
265+
fi
266+
if [[ -n "${FFMPEGALT}" ]] ; then
267+
FFMPEG_BIN="${FFMPEGALT}"
268+
FFPLAY_BIN=$(find "${DEPENDENCYDIR}" -iname "ffplay-dl" | head -n1)
269+
FFPROBE_BIN=$(find "${DEPENDENCYDIR}" -iname "ffprobe-dl" | head -n1)
270+
elif which ffmpeg-dl &> /dev/null ; then
271+
FFMPEG_BIN="$(which ffmpeg-dl)"
272+
FFPROBE_BIN="$(which ffprobe-dl)"
273+
FFPLAY_BIN="$(which ffplay-dl)"
274+
elif
275+
[[ -d "${BREW_PREFIX}/bin" ]] ; then
251276
FFMPEG_BIN="${BREW_PREFIX}/bin/ffmpeg-dl"
252277
FFPROBE_BIN="${BREW_PREFIX}/bin/ffprobe-dl"
278+
FFPLAY_BIN="${BREW_PREFIX}/bin/ffplay-dl"
253279
else
254280
FFMPEG_BIN="$(which ffmpeg)"
255281
FFPROBE_BIN="$(which ffprobe)"
256-
fi
257-
258-
if "${BREW_PREFIX}/bin/ffplay-dl" -v 0 -f lavfi smptebars=duration=1/25 -autoexit ; then
259-
FFPLAY_BIN="${BREW_PREFIX}/bin/ffplay-dl"
260-
else
261282
FFPLAY_BIN="$(which ffplay)"
262283
fi
263284
}
@@ -901,6 +922,19 @@ OPTIONAL_TOOLS_GUI=$(cat << CONFIG_FORM
901922
<action type="exit">env_reset</action>
902923
</button>
903924
</vbox>
925+
<vbox>
926+
<text>
927+
<label>Alternate Dependency Source</label>
928+
</text>
929+
<entry accept="directory">
930+
<default>"${DEPENDENCYDIR}"</default>
931+
<variable>DEPENDENCYDIR</variable>
932+
</entry>
933+
<button tooltip-text="Select alternate dependency directory and then reset environmental variables">
934+
<input file stock="gtk-open"></input>
935+
<action type="fileselect">DEPENDENCYDIR</action>
936+
</button>
937+
</vbox>
904938
</hbox>
905939
</frame>
906940
CONFIG_FORM
@@ -1462,9 +1496,9 @@ _edit_mode(){
14621496
cat "${SHARED_FUNCTIONS_FILE}" >> "${GTK_INC}"
14631497

14641498
if [[ "${VERBOSE_GTKDIALOG}" = "Y" ]] ; then
1465-
eval "$(gtkdialog --include="${GTK_INC}" --program MAIN_DIALOG --center)"
1499+
eval "$("${GTKDIALOGBIN}" --include="${GTK_INC}" --program MAIN_DIALOG --center)"
14661500
else
1467-
eval "$(gtkdialog --include="${GTK_INC}" --program MAIN_DIALOG --center 2> /dev/null)"
1501+
eval "$("${GTKDIALOGBIN}" --include="${GTK_INC}" --program MAIN_DIALOG --center 2> /dev/null)"
14681502
fi
14691503
MAIN_DIALOG="${MAIN_DIALOG_TMP}"
14701504

@@ -2248,7 +2282,7 @@ _review_all_options(){
22482282

22492283
# command-line options to set media id and original variables
22502284
OPTIND=1
2251-
while getopts ":hc:erpaxvI:O:i:G" opt ; do
2285+
while getopts ":hc:erpaxnvI:O:D:i:G" opt ; do
22522286
case "${opt}" in
22532287
h) _usage ; exit 0 ;;
22542288
c) CONFIG_FILE="${OPTARG}" ;;
@@ -2257,9 +2291,11 @@ while getopts ":hc:erpaxvI:O:i:G" opt ; do
22572291
p) RUNTYPE="passthrough" ;;
22582292
a) RUNTYPE="audiopassthrough" ;;
22592293
x) RUNTYPE="reset" ;;
2294+
n) RUNTYPE="resetenvironment" ;;
22602295
v) VERBOSE="true" ;;
22612296
I) EXTRAINPUTOPTIONS=(${OPTARG}) ;;
22622297
O) EXTRAOUTPUTOPTIONS=(${OPTARG}) ;;
2298+
D) DEPENDENCYDIR=("${OPTARG}") && RUNTYPE="resetenvironment";;
22632299
i) ALT_INPUT="${OPTARG}" ;;
22642300
G) VERBOSE_GTKDIALOG="Y" ;;
22652301
:) _report -w "Option -${OPTARG} requires an argument" ; _usage ; exit 1 ;;
@@ -2368,6 +2404,26 @@ if [[ "${RUNTYPE}" = "reset" ]] ; then
23682404
exit 0
23692405
fi
23702406
fi
2407+
2408+
if [[ "${RUNTYPE}" = "resetenvironment" ]] ; then
2409+
if [[ -n "${DEPENDENCYDIR}" ]] ; then
2410+
_report -q -n "Rewriting the configuration to include dependencies found in ${DEPENDENCYDIR}. Please enter [Y] to confirm: "
2411+
else
2412+
_report -q -n "Resetting the configuration will clear ${VRECORD_VARS_FILE}. Please enter [Y] to confirm: "
2413+
fi
2414+
read RESET_RESPONSE
2415+
if [[ "${RESET_RESPONSE}" = [Yy] ]] ; then
2416+
_report -d "Clearing ${VRECORD_VARS_FILE}."
2417+
_remove_env_vars
2418+
_process_vars_for_gtk
2419+
RUNTYPE="edit"
2420+
STARTUP_VIEW="INPUTSETTINGS"
2421+
else
2422+
_report -d "Reset aborted. Exiting."
2423+
exit 0
2424+
fi
2425+
fi
2426+
23712427
while [[ "${RUNTYPE}" = "edit" ]] ; do
23722428
STARTUP_VIEW="INPUTSETTINGS"
23732429
_edit_mode

vrecord.1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
.TH vrecord 1 "https://github.com/amiaopensource/vrecord" "2024-01-26" "AMIA Open Source"
1+
.TH vrecord 1 "https://github.com/amiaopensource/vrecord" "2024-07-18" "AMIA Open Source"
22
.\" Turn off justification for nroff.
33
.if n .ad l
44
.\" Turn off hyphenation.
55
.nh
66
.SH NAME
77
vrecord - An Open-Source Video Capture Tool for Archivists
88
.SH SYNOPSIS
9-
\fBvrecord\fR [\fB-e\fR | \fB-r \fIidentifier\fR | \fB-p\fR | \fB-a\fR | \fB-x\fR | \fB-v\fR | \fB-h\fR]
9+
\fBvrecord\fR [\fB-e\fR | \fB-r \fIidentifier\fR | \fB-p\fR | \fB-a\fR | \fB-x\fR | \fB-n\fR | \fB-v\fR | \fB-h\fR]
1010
.SH DESCRIPTION
1111
Vrecord is open-source software for capturing a video signal and turning it into a digital file. Its purpose is to make videotape digitization or transfer easier. Vrecord can capture analog and digital signals through a variety of inputs and can create digital video files in a variety of formats and codecs. Vrecord has been designed with needs of audiovisual archivists in mind.
1212
.PP
@@ -28,6 +28,9 @@ Running vrecord in \fBEdit Mode\fR opens a GUI window that allows you to change
2828
.B -x
2929
\fBClear Configuration:\fR Use if you would like to clear all options set in the configuration file.
3030
.TP
31+
.B -n
32+
\fBReset environmental variables:\fR Use if you would like to reset stored environmental variables such as path to ffmpeg-dl dependency.
33+
.TP
3134
.B -v
3235
In the \fBVerbose Mode\fR ffmpeg runs with '-loglevel debug'. Using this option creates a very large log file, so avoid using this option with 'Visual + Numerical' or any playback option that display the log as part of the view.
3336
.TP
@@ -41,6 +44,9 @@ Provide a string of input options for the recording ffmpeg to use. For example "
4144
.B -O
4245
Provide a string of output options for the recording ffmpeg to use.
4346
.TP
47+
.B -D
48+
Provide a directory containing vrecord dependencies to store their paths in vrecord's environmental variables instead of defaults.
49+
.TP
4450
.B -i
4551
Provide a file as an input to vrecord, rather than using the decklink device. For testing without a decklink device.
4652
.TP

0 commit comments

Comments
 (0)