Advertisement
Guest User

Untitled

a guest
May 15th, 2022
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. set -euxo pipefail
  4.  
  5. cd "$(dirname -- "$(readlink -f -- "$0")")"
  6.  
  7. find . -type f -name 'twitcast*.ts' -print0 |
  8.    while IFS= read -r -d '' ts_file; do
  9.        if [ -f "${ts_file%.*}.mp4" ]; then
  10.            continue
  11.        fi
  12.        if MP4Box -add "$ts_file" "${ts_file%.*}.mp4"; then
  13.            touch -r "$ts_file" "${ts_file%.*}.mp4"
  14.            rm "$ts_file"
  15.        else
  16.            rm -f "${ts_file%.*}.mp4"
  17.            echo "MP4Box errored!"
  18.            exit 1
  19.        fi
  20.    done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement