Skip to content

Instantly share code, notes, and snippets.

@tnishinaga
Created September 1, 2019 00:56
Show Gist options
  • Save tnishinaga/23c910dfb72a65c5ca613752177833f1 to your computer and use it in GitHub Desktop.
Save tnishinaga/23c910dfb72a65c5ca613752177833f1 to your computer and use it in GitHub Desktop.
星と翼のパラドクスの録画データを結合してhevcに変換するスクリプト(Mac用)
#!/bin/bash -x
# Copyright (c) 2019 @tnishinaga
# MIT License
# https://spdx.org/licenses/MIT.html
# concat
mkdir -p concatinated
for f in $(ls *_00001.ts); do
base=$(echo $f | sed -e "s/_.*.ts//")
tmp=$(mktemp)
for cf in $(ls ${base}*.ts); do
p=$(realpath $cf)
echo "file $p" >> $tmp
done
cat $tmp
ffmpeg -safe 0 -f concat -i $tmp -c copy concat_tmp.ts
rm $tmp
mv ${base}*.ts concatinated/
mv concat_tmp.ts ${base}.ts
done
# convert to HEVC
mkdir -p converted/
mkdir -p encoded/
for f in $(ls *.ts); do
base=$(echo $f | sed -e "s/.ts//")
ffmpeg \
-i $f \
-c:v hevc_videotoolbox \
-c:a copy \
-tag:v hvc1 \
encoded/${base}.mp4 \
&& mv $f converted/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment