Posts o[ubuntu] bash script
Post
Cancel

o[ubuntu] bash script

refence http://stackoverflow.com/a/3362952/1320686 http://askubuntu.com/a/353282

elementary

1
2
3
4
5
#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING

the following script scan all dirs recursive for *.mov filenames and convert them to mp4

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
#save this script to a file example test.sh
#run via : source test.sh

#!/bin/bash

##when filename contains space(s) is a conflict, resolve it via http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
##when filename contains space(s) is a conflict, resolve it via http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html

current_dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)

ddir="/home/admins/Desktop/x/encoded/"
i=100

#create new dir
#mkdir encoded

for g in $current_dir/*;
	do 
$i=i++

#list only *.mov
	for f in $g/*.mov;

		do
k=$i${f##*/}
			#convert to mp4
			ffmpeg -i "$f" -codec:v libx264 -crf 23 -preset medium -codec:a libfdk_aac $ddir/$k;
		done

	done

origin - http://www.pipiscrew.com/?p=2908 ubuntu-bash-script

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags