File: ffmpeg2theora.sh

package info (click to toggle)
ffmpeg2theora 0.30-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 596 kB
  • ctags: 526
  • sloc: ansic: 5,810; python: 1,021; sh: 83; makefile: 21; xml: 1
file content (47 lines) | stat: -rwxr-xr-x 1,228 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
# written by jan gerber <j@v2v.cc>
# profiles added by Dan Dennedy

usage()
{
	# Title
	echo "Title: Ogg Theora Export (ffmpeg2theora)"

	# Usable?
	which ffmpeg2theora > /dev/null
	[ $? -eq 0 ] && echo Status: Active || echo Status: Inactive

	# Type
	echo Flags: single-pass file-producer
	
	# Profiles
	echo "Profile: High Quality (640x480)"
	echo "Profile: Medium Quality (320x240)"
	echo "Profile: Broadband Quality (320x240)"
	echo "Profile: Low Quality (160x128)"
}

execute()
{
	# Arguments
	normalisation="$1"
	length="$2"
	profile="$3"
	file="$4"
	[ "x$file" = "x" ] && file="kino_export_"`date +%Y-%m-%d_%H.%M.%S`

	# Determine info arguments
	size=`[ "$normalisation" = "pal" ] && echo 352x288 || echo 352x240`
	video_bitrate=1152
	audio_bitrate=224

	# Run the command
	case "$profile" in 
		"0" ) 	ffmpeg2theora -f dv -x 640 -y 480 -d -v 7 -a 3 -H 48000 -o "$file".ogv - ;;
		"1" ) 	ffmpeg2theora -f dv -x 320 -y 240 -d -v 7 -a 3 -H 48000 -o "$file".ogv - ;;
		"2" ) 	ffmpeg2theora -f dv -x 320 -y 240 -d -v 5 -a 0 -H 44100 -o "$file".ogv - ;;
		"3" ) 	ffmpeg2theora -f dv -x 160 -y 128 -d -v 3 -a 0 -H 22000 -o "$file".ogv - ;;
	esac
}

[ "$1" = "--usage" ] || [ -z "$1" ] && usage "$@" || execute "$@"