-
Notifications
You must be signed in to change notification settings - Fork 2
/
vid2mp4
executable file
·29 lines (24 loc) · 737 Bytes
/
vid2mp4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# (c) 2020 Leif Sawyer
# License: GPL 3.0 (see https://github.com/akhepcat/)
# Permanent home: https://github.com/akhepcat/Miscellaneous/
# Direct download: https://raw.githubusercontent.com/akhepcat/Miscellaneous/master/vid2mp4
#
PROG="${0##*/}"
EXT2=${PROG//*2/}
if [ -z "$*" ]; then
echo "${PROG} [filename]"
echo " -- output is [filename.${EXT2}]"
exit 1
fi
for vidfile in ${*};
do
if [ -r "${vidfile}" ]; then
out="${vidfile%.*}.${EXT2}"
else
echo "can't find/read '${vidfile}'"
exit 1
fi
ffmpeg -i "${vidfile}" -y -map 0 -c:v copy -c:a copy -sn -movflags +faststart "${out}" || \
ffmpeg -i "${vidfile}" -y -map 0 -c:v h264 -c:a aac -b:a 128k -sn -movflags +faststart "${out}"
done