summaryrefslogtreecommitdiff
path: root/dot/local
diff options
context:
space:
mode:
Diffstat (limited to 'dot/local')
-rwxr-xr-xdot/local/bin/twmp434
1 files changed, 34 insertions, 0 deletions
diff --git a/dot/local/bin/twmp4 b/dot/local/bin/twmp4
new file mode 100755
index 0000000..9b80425
--- /dev/null
+++ b/dot/local/bin/twmp4
@@ -0,0 +1,34 @@
1#!/bin/sh
2INPUT=$1
3set -ex
4
5[ -f "$INPUT" ]
6case "$INPUT" in
7 *.mp4) OUTPUT=${INPUT%.mp4}.twitter.mp4 ;;
8 *.*) OUTPUT=${INPUT%.*}.twitter.mp4 ;;
9 *) OUTPUT=${INPUT}.twitter.mp4 ;;
10esac
11
12# source: https://gist.github.com/nikhan/26ddd9c4e99bbf209dd7
13
14if [ ! -e "$OUTPUT" ]
15then
16 ffmpeg -i "$INPUT" -vcodec libx264 \
17 -vf 'scale=640:trunc(ow/a/2)*2' \
18 -acodec aac \
19 -vb 1024k \
20 -minrate 1024k -maxrate 1024k \
21 -bufsize 1024k -ar 44100 \
22 -strict experimental \
23 -r 30 \
24 "$OUTPUT"
25fi
26
27# source: https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks/212518#212518
28
29CHUNKS=${OUTPUT%.mp4}.%03d.mp4
30ffmpeg -i "$OUTPUT" \
31 -c copy \
32 -map 0 \
33 -segment_time 2:15 -f segment -reset_timestamps 1 "$CHUNKS"
34