Download tools/reencode_h264.sh from rooty2020/text_audio_pretraining_for_GAN: direct link, hf CLI and curl.
- Browser
- Download file 564 Bytes
-
https://huggingface.co/datasets/rooty2020/text_audio_pretraining_for_GAN/resolve/main/tools/reencode_h264.sh
- Command line
-
hf download hf://datasets/rooty2020/text_audio_pretraining_for_GAN/tools/reencode_h264.sh
-
curl -L -o reencode_h264.sh https://huggingface.co/datasets/rooty2020/text_audio_pretraining_for_GAN/resolve/main/tools/reencode_h264.sh
564 Bytes
| # 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 | |