rooty2020's picture
copy batch 0 (5652 files, 87.3 GB) from Ronaldo-GOAT/text_audio_pretraining_for_GAN
e3f3efe verified
Raw History Blame Contribute Delete
564 Bytes
#!/usr/bin/env bash
# Re-encode OpenCV-written mp4v videos to broadly-playable H.264.
# usage: reencode_h264.sh <file-or-dir> [...]
set -euo pipefail
enc() {
local f="$1" tmp="${1%.mp4}.h264.tmp.mp4"
ffmpeg -nostdin -v error -y -i "$f" \
-c:v libx264 -preset veryfast -crf 18 -pix_fmt yuv420p \
-movflags +faststart -an "$tmp"
mv -f "$tmp" "$f"
echo " reencoded $(basename "$f")"
}
for a in "$@"; do
if [ -d "$a" ]; then
while IFS= read -r -d '' f; do enc "$f"; done < <(find "$a" -maxdepth 1 -name '*.mp4' -print0)
else enc "$a"; fi
done