Created
April 28, 2020 02:44
-
-
Save wheel5up/86ee1b4fde5f3720777e89ca4873b890 to your computer and use it in GitHub Desktop.
Quick script to convert MTS files to mp4 without transcodeing and keeping the original date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
exifdateformat='%Y:%m:%d %T%Z' | |
ffmpegdateformat='%FT%T' | |
filenamedateformat='%Y%m%d_%H%M%S' | |
for srcfile in "$@" | |
do | |
exifcreatetime=$(exiftool -s -s -s -datetimeoriginal $srcfile) | |
echo "Get date/time:$exifcreatetime" | |
ffmpegcreatetime=$(date -j -f "$exifdateformat" "$exifcreatetime" +"$ffmpegdateformat") | |
echo "transformed date/time:$ffmpegcreatetime" | |
filecreatetime=$(date -j -f "$exifdateformat" "$exifcreatetime" +"$filenamedateformat") | |
echo "filename date/time:$filecreatetime" | |
echo "Get value:$srcfile" | |
ffmpeg -i $srcfile -c copy -metadata creation_time=${ffmpegcreatetime}Z ${filecreatetime}.mp4 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment