#!/usr/bin/env bash # convert-mov.sh # Run this after org-publish to convert any .mov files in the output assets # to .mp4 so browsers can play them natively. # # Usage: ./convert-mov.sh # Or add to your publish pipeline: make publish && ./convert-mov.sh ASSETS_DIR="${1:-/home/zaine/master-folder/org_files/org_roam/output/assets}" find "$ASSETS_DIR" -type f -iname "*.mov" | while read -r mov; do mp4="${mov%.*}.mp4" if [ -f "$mp4" ]; then echo "[skip] $mp4 already exists" continue fi echo "[convert] $mov → $mp4" ffmpeg -i "$mov" \ -c:v libx264 -preset fast -crf 23 \ -c:a aac -b:a 128k \ -movflags +faststart \ -y "$mp4" 2>&1 | tail -1 echo "[done] $mp4" done echo "All done."