Repository navigation
Expand file tree
/
Copy pathcommand_line.sh
More file actions
110 lines (80 loc) · 3.13 KB
/
Copy pathcommand_line.sh
File metadata and controls
110 lines (80 loc) · 3.13 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# command line examples of datamoshing
# ------------------------------------------------------------------------------
# utilities for file conversion
# https://www.ffmpeg.org/
# convert mpg to avi
file='filename'
ffmpeg -i $file.mpg -c:v copy -c:a copy $file.avi
# batch convert mpg to avi
while IFS= read -d $'\0' -r file ; do
ffmpeg -i "$file" -c:v copy -c:a copy ${file%%.mpg}.avi
done < <(find . -iname '*.mpg' -print0)
# avidemux likes mkv files
ffmpeg -i file.mpg file.mkv
# ------------------------------------------------------------------------------
# utilities for automatically generating file names below
dir="$HOME/projects/videos"
# outputs unix timestamp
timestamp () {
date +"%s"
}
# adds "output" and a timestamp to an input filename
output () {
echo "${input%.*}_output_$(timestamp).${input##*.}"
}
# ------------------------------------------------------------------------------
# byebyte
# https://github.com/wayspurrchen/byebyte
input="$dir/stills30secs/stills30secs.mpg"
min=0.1
max=1
times=2500
continuous=true
continous_chance=0.5
chunk_min=5
chunk_max=20
byebyte destroy -i $input -o $(output) --min $min --max $max
byebyte destroy -i $input -o $(output) --min $min --max $max -t $times
byebyte destroy -i $input -o $(output) --min $min --max $max -t $times \
-c $continuous
byebyte destroy -i $input -o $(output) --min $min --max $max -t $times \
-c $continuous -C $continous_chance
byebyte shuffle -i $input -o $(output) --min $min --max $max \
--chunk-min $chunk_min --chunk-max $chunk_max
# ------------------------------------------------------------------------------
# AviGlitch
# https://github.com/fand/node-aviglitch
# input="$dir/motorcycle/motorcycle.avi"
input="$dir/PXL/PXL.avi"
datamosh $input -o $(output)
# ------------------------------------------------------------------------------
# automosh.py
# adapted from https://github.com/thisisparker/automosh
#
# I recommend running this in a virtual environment using pipenv
# https://pipenv.readthedocs.io/en/latest/
input="$dir/motorcycle/motorcycle.mpg"
replace="$dir/stills30secs/stills30secs.mpg"
pipenv shell
python -m automosh $input $(output)
python -m automosh $input $(output) -r $replace
# ------------------------------------------------------------------------------
# do_the_mosh.py
# adapted from https://github.com/happyhorseskull/you-can-datamosh-on-linux
#
# I recommend running this in a virtual environment using pipenv
# https://pipenv.readthedocs.io/en/latest/
input="$dir/motorcycle/motorcycle.mpg"
pipenv shell
python -m do_the_mosh $input
# ------------------------------------------------------------------------------
# split a video file in chunks
# see https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks
# cut up a file into 20 second clips
ffmpeg -i input.mp4 -c copy -map 0 -segment_time 00:00:20 \
-f segment output_%03d.mp4
# if you find that only the first chunk is playable,
# try adding `reset_timestamps 1`
ffmpeg -i input.mp4 -c copy -map 0 -segment_time 00:00:20 \
-f segment -reset_timestamps 1 output_%03d.mp4