-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #454 from Purg/dev/bbn-data-scripts
Some high level helper scripts for BBN data extraction and ffprobe calls
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# | ||
# Simple script to unarchive a bunch of ZIP file contents into subdirectories | ||
# mirroring the name of the ZIP archive. | ||
# | ||
# Ensure the current directory contains the archives to be extracted, and that | ||
# they are named in such a way as to allow for extraction into a subdirectory | ||
# with the same name (e.g., "foo-1.0.zip" will extract into "./foo-1.0"). | ||
# | ||
|
||
for NAME in *.zip | ||
do | ||
echo "+++ Starting $NAME +++" | ||
BNAME="$(basename "$NAME" .zip)" | ||
if [[ ! -d "${BNAME}" ]] | ||
then | ||
mkdir "$BNAME"; | ||
unzip -d "$BNAME" "$NAME" | ||
fi | ||
echo "--- Finished $NAME ---" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
# | ||
# This is a convenience script to invoke ffprobe on all of the MP4 files found | ||
# under a directory, and then log the output of ffprobe in a symmetric location | ||
# in a working directory. This is due to expecting the MP4 source location to | ||
# be a read-only "golden" space that we don't want to write computed files to. | ||
# | ||
# Example: | ||
# $ export DATAPATH=/path/to/data | ||
# $ export WORKDIR=/path/to/workdir | ||
# $ ./extract_bbn_video_ffprobe.bash | ||
# | ||
shopt -s globstar nullglob | ||
|
||
DATAPATH="${DATAPATH:-"/home/local/KHQ/paul.tunison/data/darpa-ptg/bbn_data/lab_data-golden"}" | ||
WORKDIR="${WORKDIR:-"/home/local/KHQ/paul.tunison/data/darpa-ptg/bbn_data/lab_data-working"}" | ||
|
||
for F in "${DATAPATH}"/**/*.mp4 | ||
do | ||
echo $F | ||
F_rel="$(realpath --relative-to="${DATAPATH}" "$F")" | ||
output_dirpath="$(realpath -m "${WORKDIR}/$(dirname "$F_rel")")" | ||
output_filepath="${output_dirpath}/$(basename "$F" .mp4).probe.txt" | ||
mkdir -p "${output_dirpath}" | ||
if [[ ! -f "${output_filepath}" ]] | ||
then | ||
ffprobe "${F}" 2>&1 | tee "${output_filepath}" | ||
fi | ||
done | ||
|
||
# Collect all probed video streams metadata summary for resolution and fps info | ||
# $> grep -rin "Stream.*: Video" ../lab_data-working/ >../probe_summary.txt |