Spaces:
Running
Running
Download transcode_of.sh from yxma/human-mcap-viewer: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/yxma/human-mcap-viewer/resolve/main/transcode_of.sh
- Command line
-
hf download hf://spaces/yxma/human-mcap-viewer/transcode_of.sh
-
curl -L -o transcode_of.sh https://huggingface.co/spaces/yxma/human-mcap-viewer/resolve/main/transcode_of.sh
1 kB
| # OriginFlow rendered videos (2504x1658, 120 fps) -> 1600 px wide, 30 fps H.264 for the web; poster at 1/3 duration. | |
| # Loops until the Drive download has finished and every video is converted. | |
| SRC=~/data/originflow/videos; OUT=~/src/human-mcap-viewer/site/media/of | |
| while :; do | |
| for f in "$SRC"/*.mp4; do | |
| [ -e "$f" ] || continue; b=$(basename "$f" .mp4); o="$OUT/$b.mp4"; [ -s "$o" ] && continue | |
| ffmpeg -v error -y -i "$f" -vf "fps=30,scale=1600:-2:flags=lanczos" -c:v libx264 -preset slow -crf 23 -pix_fmt yuv420p -an -movflags +faststart "$o.tmp.mp4" && mv "$o.tmp.mp4" "$o" | |
| d=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$o"); ffmpeg -v error -y -ss $(python3 -c "print($d/3)") -i "$o" -frames:v 1 -vf scale=960:-2 -q:v 4 "$OUT/$b.jpg" | |
| echo "done $b $(du -h "$o" | cut -f1)" | |
| done | |
| pgrep -f "gdown --folder" >/dev/null || { n1=$(ls "$SRC"/*.mp4 | wc -l); n2=$(ls "$OUT"/*.mp4 | grep -vc tmp); [ "$n1" = "$n2" ] && break; } | |
| sleep 20 | |
| done | |
| echo ALL_DONE | |