forked from lepe/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvertVideoWeb.sh
More file actions
executable file
·20 lines (20 loc) · 889 Bytes
/
convertVideoWeb.sh
File metadata and controls
executable file
·20 lines (20 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
if [[ "$1" == "" ]];then
echo "Usage: $0 somevideo.avi"
exit
fi
BASE=${1%%.*}
TARGET="$BASE-web"
VIDINFO=$(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width $1);
WIDTH=$(echo "$VIDINFO" | grep "width" | awk -F "=" '{print $2}')
HEIGHT=$(echo "$VIDINFO" | grep "height" | awk -F "=" '{print $2}')
ffmpeg -n -i $1 -c:v libx264 -profile:v baseline -an -movflags faststart ${TARGET}.mp4
ffmpeg -n -i $1 -vcodec libtheora -b:v 1310720 -an ${TARGET}.ogg
ffmpeg -n -i $1 -c:v libvpx -crf 10 -an -b:v 1M ${TARGET}.webm
echo "######################### HTML ##########################"
echo "<video width='$WIDTH' height='$HEIGHT' controls>
<source src='${TARGET}.mp4' type='video/mp4'>
<source src='${TARGET}.ogg' type='video/ogg'>
<source src='${TARGET}.webm' type='video/webm'>
Your browser does not support the video tag.
</video>"