We truncated the diff of some files because they were too big.
If you want to see the full diff for every file, click here.
Changes of Revision 6
tovid.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Sat Mar 14 15:34:58 UTC 2015 - aloisio@gmx.com
4
+
5
+- Update to 0.35
6
+ * full changelog at http://tovid.wikia.com/wiki/Tovid_changelog
7
+- Fixed build for 13.2 and newer
8
+
9
+-------------------------------------------------------------------
10
Fri Dec 26 15:40:08 UTC 2014 - obs@botter.cc
11
12
- Require /usr/bin/mkisofs instead of just mkisofs [PM-118]
13
tovid.spec
Changed
44
1
2
3
Summary: Video conversion and DVD authoring tools
4
Name: tovid
5
-Version: 0.34
6
+Version: 0.35
7
Release: 0.pm.1
8
Group: Productivity/Multimedia/Video/Editors and Convertors
9
-License: GNU General Public License version 2 or later (GPLv2 or later)
10
+License: GPL-2.0+
11
Url: http://tovid.sourceforge.net/
12
# http://tovid.googlecode.com/files/tovid-%{version}.tar.gz
13
-Source: tovid-%{version}.tar.bz2
14
+Source: tovid-%{version}.tar.gz
15
Source90: %{name}-rpmlintrc
16
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
17
%if %suse_version > 1110
18
19
%endif
20
Requires: python-cairo
21
Requires: python-imaging
22
-Requires: python-wxGTK
23
+%if 0%{?suse_version} >= 1320
24
+Requires: python-wxGTK >= 3.0
25
+%else
26
+Requires: python-wxGTK < 3.0
27
+%endif
28
Requires: sox
29
Requires: transcode
30
Requires: vcdimager
31
32
BuildRequires: normalize
33
BuildRequires: python-cairo
34
BuildRequires: python-imaging
35
-BuildRequires: python-wxGTK
36
+%if 0%{?suse_version} >= 1320
37
+BuildRequires: python-wxGTK >= 3.0
38
+%else
39
+BuildRequires: python-wxGTK < 3.0
40
+%endif
41
BuildRequires: sox
42
BuildRequires: transcode
43
BuildRequires: vcdimager
44
tovid-0.34.tar.bz2/libtovid/author.py
Deleted
201
1
2
-"""This module is for authoring a DVD or (S)VCD using dvdauthor or vcdimager.
3
-"""
4
-
5
-__all__ = [
6
- 'Disc',
7
- 'Menu',
8
- 'Video',
9
- 'Group',
10
- 'Titleset',
11
- 'vcdimager_xml',
12
- 'dvdauthor_xml',
13
-]
14
-
15
-from libtovid import xml
16
-
17
-
18
-###
19
-### Supporting classes
20
-###
21
-
22
-class Video:
23
- """A video title for inclusion on a video disc.
24
- """
25
- def __init__(self, filename, title=''):
26
- self.filename = filename
27
- self.title = title
28
- self.chapters = []
29
-
30
-
31
-class Group:
32
- """A group title for inclusion on a video disc.
33
- """
34
- def __init__(self, filenames, title):
35
- self.filenames = filenames
36
- self.title = title
37
-
38
-
39
-class Menu:
40
- """A menu for navigating the titles on a video disc.
41
- """
42
- def __init__(self, filename='', videos=None):
43
- """Create a menu linking to the given `Video`\s."""
44
- self.filename = filename
45
- self.videos = videos or []
46
-
47
- def add(self, video):
48
- """Add a `Video` to the Menu."""
49
- self.videos.append(video)
50
-
51
-
52
-class Titleset:
53
- """A group of `Video`\s, with an optional `Menu`.
54
- """
55
- def __init__(self, menu=None, videos=None):
56
- """Create a Titleset containing the given `Video`\s.
57
- """
58
- self.menu = menu
59
- self.videos = videos or []
60
-
61
- def add(self, video):
62
- """Add a `Video` to the Titleset."""
63
- self.videos.append(video)
64
-
65
-
66
-class Disc:
67
- """A video disc containing one or more `Titleset`\s, and an optional
68
- top `Menu` for navigating to each Titleset.
69
-
70
- """
71
- def __init__(self, name='Untitled', format='dvd', tvsys='ntsc',
72
- titlesets=None):
73
- """Create a Disc with the given properties.
74
-
75
- format
76
- 'vcd', 'svcd', or 'dvd'
77
- tvsys
78
- 'pal' or 'ntsc'
79
- title
80
- String containing the title of the disc
81
- titlesets
82
- List of `Titleset` objects
83
- """
84
- self.name = name
85
- self.format = format
86
- self.tvsys = tvsys
87
- self.topmenu = None
88
- self.titlesets = titlesets or []
89
-
90
-
91
-
92
-###
93
-### Internal functions
94
-###
95
-
96
-def _add_titleset(titleset, ts_id, segment_items, sequence_items, pbc):
97
- """Add titleset content to a vcdimager XML structure. This function is
98
- used internally, mainly to keep `vcdimager_xml` from being too long.
99
- """
100
- menu = titleset.menu
101
- videos = titleset.videos
102
- # Add menu
103
- if menu:
104
- segment_items.add('segment-item', src=menu.filename,
105
- id='seg-menu-%d' % ts_id)
106
- # Add menu to pbc
107
- selection = pbc.add('selection', id='select-menu-%d' % ts_id)
108
- selection.add('bsn', '1')
109
- # Link back to topmenu (not sure what'll happen if there isn't one...)
110
- selection.add('return', ref='select-topmenu')
111
- selection.add('loop', '0', jump_timing='immediate')
112
- selection.add('play-item', ref='seg-menu-%d' % ts_id)
113
- # Navigational links to titleset videos
114
- for video_id in range(len(videos)):
115
- selection.add('select',
116
- ref='play-title-%d-%d' % (ts_id, video_id))
117
- # Add videos
118
- for video_id, video in enumerate(videos):
119
- # Add sequence items
120
- sequence_item = sequence_items.add('sequence-item')
121
- sequence_item.set(id='seq-title-%d-%d' % (ts_id, video_id),
122
- src=video.filename)
123
- # Add chapter entries
124
- for chapterid, chapter in enumerate(video.chapters):
125
- sequence_item.add('entry', chapter, id='chapter-%d' % chapterid)
126
- # Add playlists to pbc
127
- playlist = pbc.add('playlist')
128
- playlist.set(id='play-title-%d-%d' % (ts_id, video_id))
129
- # Add prev/next links if appropriate
130
- if 0 <= video_id < len(videos):
131
- if 0 < video_id:
132
- playlist.add('prev',
133
- ref='play-title-%d-%d' % (ts_id, video_id-1))
134
- if video_id < len(videos) - 1:
135
- playlist.add('next',
136
- ref='play-title-%d-%d' % (ts_id, video_id+1))
137
- # Add a return link to the menu, if there is one
138
- if menu:
139
- playlist.add('return', ref='select-menu-%d' % ts_id)
140
- playlist.add('wait', '0')
141
- playlist.add('play-item', ref='seq-title-%d-%d' % (ts_id, video_id))
142
-
143
-
144
-###
145
-### Exported functions
146
-###
147
-
148
-def vcdimager_xml(disc):
149
- """Return the vcdimager XML string for the given `Disc`.
150
- """
151
- assert isinstance(disc, Disc)
152
- # XML header (will be added later)
153
- header = '<?xml version="1.0"?>\n'
154
- header += '<!DOCTYPE videocd PUBLIC "-//GNU/DTD VideoCD//EN"\n'
155
- header += ' "http://www.gnu.org/software/vcdimager/videocd.dtd">\n'
156
- # Root videocd element
157
- attributes = {
158
- 'xmlns': 'http://www.gnu.org/software/vcdimager/1.0/',
159
- 'class': disc.format}
160
- if disc.format == 'vcd':
161
- attributes['version'] = '2.0'
162
- else: # SVCD
163
- attributes['version'] = '1.0'
164
- root = xml.Element('videocd')
165
- root.set(**attributes)
166
- # Add info block
167
- info = root.add('info')
168
- info.add('album-id', 'VIDEO_DISC')
169
- info.add('volume-count', '1')
170
- info.add('volume-number', '1')
171
- info.add('restriction', '0')
172
- # Add pvd block
173
- pvd = root.add('pvd')
174
- pvd.add('volume-id', 'VIDEO_DISC')
175
- pvd.add('system-id', 'CD-RTOS CD-BRIDGE')
176
-
177
- # Add segment, sequence, and pbc
178
- segment_items = root.add('segment-items')
179
- sequence_items = root.add('sequence-items')
180
- pbc = root.add('pbc')
181
- # Add topmenu
182
- if disc.topmenu:
183
- segment_items.add('segment-item', src=disc.topmenu.filename,
184
- id='seg-topmenu')
185
- selection = pbc.add('selection', id='select-topmenu')
186
- selection.add('bsn', '1')
187
- selection.add('loop', '0', jump_timing='immediate')
188
- selection.add('play-item', ref='seg-topmenu')
189
- # Add titlesets
190
- for ts_id, titleset in enumerate(disc.titlesets):
191
- _add_titleset(titleset, ts_id, segment_items, sequence_items, pbc)
192
- # If we're doing a topmenu, add a link to the titleset menu
193
- if disc.topmenu:
194
- selection.add('select', ref='select-menu-%d' % ts_id)
195
-
196
- # Return XML with header prepended
197
- return header + str(root) + '\n'
198
-
199
-
200
-def dvdauthor_xml(disc):
201
tovid-0.34.tar.bz2/libtovid/backend
Deleted
2
1
-(directory)
2
tovid-0.34.tar.bz2/libtovid/backend/__init__.py
Deleted
9
1
2
-"""Backends, which do some task using a command-line program.
3
-
4
-This module is split into submodules, each named after the command-line
5
-program they predominantly rely on. Backends which use several of these
6
-submodules may be defined here in ``__init__.py``.
7
-"""
8
-
9
tovid-0.34.tar.bz2/libtovid/backend/ffmpeg.py
Deleted
181
1
2
-"""Video encoding and identification using ``ffmpeg``.
3
-"""
4
-
5
-__all__ = [
6
- 'encode',
7
- 'encode_audio',
8
- 'identify',
9
-]
10
-
11
-import re
12
-from libtovid import log
13
-from libtovid import cli
14
-
15
-def encode(source, target, **kw):
16
- """Encode a multimedia video using ffmpeg.
17
-
18
- source
19
- Input `~libtovid.media.MediaFile`
20
- target
21
- Output `~libtovid.media.MediaFile`
22
- kw
23
- Keyword arguments to customize encoding behavior
24
-
25
- Supported keywords:
26
-
27
- quant
28
- Minimum quantization, from 1-31 (1 being fewest artifacts)
29
- vbitrate
30
- Maximum video bitrate, in kilobits per second.
31
- abitrate
32
- Audio bitrate, in kilobits per second
33
- interlace
34
- 'top' or 'bottom', to do interlaced encoding with
35
- top or bottom field first
36
-
37
- For example::
38
-
39
- ffmpeg_encode(source, target, quant=4, vbitrate=7000)
40
- """
41
- cmd = cli.Command('ffmpeg', '-y', '-i', source.filename)
42
-
43
- # Use format/tvsys that ffmpeg knows about
44
- if target.format in ['vcd', 'svcd', 'dvd']:
45
- cmd.add('-tvstd', target.tvsys,
46
- '-target', '%s-%s' % (target.tvsys, target.format))
47
-
48
- # Interpret keyword arguments
49
- if 'quant' in kw:
50
- cmd.add('-qmin', kw['quant'], '-qmax', 31)
51
- if 'vbitrate' in kw:
52
- cmd.add('-b', '%dk' % kw['vbitrate'])
53
- if 'abitrate' in kw:
54
- cmd.add('-ab', '%dk' % kw['abitrate'])
55
- if 'interlace' in kw:
56
- if kw['interlace'] == 'bottom':
57
- cmd.add('-top', 0, '-flags', '+alt+ildct+ilme')
58
- elif kw['interlace'] == 'top':
59
- cmd.add('-top', 1, '-flags', '+alt+ildct+ilme')
60
-
61
- # Frame rate and audio sampling rate
62
- cmd.add('-r', target.fps,
63
- '-ar', target.samprate)
64
-
65
- # Convert scale/expand to ffmpeg's padding system
66
- if target.scale:
67
- cmd.add('-s', '%sx%s' % target.scale)
68
- # Letterbox if necessary
69
- if target.expand != target.scale:
70
- e_width, e_height = target.expand
71
- s_width, s_height = target.scale
72
- h_pad = (e_width - s_width) / 2
73
- v_pad = (e_height - s_height) / 2
74
- if h_pad > 0:
75
- cmd.add('-padleft', h_pad, '-padright', h_pad)
76
- if v_pad > 0:
77
- cmd.add('-padtop', v_pad, '-padbottom', v_pad)
78
-
79
- # Aspect
80
- if target.widescreen:
81
- cmd.add('-aspect', '16:9')
82
- else:
83
- cmd.add('-aspect', '4:3')
84
-
85
- cmd.add(target.filename)
86
- cmd.run()
87
-
88
-
89
-def encode_audio(source, audiofile, target):
90
- """Encode the audio stream in a source file to a target format, saving
91
- to the given filename.
92
-
93
- source
94
- Input `~libtovid.media.MediaFile`
95
- audiofile
96
- Filename for encoded audio
97
- target
98
- Output `~libtovid.media.MediaFile`
99
-
100
- If no audio is present in the source file, encode silence.
101
- """
102
- cmd = cli.Command('ffmpeg')
103
-
104
- # If source has audio, encode it
105
- if source.has_audio:
106
- cmd.add('-i', source.filename)
107
- # Otherwise, encode silence (minimum 4 seconds)
108
- else:
109
- cmd.add('-f', 's16le', '-i', '/dev/zero')
110
- if source.length < 4:
111
- cmd.add('-t', '4.0')
112
- else:
113
- cmd.add('-t', '%f' % source.length)
114
-
115
- cmd.add('-vn', '-ac', '2', '-ab', '224k')
116
- cmd.add('-ar', target.samprate)
117
- cmd.add('-acodec', target.acodec)
118
- cmd.add('-y', audiofile)
119
-
120
- cmd.run()
121
-
122
-
123
-from libtovid.media import MediaFile
124
-
125
-def identify(filename):
126
- """Identify a video file using ffmpeg, and return a
127
- `~libtovid.media.MediaFile` with the video's specifications.
128
- """
129
- result = MediaFile(filename)
130
-
131
- cmd = cli.Command('ffmpeg', '-i', filename)
132
- cmd.run(capture=True)
133
-
134
- # ffmpeg puts its output on stderr
135
- output = cmd.get_errors()
136
-
137
- video_line = re.compile(''
138
- 'Stream (?P<tracknum>[^:]+): Video: ' # Track number (ex. #0.0)
139
- '(?P<vcodec>[^,]+), ' # Video codec (ex. mpeg4)
140
- '(?P<colorspace>[^,]+), ' # Color space (ex. yuv420p)
141
- '(?P<width>\d+)x(?P<height>\d+), ' # Resolution (ex. 720x480)
142
- '((?P<vbitrate>\d+) kb/s, )?' # Video bitrate (ex. 8000 kb/s)
143
- '(?P<fps>[\d.]+)') # FPS (ex. 29.97 fps(r))
144
-
145
- audio_line = re.compile(''
146
- 'Stream (?P<tracknum>[^:]+): Audio: ' # Track number (ex. #0.1)
147
- '(?P<acodec>[^,]+), ' # Audio codec (ex. mp3)
148
- '(?P<samprate>\d+) Hz, ' # Sampling rate (ex. 44100 Hz)
149
- '(?P<channels>[^,]+), ' # Channels (ex. stereo)
150
- '(?P<abitrate>\d+) kb/s') # Audio bitrate (ex. 128 kb/s)
151
-
152
- # Parse ffmpeg output and set MediaFile attributes
153
- for line in output.split('\n'):
154
- video_match = video_line.search(line)
155
- audio_match = audio_line.search(line)
156
-
157
- if video_match:
158
- m = video_match
159
- result.vcodec = m.group('vcodec')
160
- result.scale = (int(m.group('width')),
161
- int(m.group('height')))
162
- result.expand = result.scale
163
- result.fps = float(m.group('fps'))
164
- if m.group('vbitrate'):
165
- result.vbitrate = int(m.group('vbitrate'))
166
-
167
- elif audio_match:
168
- m = audio_match
169
- result.acodec = m.group('acodec')
170
- result.samprate = int(m.group('samprate'))
171
- result.abitrate = int(m.group('abitrate'))
172
- if m.group('channels') == '5.1':
173
- result.channels = 6
174
- elif m.group('channels') == 'stereo':
175
- result.channels = 2
176
- else:
177
- result.channels = 1
178
-
179
- return result
180
-
181
tovid-0.34.tar.bz2/libtovid/backend/mpeg2enc.py
Deleted
201
1
2
-"""Video and frame encoding using ``mpeg2enc``.
3
-"""
4
-
5
-__all__ = [
6
- 'encode',
7
- 'encode_video',
8
- 'encode_frames',
9
-]
10
-
11
-# TODO: Filter out some of the inter-backend dependencies
12
-
13
-import os, glob
14
-from libtovid import log
15
-from libtovid import util
16
-from libtovid import cli
17
-from libtovid.backend import mplex, mplayer, ffmpeg
18
-
19
-def encode(source, target, **kw):
20
- """Encode a multimedia video using mplayer|yuvfps|mpeg2enc.
21
-
22
- source
23
- Input `~libtovid.media.MediaFile`
24
- target
25
- Output `~libtovid.media.MediaFile`
26
- kw
27
- Keyword arguments to customize encoding behavior
28
-
29
- Supported keywords:
30
-
31
- None yet
32
-
33
- """
34
- log.warning("This encoder is very experimental, and may not work.")
35
-
36
- outname = target.filename
37
- # YUV raw video FIFO, for piping video from mplayer to mpeg2enc
38
- yuvfile = '%s.yuv' % outname
39
- if os.path.exists(yuvfile):
40
- os.remove(yuvfile)
41
-
42
- # Filenames for intermediate streams (ac3/m2v etc.)
43
- # Appropriate suffix for audio stream
44
- if target.format in ['vcd', 'svcd']:
45
- audiofile = '%s.mp2' % outname
46
- else:
47
- audiofile = '%s.ac3' % outname
48
- # Appropriate suffix for video stream
49
- if target.format == 'vcd':
50
- videofile = '%s.m1v' % outname
51
- else:
52
- videofile = '%s.m2v' % outname
53
- # Do audio
54
- ffmpeg.encode_audio(source, audiofile, target)
55
- # Do video
56
- mplayer.rip_video(source, yuvfile, target)
57
- encode_video(source, yuvfile, videofile, target)
58
- # Combine audio and video
59
- mplex.mux(videofile, audiofile, target)
60
-
61
-
62
-
63
-def encode_video(source, yuvfile, videofile, target):
64
- """Encode a yuv4mpeg stream to an MPEG video stream.
65
-
66
- source
67
- Input `~libtovid.media.MediaFile`
68
- yuvfile
69
- Filename of .yuv stream coming from mplayer
70
- videofile
71
- Filename of .m[1|2]v to write encoded video stream to
72
- target
73
- Output `~libtovid.media.MediaFile`
74
-
75
- """
76
- # TODO: Control over quality (bitrate/quantization) and disc split size,
77
- # corresp. to $VID_BITRATE, $MPEG2_QUALITY, $DISC_SIZE, etc.
78
- # Missing options (compared to tovid)
79
- # -S 700 -B 247 -b 2080 -v 0 -4 2 -2 1 -q 5 -H -o FILE
80
- pipe = cli.Pipe()
81
-
82
- # Feed the .yuv file into the pipeline
83
- cat = cli.Command('cat', yuvfile)
84
- pipe.add(cat)
85
-
86
- # Adjust framerate if necessary by piping through yuvfps
87
- if source.fps != target.fps:
88
- log.info("Adjusting framerate")
89
- yuvfps = cli.Command('yuvfps')
90
- yuvfps.add('-r', util.float_to_ratio(target.fps))
91
- pipe.add(yuvfps)
92
-
93
- # Encode the resulting .yuv stream by piping into mpeg2enc
94
- mpeg2enc = cli.Command('mpeg2enc')
95
- # TV system
96
- if target.tvsys == 'pal':
97
- mpeg2enc.add('-F', '3', '-n', 'p')
98
- elif target.tvsys == 'ntsc':
99
- mpeg2enc.add('-F', '4', '-n', 'n')
100
- # Format
101
- format = target.format
102
- if format == 'vcd':
103
- mpeg2enc.add('-f', '1')
104
- elif format == 'svcd':
105
- mpeg2enc.add('-f', '4')
106
- elif 'dvd' in format:
107
- mpeg2enc.add('-f', '8')
108
- # Aspect ratio
109
- if target.widescreen:
110
- mpeg2enc.add('-a', '3')
111
- else:
112
- mpeg2enc.add('-a', '2')
113
- mpeg2enc.add('-o', videofile)
114
- pipe.add(mpeg2enc)
115
-
116
- # Run the pipeline to encode the video stream
117
- pipe.run()
118
-
119
-
120
-# --------------------------------------------------------------------------
121
-#
122
-# Frame encoder
123
-#
124
-# --------------------------------------------------------------------------
125
-from libtovid import standard
126
-
127
-def encode_frames(imagedir, outfile, format, tvsys, aspect, interlaced=False):
128
- """Convert an image sequence in the given directory to match a target
129
- `~libtovid.media.MediaFile`, putting the output stream in outfile.
130
-
131
- imagedir
132
- Directory containing images (and only images)
133
- outfile
134
- Filename for output.
135
- tvsys
136
- TVsys desired for output (to deal with FPS)
137
- aspect
138
- Aspect ratio ('4:3', '16:9')
139
- interlaced
140
- Frames are interlaced material
141
-
142
- Currently supports JPG and PNG images; input images must already be
143
- at the desired target resolution.
144
- """
145
-
146
- # Use absolute path name
147
- imagedir = os.path.abspath(imagedir)
148
- print("Creating video stream from image sequence in %s" % imagedir)
149
- # Determine image type
150
- images = glob.glob("%s/*" % imagedir)
151
- extension = images[0][-3:]
152
- if extension not in ['jpg', 'png']:
153
- raise ValueError("Image format '%s' isn't currently supported to "
154
- "render video from still frames" % extension)
155
- # Make sure remaining image files have the same extension
156
- for img in images:
157
- if not img.endswith(extension):
158
- raise ValueError("%s does not have a .%s extension" %
159
- (img, extension))
160
-
161
- pipe = cli.Pipe()
162
-
163
- # Use jpeg2yuv/png2yuv to stream images
164
- if extension == 'jpg':
165
- jpeg2yuv = cli.Command('jpeg2yuv')
166
-
167
- jpeg2yuv.add('-Ip') # Progressive
168
-
169
- jpeg2yuv.add('-f', '%.3f' % standard.fps(tvsys),
170
- '-j', '%s/%%08d.%s' % (imagedir, extension))
171
- pipe.add(jpeg2yuv)
172
- elif extension == 'png':
173
- #ls = cli.Command('sh', '-c', 'ls %s/*.png' % imagedir)
174
- #xargs = cli.Command('xargs', '-n1', 'pngtopnm')
175
- png2yuv = cli.Command('png2yuv')
176
-
177
- png2yuv.add('-Ip') # Progressive
178
-
179
-
180
- png2yuv.add('-f', '%.3f' % standard.fps(tvsys),
181
- '-j', '%s/%%08d.png' % (imagedir))
182
-
183
- pipe.add(png2yuv)
184
-
185
- #pipe.add(ls, xargs, png2yuv)
186
- #cmd += 'pnmtoy4m -Ip -F %s %s/*.png' % standard.fps_ratio(tvsys)
187
-
188
- # TODO: Scale to correct target size using yuvscaler or similar
189
-
190
- # Pipe image stream into mpeg2enc to encode
191
- mpeg2enc = cli.Command('mpeg2enc')
192
-
193
- # Anyways.
194
- mpeg2enc.add('-I 0') # Progressive
195
-
196
- # Bottom-first, determined in render/drawing.py::interlace_drawings()
197
- if (interlaced):
198
- mpeg2enc.add('--playback-field-order', 'b') # Bottom-first field order
199
- # conforming to drawing.py::interlace_drawings()
200
-
201
tovid-0.34.tar.bz2/libtovid/backend/mplayer.py
Deleted
201
1
2
-"""Video encoding, ripping, and identification using ``mplayer``.
3
-"""
4
-
5
-__all__ = [
6
- 'encode',
7
- 'identify',
8
- 'rip_video',
9
-]
10
-
11
-from libtovid import log
12
-from libtovid import cli
13
-from libtovid.media import MediaFile
14
-from libtovid.backend import ffmpeg
15
-
16
-def encode(source, target, **kw):
17
- """Encode a multimedia video using mencoder.
18
-
19
- source
20
- Input `~libtovid.media.MediaFile`
21
- target
22
- Output `~libtovid.media.MediaFile`
23
- kw
24
- Keyword arguments to customize encoding behavior
25
-
26
- Supported keywords:
27
-
28
- None yet
29
-
30
- """
31
- cmd = cli.Command('mencoder')
32
- cmd.add(source.filename,
33
- '-o', target.filename,
34
- '-oac', 'lavc',
35
- '-ovc', 'lavc',
36
- '-of', 'mpeg')
37
- # Format
38
- cmd.add('-mpegopts')
39
- if target.format in ['vcd', 'svcd']:
40
- cmd.add('format=x%s' % target.format)
41
- else:
42
- cmd.add('format=dvd')
43
-
44
- # FIXME: This assumes we only have ONE audio track.
45
- if source.has_audio:
46
- # Adjust audio sampling rate if necessary
47
- if source.samprate != target.samprate:
48
- log.info("Resampling needed to achieve %d Hz" % target.samprate)
49
- cmd.add('-srate', target.samprate)
50
- cmd.add('-af', 'lavcresample=%s' % target.samprate)
51
- else:
52
- log.info("No resampling needed, already at %d Hz" % target.samprate)
53
-
54
- else:
55
- log.info("No audio file, generating silence of %f seconds." % \
56
- source.length)
57
- # Generate silence.
58
- if target.format in ['vcd', 'svcd']:
59
- audiofile = '%s.mpa' % target.filename
60
- else:
61
- audiofile = '%s.ac3' % target.filename
62
- ffmpeg.encode_audio(source, audiofile, target)
63
- # TODO: make this work, it's still not adding the ac3 file correctly.
64
- cmd.add('-audiofile', audiofile)
65
-
66
- # Video codec
67
- if target.format == 'vcd':
68
- lavcopts = 'vcodec=mpeg1video'
69
- else:
70
- lavcopts = 'vcodec=mpeg2video'
71
- # Audio codec
72
- lavcopts += ':acodec=%s' % target.acodec
73
- lavcopts += ':abitrate=%s:vbitrate=%s' % \
74
- (target.abitrate, target.vbitrate)
75
- # Maximum video bitrate
76
- lavcopts += ':vrc_maxrate=%s' % target.vbitrate
77
- if target.format == 'vcd':
78
- lavcopts += ':vrc_buf_size=327'
79
- elif target.format == 'svcd':
80
- lavcopts += ':vrc_buf_size=917'
81
- else:
82
- lavcopts += ':vrc_buf_size=1835'
83
- # Set appropriate target aspect
84
- if target.widescreen:
85
- lavcopts += ':aspect=16/9'
86
- else:
87
- lavcopts += ':aspect=4/3'
88
- # Pass all lavcopts together
89
- cmd.add('-lavcopts', lavcopts)
90
-
91
- # FPS
92
- if target.tvsys == 'pal':
93
- cmd.add('-ofps', '25/1')
94
- elif target.tvsys == 'ntsc':
95
- cmd.add('-ofps', '30000/1001') # ~= 29.97
96
-
97
- # Scale/expand to fit target frame
98
- if target.scale:
99
- vfilter = 'scale=%s:%s' % target.scale
100
- # Expand is not done unless also scaling
101
- if target.expand != target.scale:
102
- vfilter += ',expand=%s:%s' % target.expand
103
- cmd.add('-vf', vfilter)
104
-
105
- cmd.run()
106
-
107
-
108
-def identify(filename):
109
- """Identify a video file using mplayer, and return a
110
- `~libtovid.media.MediaFile` with the video's specifications.
111
- """
112
- # TODO: Raise an exception if the file couldn't be identified
113
- # TODO: Infer aspect ratio
114
-
115
- media = MediaFile(filename)
116
-
117
- mp_dict = {}
118
- # Use mplayer
119
- cmd = cli.Command('mplayer',
120
- '-identify',
121
- '%s' % filename,
122
- '-vo', 'null',
123
- '-ao', 'null',
124
- '-frames', '1',
125
- '-channels', '6')
126
- cmd.run(capture=True)
127
-
128
- # Look for mplayer's "ID_..." lines and include each assignment in mp_dict
129
- for line in cmd.get_output().splitlines():
130
- log.debug(line)
131
- if line.startswith("ID_"):
132
- left, right = line.split('=')
133
- mp_dict[left] = right.strip()
134
-
135
- # Check for existence of streams
136
- if 'ID_VIDEO_ID' in mp_dict:
137
- media.has_video = True
138
- else:
139
- media.has_video = False
140
- if 'ID_AUDIO_ID' in mp_dict:
141
- media.has_audio = True
142
- else:
143
- media.has_audio = False
144
-
145
- # Parse the dictionary and set appropriate values
146
- for left, right in mp_dict.iteritems():
147
- if left == "ID_VIDEO_WIDTH":
148
- media.scale = (int(right), media.scale[1])
149
- elif left == "ID_VIDEO_HEIGHT":
150
- media.scale = (media.scale[0], int(right))
151
- elif left == "ID_VIDEO_FPS":
152
- media.fps = float(right)
153
- elif left == "ID_VIDEO_FORMAT":
154
- media.vcodec = right
155
- elif left == "ID_VIDEO_BITRATE":
156
- media.vbitrate = int(right) / 1000
157
- elif left == "ID_AUDIO_CODEC":
158
- media.acodec = right
159
- elif left == "ID_AUDIO_FORMAT":
160
- pass
161
- elif left == "ID_AUDIO_BITRATE":
162
- media.abitrate = int(right) / 1000
163
- elif left == "ID_AUDIO_RATE":
164
- media.samprate = int(right)
165
- elif left == "ID_AUDIO_NCH":
166
- media.channels = right
167
- elif left == 'ID_LENGTH':
168
- media.length = float(right)
169
- media.expand = media.scale
170
-
171
- # Fix mplayer's audio codec naming for ac3 and mp2
172
- if media.acodec == "8192":
173
- media.acodec = "ac3"
174
- elif media.acodec == "80":
175
- media.acodec = "mp2"
176
- # Fix mplayer's video codec naming for mpeg1 and mpeg2
177
- if media.vcodec == "0x10000001":
178
- media.vcodec = "mpeg1"
179
- elif media.vcodec == "0x10000002":
180
- media.vcodec = "mpeg2"
181
- return media
182
-
183
-
184
-
185
-
186
-def rip_video(source, yuvfile, target):
187
- """Rip video to the given yuv4mpeg file.
188
-
189
- source
190
- Input `~libtovid.media.MediaFile`
191
- yuvfile
192
- File to put ripped video in
193
- target
194
- Output `~libtovid.media.MediaFile`
195
-
196
- """
197
- # TODO: Custom mplayer options, subtitles, interlacing,
198
- # corresp. to $MPLAYER_OPT, $SUBTITLES, $VF_PRE/POST, $YUV4MPEG_ILACE,
199
- # etc.
200
- cmd = cli.Command('mplayer')
201
tovid-0.34.tar.bz2/libtovid/backend/mplex.py
Deleted
40
1
2
-"""Multiplexing using ``mplex``.
3
-"""
4
-
5
-__all__ = [
6
- 'mux',
7
-]
8
-
9
-from libtovid import cli
10
-
11
-def mux(vstream, astream, target):
12
- """Multiplex audio and video stream files to the given target.
13
-
14
- vstream
15
- Filename of MPEG video stream
16
- astream
17
- Filename of MP2/AC3 audio stream
18
- target
19
- Profile of output file
20
-
21
- """
22
- cmd = cli.Command('mplex')
23
- format = target.format
24
- if format == 'vcd':
25
- cmd.add('-f', '1')
26
- elif format == 'dvd-vcd':
27
- cmd.add('-V', '-f', '8')
28
- elif format == 'svcd':
29
- cmd.add('-V', '-f', '4', '-b', '230')
30
- elif format == 'half-dvd':
31
- cmd.add('-V', '-f', '8', '-b', '300')
32
- elif format == 'dvd':
33
- cmd.add('-V', '-f', '8', '-b', '400')
34
- # elif format == 'kvcd':
35
- # cmd += ' -V -f 5 -b 350 -r 10800 '
36
- cmd.add(vstream, astream, '-o', target.filename)
37
- # Run the command to multiplex the streams
38
- cmd.run()
39
-
40
tovid-0.34.tar.bz2/libtovid/backend/spumux.py
Deleted
182
1
2
-"""This module is for adding subtitles to MPEG video files using spumux.
3
-
4
-Defined here are two functions for adding subtitles to an MPEG file:
5
-
6
- `add_subpictures`
7
- Add image files (``.png``)
8
- `add_subtitles`
9
- Add subtitle files (``.sub``, ``.srt`` etc.)
10
-
11
-Use these if you just want to add subpictures or subtitles, and don't want
12
-to think much about the XML internals.
13
-"""
14
-
15
-__all__ = [
16
- 'add_subpictures',
17
- 'add_subtitles',
18
-]
19
-
20
-import os
21
-from libtovid import util
22
-from libtovid import xml
23
-from libtovid import cli
24
-from libtovid.backend import mplayer
25
-
26
-# spumux XML elements and valid attributes
27
-#
28
-# subpictures
29
-# stream
30
-# textsub
31
-# ['filename',
32
-# 'characterset',
33
-# 'fontsize',
34
-# 'font',
35
-# 'horizontal-alignment',
36
-# 'vertical-alignment',
37
-# 'left-margin',
38
-# 'right-margin',
39
-# 'subtitle-fps',
40
-# 'movie-fps',
41
-# 'movie-width',
42
-# 'movie-height']
43
-# button
44
-# ['name',
45
-# 'x0', 'y0', # Upper-left corner, inclusively
46
-# 'x1', 'y1', # Lower-right corner, exclusively
47
-# 'up', 'down', 'left', 'right']
48
-# action
49
-# ['name']
50
-# spu
51
-# ['start',
52
-# 'end',
53
-# 'image',
54
-# 'highlight',
55
-# 'select',
56
-# 'transparent', # color code
57
-# 'force', # 'yes' (force display, required for menus)
58
-# 'autooutline', # 'infer'
59
-# 'outlinewidth',
60
-# 'autoorder', # 'rows' or 'columns'
61
-# 'xoffset',
62
-# 'yoffset']
63
-
64
-def _get_xml(textsub_or_spu):
65
- """Return an XML string for the given Textsub or Spu element.
66
- """
67
- subpictures = xml.Element('subpictures')
68
- stream = subpictures.add('stream')
69
- stream.add_child(textsub_or_spu)
70
- return str(subpictures)
71
-
72
-
73
-def _get_xmlfile(textsub_or_spu):
74
- """Write spumux XML file for the given Textsub or Spu element, and
75
- return the written filename.
76
- """
77
- xmldata = _get_xml(textsub_or_spu)
78
- xmlfile = open(util.temp_file(suffix=".xml"), 'w')
79
- xmlfile.write(xmldata)
80
- xmlfile.close()
81
- return xmlfile.name
82
-
83
-
84
-def _mux_subs(subtitle, movie_filename, stream_id=0):
85
- """Run spumux to multiplex the given subtitle with an ``.mpg`` file.
86
-
87
- subtitle
88
- Textsub or Spu element
89
- movie_filename
90
- Name of an ``.mpg`` file to multiplex subtitle into
91
- stream_id
92
- Stream ID number to pass to spumux
93
- """
94
- # Create XML file for subtitle element
95
- xmlfile = _get_xmlfile(subtitle)
96
- # Create a temporary .mpg for the subtitled output
97
- #base_dir = os.path.dirname(movie_filename)
98
- subbed_filename = util.temp_file(suffix=".mpg")
99
- # spumux xmlfile < movie_filename > subbed_filename
100
- spumux = cli.Command('spumux', '-s%s' % stream_id, xmlfile.name)
101
- spumux.run_redir(movie_filename, subbed_filename)
102
- spumux.wait()
103
-
104
- # Remove old file
105
- os.remove(movie_filename)
106
- # Rename temporary file to new file
107
- os.rename(subbed_filename, movie_filename)
108
- # Remove the XML file
109
- os.remove(xmlfile.name)
110
-
111
-
112
-def add_subpictures(movie_filename, select, image=None, highlight=None):
113
- """Adds ``.png`` subpictures to an ``.mpg`` video file to create a DVD menu.
114
-
115
- select
116
- ``.png`` filename shown for the navigational selector or "cursor"
117
- image
118
- ``.png`` filename shown for non-selected regions
119
- highlight
120
- ``.png`` filename shown when "enter" is pressed
121
-
122
- All images must be indexed, 4-color, transparent, non-antialiased PNG.
123
- Button regions are auto-inferred.
124
- """
125
- spu = xml.Element('spu')
126
- spu.set(start='0',
127
- force='yes',
128
- select=select,
129
- image=image,
130
- highlight=highlight)
131
- # TODO Find a good default outlinewidth
132
- spu.set(autooutline='infer', outlinewidth='10')
133
- # TODO: Support explicit button regions
134
- _mux_subs(spu, movie_filename)
135
-
136
-
137
-def add_subtitles(movie_filename, sub_filenames):
138
- """Adds one or more subtitle files to an ``.mpg`` video file.
139
-
140
- movie_filename
141
- Name of ``.mpg`` file to add subtitles to
142
- sub_filenames
143
- Filename or list of filenames of subtitle
144
- files to include (``.sub``, ``.srt`` etc.)
145
-
146
- """
147
- infile = mplayer.identify(movie_filename)
148
- width, height = infile.scale
149
-
150
- # Convert sub_filenames to list if necessary
151
- if type(sub_filenames) == str:
152
- sub_filenames = [sub_filenames]
153
- # spumux each subtitle file with its own stream ID
154
- for stream_id, sub_filename in enumerate(sub_filenames):
155
- # <textsub attribute="value" .../>
156
- textsub = xml.Element('textsub')
157
- textsub.set(movie_fps=infile.fps,
158
- movie_width=width,
159
- movie_height=height,
160
- filename=sub_filename)
161
- _mux_subs(textsub, movie_filename, stream_id)
162
-
163
-
164
-
165
-if __name__ == '__main__':
166
- print("spumux XML examples")
167
-
168
- print("Subpicture example:")
169
- spu = xml.Element('spu')
170
- spu.add('button', name='but1', down='but2')
171
- spu.add('button', name='but2', up='but1')
172
- print(_get_xml(spu))
173
-
174
- print("Text subtitle example:")
175
- textsub = xml.Element('textsub')
176
- textsub.set(filename='foo.sub',
177
- fontsize=14.0,
178
- font="Luxi Mono")
179
- print(_get_xml(textsub))
180
-
181
-
182
tovid-0.34.tar.bz2/libtovid/backend/transcode.py
Deleted
121
1
2
-"""Video frame ripping and video identification using ``transcode``.
3
-"""
4
-
5
-# Sample output from tcprobe:
6
-#
7
-# [tcprobe] RIFF data, AVI video
8
-# [avilib] V: 24.000 fps, codec=DIVX, frames=15691, width=1024, height=576
9
-# [avilib] A: 48000 Hz, format=0x2000, bits=0, channels=5, bitrate=448 kbps,
10
-# [avilib] 10216 chunks, 36614144 bytes, CBR
11
-# [tcprobe] summary for Elephants_1024.avi, (*) = not default, 0 = not
12
-# detected
13
-# import frame size: -g 1024x576 [720x576] (*)
14
-# frame rate: -f 24.000 [25.000] frc=0 (*)
15
-# audio track: -a 0 [0] -e 48000,0,5 [48000,16,2] -n 0x2000 [0x2000] (*)
16
-# bitrate=448 kbps
17
-# length: 15691 frames, frame_time=41 msec, duration=0:10:53.790
18
-
19
-__all__ = [
20
- 'identify',
21
- 'rip_frames',
22
-]
23
-
24
-import os, re, glob
25
-from libtovid import log
26
-from libtovid import cli
27
-from libtovid.media import MediaFile
28
-
29
-def identify(filename):
30
- """Identify a video file using transcode (tcprobe), and return a
31
- `~libtovid.media.MediaFile` with the video's specifications.
32
- """
33
- result = MediaFile(filename)
34
-
35
- cmd = cli.Command('tcprobe', '-i', filename)
36
- cmd.run(capture=True)
37
- output = cmd.get_output()
38
-
39
- video_line = re.compile('V: '
40
- '(?P<fps>[\d.]+) fps, '
41
- 'codec=(?P<vcodec>[^,]+), '
42
- 'frames=\d+, '
43
- 'width=(?P<width>\d+), '
44
- 'height=(?P<height>\d+)')
45
-
46
- audio_line = re.compile('A: '
47
- '(?P<samprate>\d+) Hz, '
48
- 'format=(?P<acodec>[^,]+), '
49
- 'bits=\d+, '
50
- 'channels=(?P<channels>[^,]+), '
51
- 'bitrate=(?P<abitrate>\d+) kbps')
52
-
53
- for line in output.split('\n'):
54
- if 'V: ' in line:
55
- match = video_line.search(line)
56
- result.fps = float(match.group('fps'))
57
- result.vcodec = match.group('vcodec')
58
- result.scale = (int(match.group('width')),
59
- int(match.group('height')))
60
- result.expand = result.scale
61
-
62
- elif 'A: ' in line:
63
- match = audio_line.search(line)
64
- result.acodec = match.group('acodec')
65
- result.samprate = int(match.group('samprate'))
66
- result.abitrate = int(match.group('abitrate'))
67
- result.channels = int(match.group('channels'))
68
-
69
- return result
70
-
71
-
72
-def rip_frames(media, out_dir, frames='all', size=(0, 0)):
73
- """Extract frame images from a `~libtovid.media.MediaFile` and return a
74
- list of frame image files.
75
-
76
- media
77
- `~libtovid.media.MediaFile` to extract images from
78
- out_dir
79
- Directory where output images should be stored; images are saved
80
- in a subdirectory of ``out_dir`` named after the input filename
81
- frames
82
- Which frames to rip: ``'all'`` for all frames, ``15`` to rip frame
83
- 15; ``[30, 90]`` to rip frames 30 through 90, etc.
84
- size
85
- Resolution of frame images (default: original size), used
86
- for prescaling
87
-
88
- """
89
- out_dir = os.path.abspath(out_dir)
90
- if os.path.exists(out_dir):
91
- log.warning("Temp directory: %s already exists. Overwriting." % out_dir)
92
- os.system('rm -rf "%s"' % out_dir)
93
- os.mkdir(out_dir)
94
-
95
- # TODO: use tcdemux to generate a nav index, like:
96
- # tcdemux -f 29.970 -W -i "$FILE" > "$NAVFILE"
97
-
98
- # Use transcode to rip frames
99
- cmd = cli.Command('transcode',
100
- '-i', '%s' % media.filename)
101
- # Resize
102
- if size != (0, 0):
103
- cmd.add('-Z', '%sx%s' % size)
104
- # Encode selected frames
105
- if frames == 'all':
106
- # transcode does all by default
107
- pass
108
- elif isinstance(frames, int):
109
- # rip a single frame
110
- cmd.add('-c', '%s-%s' % (frames, frames))
111
- elif isinstance(frames, list):
112
- # rip a range of frames
113
- cmd.add('-c', '%s-%s' % (frames[0], frames[-1]))
114
- cmd.add('-y', 'jpg,null')
115
- cmd.add('-o', '%s/frame_' % out_dir)
116
- log.info("Creating image sequence from %s" % media.filename)
117
- cmd.run()
118
-
119
- # Return a list of ripped files
120
- return glob.glob('%s/frame_*.jpg' % out_dir)
121
tovid-0.34.tar.bz2/libtovid/deps.py
Deleted
201
1
2
-"""This module is for verifying libtovid's run-time dependencies.
3
-For example::
4
-
5
- deps.require(deps.core)
6
-
7
-will look for all of tovid's core dependencies. If any cannot be found, the
8
-missing ones are printed and an exception is raised. Run ``deps.py`` from a prompt
9
-for further examples.
10
-
11
-In practice::
12
-
13
- try:
14
- deps.require(deps.core)
15
- except deps.MissingDep:
16
- print("Exiting...")
17
- sys.exit(1)
18
-
19
-`deps.core` is an internal dictionary of tovid's core dependencies, where the
20
-keys are the names, and the values are brief descriptions with URLs.
21
-
22
-Provided dependency dictionaries:
23
-
24
- core
25
- grep/sed/md5sum, mplayer, mencoder, mpjpegtools, ffmpeg
26
- magick
27
- composite, convert
28
- dvd
29
- spumux, dvdauthor, growisofs
30
- vcd
31
- vcdxbuild, cdrdao
32
- transcode
33
- tcprobe, tcrequant
34
- plugin
35
- sox, normalize
36
- all
37
- ALL dependencies above
38
-
39
-If you don't want to use a provided dictionary, you can specify individual
40
-program names to look for::
41
-
42
- deps.require("more less cat")
43
-
44
-`require` also provides ways to print custom URLs and help when it cannot find
45
-dependencies. See ``help(deps.require)`` or keep reading.
46
-"""
47
-
48
-__all__ = [
49
- 'which',
50
- 'require',
51
- 'MissingDep',
52
-]
53
-
54
-import subprocess
55
-import textwrap
56
-
57
-from libtovid.util.output import red
58
-
59
-class MissingDep (Exception):
60
- """Missing dependency exception."""
61
- pass
62
-
63
-###
64
-### Module data
65
-###
66
-
67
-# Dictionary format: {"name": "description (url)"}
68
-all = {}
69
-
70
-core = {
71
- "grep": "a GNU utility (www.gnu.org/software/grep)",
72
- "sed": "a GNU utility (directory.fsf.org/GNU/software/sed.html)",
73
- "md5sum": "a GNU utility (www.gnu.org/software/coreutils)",
74
- "mplayer": "part of mplayer (www.mplayerhq.hu)",
75
- "mencoder": "part of mplayer (www.mplayerhq.hu)",
76
- "mplex": "part of mjpegtools (mjpeg.sf.net)",
77
- "mpeg2enc": "part of mjpegtools (mjpeg.sf.net)",
78
- "yuvfps": "part of mjpegtools (mjpeg.sf.net)",
79
- "yuvdenoise": "part of mjpegtools (mjpeg.sf.net)",
80
- "ppmtoy4m": "part of mjpegtools (mjpeg.sf.net)",
81
- "mp2enc": "part of mjpegtools (mjpeg.sf.net)",
82
- "jpeg2yuv": "part of mjpegtools (mjpeg.sf.net)",
83
- "ffmpeg": "a video encoding utility (ffmpeg.mplayerhq.hu)" }
84
-all.update(core)
85
-
86
-magick = {
87
- "composite": "part of ImageMagick (www.imagemagick.org)",
88
- "convert": "part of ImageMagick (www.imagemagick.org)" }
89
-all.update(magick)
90
-
91
-dvd = {
92
- "spumux": "part of dvdauthor (dvdauthor.sf.net)",
93
- "dvdauthor": "part of dvdauthor (dvdauthor.sf.net)",
94
- "growisofs": "part of dvd+rw-tools (fy.chalmers.se/~appro/linux/DVD+RW)"}
95
-all.update(dvd)
96
-
97
-vcd = {
98
- "vcdxbuild": "part of vcdimager (www.vcdimager.org)",
99
- "cdrdao": "a cd burning application (cdrdao.sf.net)" }
100
-all.update(vcd)
101
-
102
-transcode = {
103
- "tcprobe": "part of transcode (www.transcoding.org)",
104
- "tcrequant": "part of transcode (www.transcoding.org)" }
105
-all.update(transcode)
106
-
107
-plugin = {
108
- "sox": "swiss army knife for sound (sox.sf.net)",
109
- "normalize": "wave gain and normalization (normalize.nongnu.org)" }
110
-all.update(plugin)
111
-
112
-__missing_dependency_message = \
113
-"""Please install the above MISSING dependencies and try again. See
114
-http://tovid.wikia.com/wiki/Tovid_dependencies for more help.
115
-"""
116
-
117
-###
118
-### Exported functions
119
-###
120
-
121
-def which(executable):
122
- """Locate the given executable program name on the current path.
123
- If found, return the full pathname; otherwise, return the empty string.
124
- """
125
- proc = subprocess.Popen(['which', executable],
126
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
127
- return proc.stdout.read().rstrip('\n')
128
-
129
-def require(deps,
130
- help="You need these to finish what you were doing.",
131
- description="oops"):
132
-
133
- """Assert that one or more dependencies exist on the system. If any
134
- are missing, raise a `MissingDep` exception.
135
-
136
- deps
137
- Names of dependencies to assert. May be a single name,
138
- a python list or space-separated string list of names,
139
- or a dictionary of the form {depname: description}.
140
- help
141
- A help message about why the dependencies are needed
142
- description
143
- A short description of the dep, and its homepage URL
144
- (ignored if deps is a dictionary).
145
-
146
- If a given dependency name is found in one of the internal dictionaries,
147
- (core, magick, etc.), its description is taken from there.
148
-
149
- Examples:
150
-
151
- require(all)
152
- Look for ALL dependencies that are defined internally.
153
-
154
- require(core, "You are missing CORE dependencies!")
155
- Use the core dictionary to determine which dependencies to
156
- look for. Print the help message if any dependency is missing.
157
-
158
- require("xine", "You can't preview!", "a video player (xinehq.de)")
159
- Check for xine and print the custom help and URL messages
160
- if missing.
161
-
162
- require("mplayer mencoder", url="a video player (mplayerhq.hu)")
163
- Look for mplayer and mencoder. Use the default help message,
164
- but print a custom URL.
165
-
166
- """
167
- # Get the deps to check for: dictionary.keys(), or a list
168
- if type(deps) == dict:
169
- deps = deps.keys()
170
- elif type(deps) == str:
171
- deps = deps.split(' ')
172
- elif type(deps) != list:
173
- raise ValueError("%s is not dictionary, list, or string!" % str(deps))
174
-
175
- # Find the missing dependencies
176
- have_deps = True
177
- for dep in deps:
178
- if which(dep) == '':
179
- if type(deps) == dict:
180
- description = deps[dep]
181
- elif dep in all:
182
- description = all[dep]
183
- # Tell the user which dependencies they're missing
184
- print(red("MISSING:") + " %s, %s" % (dep, description))
185
- have_deps = False
186
-
187
- # Having reported the missing dependencies, print the help message and quit
188
- if not have_deps:
189
- print("\n", textwrap.fill(help + ' ' + __missing_dependency_message, 79))
190
- raise MissingDep("Cannot find required dependencies!")
191
-
192
-
193
-
194
-if __name__ == "__main__":
195
- trials = [
196
- (core, "You are missing CORE dependencies!", "custom url 1"),
197
- (core, "You are missing CORE dependencies!", "custom url 2"),
198
- ("grp md5sm", "You're missing some vowels!", "custom url 4"),
199
- ("foo", "heh, you don't have foo?!", "see foo.org") ]
200
-
201
tovid-0.34.tar.bz2/libtovid/encode.py
Deleted
201
1
2
-"""Encode video to standard formats, using one of several supported backends.
3
-
4
-One high-level function is provided::
5
-
6
- encode(infile, outfile, format, tvsys, method, **kwargs)
7
-
8
-For example::
9
-
10
- encode('/video/foo.avi', '/video/bar.mpg', 'dvd', 'ntsc', 'ffmpeg')
11
-
12
-This will encode ``/video/foo.avi`` to NTSC DVD format using ffmpeg, saving
13
-the result as ``/video/bar.mpg``. The ``format``, ``tvsys``, and ``method``
14
-arguments are optional; if you do::
15
-
16
- encode('/video/foo.avi', '/video/bar.mpg')
17
-
18
-then encoding will be DVD NTSC, using ffmpeg.
19
-
20
-Keyword arguments may be used to further refine encoding behavior, for example::
21
-
22
- encode('foo.avi', 'foo.mpg', 'dvd', 'pal',
23
- quality=7, interlace='bottom', ...)
24
-
25
-The supported keywords may vary by backend, but some keywords are supported
26
-by all backends. The available backends are:
27
-
28
- - `~libtovid.backend.ffmpeg`
29
- - `~libtovid.backend.mplayer`
30
- - `~libtovid.backend.mpeg2enc`
31
-
32
-"""
33
-
34
-__all__ = [
35
- 'encode',
36
- 'eval_keywords',
37
- 'fit',
38
-]
39
-
40
-from libtovid.backend import ffmpeg, mplayer, mpeg2enc
41
-from libtovid.media import MediaFile, standard_media, correct_aspect
42
-
43
-
44
-_bitrate_limits = {
45
- 'vcd': (1150, 1150),
46
- 'kvcd': (400, 4000),
47
- 'dvd-vcd': (400, 4000),
48
- 'svcd': (900, 2400),
49
- 'half-dvd': (600, 6000),
50
- 'dvd': (900, 9000)
51
- }
52
-
53
-# --------------------------------------------------------------------------
54
-#
55
-# Primary interface
56
-#
57
-# --------------------------------------------------------------------------
58
-
59
-def encode(infile, outfile, format='dvd', tvsys='ntsc', method='ffmpeg',
60
- **kwargs):
61
- """Encode a multimedia file ``infile`` according to a target profile,
62
- saving the encoded file to ``outfile``.
63
-
64
- infile
65
- Input filename
66
- outfile
67
- Desired output filename (``.mpg`` implied)
68
- format
69
- One of 'vcd', 'svcd', 'dvd' (case-insensitive)
70
- tvsys
71
- One of 'ntsc', 'pal' (case-insensitive)
72
- method
73
- Encoding backend: `~libtovid.backend.ffmpeg`,
74
- `~libtovid.backend.mplayer`, or `~libtovid.backend.mpeg2enc`
75
- kwargs
76
- Additional keyword arguments (name=value)
77
-
78
- For example::
79
-
80
- encode('/video/foo.avi', '/video/bar.mpg', 'dvd', 'ntsc', 'ffmpeg')
81
-
82
- This will encode ``/video/foo.avi`` to NTSC DVD format using ffmpeg, saving
83
- the result as '/video/bar.mpg'. The ``format``, ``tvsys``, and ``method``
84
- arguments are optional; if you do::
85
-
86
- encode('/video/foo.avi', '/video/bar.mpg')
87
-
88
- then encoding will be DVD NTSC, using ffmpeg.
89
-
90
- Keyword arguments may be used to further refine encoding behavior, for example::
91
-
92
- encode('foo.avi', 'foo.mpg', 'dvd', 'pal',
93
- quality=7, interlace='bottom', ...)
94
-
95
- The supported keywords may vary by backend, but some keywords are supported
96
- by all backends.
97
-
98
-
99
- """
100
- source = mplayer.identify(infile)
101
- # Add .mpg to outfile if not already present
102
- if not outfile.endswith('.mpg'):
103
- outfile += '.mpg'
104
- # Get an appropriate encoding target
105
- target = standard_media(format, tvsys)
106
- target.filename = outfile
107
- # Set desired aspect ratio, or auto
108
- if 'aspect' in kwargs:
109
- target = correct_aspect(source, target, kwargs['aspect'])
110
- else:
111
- target = correct_aspect(source, target, 'auto')
112
-
113
- # Some friendly output
114
- print("Source media:")
115
- print(source)
116
- print(' ')
117
- print("Target media:")
118
- print(target)
119
-
120
- # Get the appropriate encoding backend
121
- encode_method = get_encoder(method)
122
- # Evaluate high-level keywords
123
- kwargs = eval_keywords(source, target, **kwargs)
124
- # Encode!
125
- encode_method(source, target, **kwargs)
126
-
127
-
128
-# --------------------------------------------------------------------------
129
-#
130
-# Helper functions
131
-#
132
-# --------------------------------------------------------------------------
133
-
134
-def _get_encoder(backend):
135
- """Get an encoding function."""
136
- if backend == 'ffmpeg':
137
- return ffmpeg.encode
138
- elif backend in ['mplayer', 'mencoder']:
139
- return mplayer.encode
140
- elif backend == 'mpeg2enc':
141
- return mpeg2enc.encode
142
-
143
-
144
-def eval_keywords(source, target, **kwargs):
145
- """Interpret keywords that affect other keywords, and return the result.
146
- These are keywords that can be shared between multiple encoding backends.
147
-
148
- Supported keywords:
149
-
150
- quality
151
- From 1 (lowest) to 10 (highest) video quality.
152
- Overrides 'quant' and 'vbitrate' keywords.
153
- fit
154
- Size in MiB to fit output video to (overrides 'quality')
155
- Overrides 'quant' and 'vbitrate' keywords.
156
-
157
- """
158
- # Set quant and vbitrate to match desired quality
159
- if 'quality' in kwargs:
160
- kwargs['quant'] = 13-kwargs['quality']
161
- max_bitrate = _bitrate_limits[target.format][1]
162
- kwargs['vbitrate'] = kwargs['quality'] * max_bitrate / 10
163
- # Set quant and vbitrate to fit desired size
164
- if 'fit' in kwargs:
165
- kwargs['quant'], kwargs['vbitrate'] = \
166
- fit(source, target, kwargs['fit'])
167
- return kwargs
168
-
169
-
170
-def fit(source, target, fit_size):
171
- """Return video (quantization, bitrate) to fit a video into a given size.
172
-
173
- source
174
- `~libtovid.media.MediaFile` input (the video being encoded)
175
- target
176
- `~libtovid.media.MediaFile` output (desired target profile)
177
- fit_size
178
- Desired encoded file size, in MiB
179
-
180
- """
181
- assert isinstance(source, MediaFile)
182
- assert isinstance(target, MediaFile)
183
- fit_size = float(fit_size)
184
- mpeg_overhead = fit_size / 100
185
- aud_vid_size = fit_size - mpeg_overhead
186
- audio_size = float(source.length * target.abitrate) / (8*1024)
187
- video_size = aud_vid_size - audio_size
188
- vid_bitrate = int(video_size*8*1024 / source.length)
189
-
190
- print("Length: %s seconds" % source.length)
191
- print("Overhead: %s MiB" % mpeg_overhead)
192
- print("Audio: %s MiB" % audio_size)
193
- print("Video: %s MiB" % video_size)
194
- print("VBitrate: %s kbps" % vid_bitrate)
195
-
196
- # Keep bitrates sane for each disc format
197
- lower, upper = _bitrate_limits[target.format]
198
- quant = 3
199
- if vid_bitrate < lower:
200
- return (quant, lower)
201
tovid-0.34.tar.bz2/libtovid/media.py
Deleted
197
1
2
-"""This module provides a multimedia file class for storing a profile of
3
-attributes including resolution, audio and video codecs and bitrates.
4
-
5
-These can be used for getting a target `MediaFile` for encoding via
6
-one of the backends in :mod:`libtovid.backend`. For example::
7
-
8
- >>> dvd = standard_media('dvd', 'ntsc')
9
- >>> print(dvd)
10
- Filename:
11
- Format: DVD
12
- TVsys: NTSC
13
- Length: 0 seconds
14
- Video: 720x480 29.97fps 4:3 mpeg2 6000kbps
15
- Audio: ac3 224kbps 48000hz 2-channel
16
-
17
-"""
18
-
19
-__all__ = [
20
- 'MediaFile',
21
- 'standard_media',
22
- 'correct_aspect',
23
-]
24
-
25
-import copy
26
-from libtovid import log
27
-from libtovid import standard
28
-from libtovid.util import ratio_to_float
29
-
30
-# Analysis of MediaFile attributes
31
-#
32
-# acodec: ID, target
33
-# abitrate: ID, target
34
-# channels: ID
35
-# samprate: ID, source, target
36
-# vcodec: ID
37
-# vbitrate: ID, target
38
-# length: ID, source
39
-# scale: (ID), (source), target
40
-# expand: target
41
-# fps: ID, source, target
42
-# aspect: source
43
-# widescreen: target
44
-#
45
-#
46
-# Redundancies(?):
47
-# widescreen/aspect
48
-# scale/expand if aspect is known
49
-
50
-class MediaFile:
51
- """A multimedia video file, and its vital statistics.
52
- """
53
- def __init__(self, filename='', format='none', tvsys='none'):
54
- log.debug("MediaFile(%s, %s, %s)" % (filename, format, tvsys))
55
- # TODO: Set attributes to match given format and tvsys
56
- self.filename = filename
57
- self.format = format
58
- self.tvsys = tvsys
59
- self.length = 0
60
- # TODO: Support multiple audio and video tracks
61
- self.has_audio = False
62
- self.has_video = False
63
- # Audio attributes
64
- self.acodec = 'none'
65
- self.abitrate = 0
66
- self.channels = 0
67
- self.samprate = 0
68
- # Video attributes
69
- self.vcodec = 'none'
70
- # TODO: Better names for scale & expand, but not so long as
71
- # 'inner_resolution' and 'outer_resolution', or
72
- # 'picture_res' and 'frame_res'. Suggestions?
73
- self.scale = (0, 0)
74
- self.expand = (0, 0)
75
- self.vbitrate = 0
76
- self.fps = 0.0
77
- self.aspect = '0:0'
78
- self.widescreen = False
79
-
80
-
81
- def __str__(self):
82
- """Return a string representation of the MediaFile.
83
- """
84
- width, height = self.expand or self.scale
85
- # List of lines of output
86
- lines = [
87
- 'Filename: %s' % self.filename,
88
- 'Format: %s' % self.format,
89
- 'TVsys: %s' % self.tvsys,
90
- 'Length: %s seconds' % self.length,
91
- 'Video: %sx%s %sfps %s %s %skbps' % \
92
- (width, height, self.fps, self.aspect, self.vcodec, self.vbitrate),
93
- 'Audio: %s %skbps %shz %s-channel' % \
94
- (self.acodec, self.abitrate, self.samprate, self.channels)
95
- ]
96
- # Add newlines and return
97
- return '\n'.join(lines)
98
-
99
-
100
-def standard_media(format, tvsys):
101
- """Return a `MediaFile` compliant with a standard format and TV system.
102
-
103
- format
104
- Standard format ('vcd', 'svcd', or 'dvd')
105
- tvsys
106
- TV system ('pal' or 'ntsc')
107
-
108
- """
109
- log.debug("standard_media(%s, %s)" % (format, tvsys))
110
- media = MediaFile('', format, tvsys)
111
- # Set valid video attributes
112
- media.vcodec = standard.vcodec(format)
113
- media.scale = standard.resolution(format, tvsys)
114
- media.expand = media.scale
115
- media.fps = standard.fps(tvsys)
116
- # Set valid audio attributes
117
- media.acodec = standard.acodec(format)
118
- media.samprate = standard.samprate(format)
119
- # TODO: How to handle default bitrates? These functions return a range.
120
- #media.vbitrate = standard.vbitrate(format)[1]
121
- #media.abitrate = standard.abitrate(format)[1]
122
- media.abitrate = 224
123
- if format == 'vcd':
124
- media.vbitrate = 1150
125
- elif format == 'svcd':
126
- media.vbitrate = 2600
127
- else:
128
- media.vbitrate = 6000
129
- return media
130
-
131
-
132
-def correct_aspect(source, target, aspect='auto'):
133
- """Calculate the necessary scaling to fit source into target at a given
134
- aspect ratio, without distorting the picture.
135
-
136
- source
137
- Input `MediaFile`
138
- target
139
- Output `MediaFile`
140
- aspect
141
- Aspect ratio to assume for input file (e.g., '4:3', '16:9')
142
- or 'auto' to use autodetection based on source aspect
143
-
144
- Return a new target `MediaFile` with correct scaling, using letterboxing
145
- if appropriate, and anamorphic widescreen if available (DVD only).
146
- """
147
- assert isinstance(source, MediaFile)
148
- assert isinstance(target, MediaFile)
149
-
150
- # Base new target on existing one
151
- target = copy.copy(target)
152
-
153
- # Convert aspect (ratio) to a floating-point value
154
- if aspect == 'auto':
155
- src_aspect = ratio_to_float(source.aspect)
156
- else:
157
- src_aspect = ratio_to_float(aspect)
158
-
159
- # Use anamorphic widescreen for any video ~16:9 or wider
160
- # (Only DVD supports this)
161
- if src_aspect >= 1.7 and target.format == 'dvd':
162
- target_aspect = 16.0/9.0
163
- widescreen = True
164
- else:
165
- target_aspect = 4.0/3.0
166
- widescreen = False
167
-
168
- # Start by assuming direct scaling to target resolution
169
- width, height = target.scale
170
-
171
- # If aspect matches target, no letterboxing is necessary
172
- tolerance = 0.05
173
- if abs(src_aspect - target_aspect) < tolerance:
174
- scale = (width, height)
175
- # If aspect is wider than target, letterbox vertically
176
- elif src_aspect > target_aspect:
177
- scale = (width, int(height * target_aspect / src_aspect))
178
- # Otherwise (rare), letterbox horizontally
179
- else:
180
- scale = (int(width * src_aspect / target_aspect), height)
181
-
182
- # Always expand to the target resolution
183
- expand = (width, height)
184
-
185
- # If input file is already the correct size, don't scale
186
- if scale == source.scale:
187
- scale = False
188
-
189
- # Final scaling/expansion for correct aspect ratio display
190
- target.scale = scale
191
- target.expand = expand
192
- target.widescreen = widescreen
193
- return target
194
-
195
-
196
-
197
tovid-0.34.tar.bz2/libtovid/opts.py
Deleted
201
1
2
-# opts.py
3
-
4
-# WARNING: This module is a hack in progress
5
-
6
-__all__ = [
7
- 'Option',
8
- 'Usage',
9
- 'parse',
10
- 'validate',
11
-]
12
-
13
-import sys
14
-import textwrap
15
-from libtovid.odict import Odict
16
-from libtovid.util import trim
17
-
18
-class Option (object):
19
- """A command-line-style option, expected argument formatting, default value,
20
- and notes on usage and purpose.
21
-
22
- For example::
23
-
24
- debug_opt = Option(
25
- 'debug',
26
- 'none|some|all',
27
- 'some',
28
- "Amount of debugging information to display"
29
- )
30
-
31
- This defines a 'debug' option, along with a human-readable string showing
32
- expected argument formatting, a default value, and a string documenting the
33
- option's purpose and/or usage information.
34
- """
35
- def __init__(self, name, argformat='', default=None,
36
- doc='Undocumented option', alias=None,
37
- required=False):
38
- """Create a new option definition with the given attributes.
39
-
40
- name
41
- Option name
42
- argformat
43
- String describing format of expected arguments
44
- default
45
- Default value, if any
46
- doc
47
- Manual-page-style documentation of the option
48
- alias
49
- An ('option', 'value') equivalent for this option
50
-
51
- """
52
- self.name = name
53
- self.argformat = argformat
54
- self.default = default
55
- self.doc = trim(doc)
56
- self.alias = alias
57
- self.required = required
58
- # If an alias was provided, generate documentation.
59
- # i.e., alias=('tvsys', 'ntsc') means this option is the same as
60
- # giving the 'tvsys' option with 'ntsc' as the argument.
61
- if self.alias:
62
- self.doc = 'Same as -%s %s.' % alias
63
-
64
-
65
- def num_args(self):
66
- """Return the number of arguments expected by this option,
67
- or -1 if unlimited.
68
- """
69
- # Flag alias for another option
70
- if self.alias:
71
- return 0
72
- # Boolean: no argument
73
- elif isinstance(self.default, bool):
74
- return 0
75
- # List: unlimited arguments
76
- elif isinstance(self.default, list):
77
- return -1
78
- # Unary: one argument
79
- else:
80
- return 1
81
-
82
-
83
- def __str__(self):
84
- """Return a string containing "usage notes" for this option.
85
- """
86
- if self.alias:
87
- usage = "-%s: Same as '-%s %s'\n" % \
88
- (self.name, self.alias[0], self.alias[1])
89
- else:
90
- usage = "-%s %s " % (self.name, self.argformat)
91
- if self.required:
92
- usage += "(REQUIRED)\n"
93
- else:
94
- usage += "(default: %s)\n" % self.default
95
- for line in textwrap.wrap(self.doc, 60):
96
- usage += ' ' + line + '\n'
97
- return usage
98
-
99
-class Usage (object):
100
- """Command-line usage definition."""
101
- def __init__(self, usage_string='program [options]', *options):
102
- """Define usage of a command-line program.
103
-
104
- usage_string
105
- Command-line syntax and required options
106
- options
107
- List of allowed Options
108
-
109
- Examples::
110
-
111
- usage = Usage('pytovid [options] -in FILENAME -out NAME',
112
- Option('in', 'FILENAME', None,
113
- "Input video file, in any format."),
114
- Option('out', 'NAME', None,
115
- "Output prefix or name."),
116
- Option('format', 'vcd|svcd|dvd|half-dvd|dvd-vcd', 'dvd',
117
- "Make video compliant with the specified format")
118
- )
119
- print(usage)
120
- print(usage.options['format'])
121
-
122
- """
123
- self.usage_string = usage_string
124
- # Odict of options indexed by name
125
- names = [opt.name for opt in options]
126
- self.options = Odict(names, options)
127
-
128
-
129
- def __str__(self):
130
- """Return string-formatted usage notes.
131
- """
132
- result = "Usage: %s\n" % self.usage_string
133
- result += "Allowed options:\n"
134
- option_list = ['-' + opt.name for opt in self.options.values()]
135
- result += ', '.join(option_list)
136
- return result
137
-
138
-
139
-
140
-from copy import copy
141
-
142
-def parse(args):
143
- """Parse a list of arguments and return a dictionary of found options.
144
-
145
- args: List of command-line arguments (such as from sys.argv)
146
-
147
- The argument list is interpreted in this way:
148
-
149
- * If it begins with '-', it's an option
150
- * Arguments that precede the first option are ignored
151
- * Anything following an option is an argument to that option
152
- * If there is no argument to an option, it's a flag (True if present)
153
- * If there's one argument to an option, it's a single string value
154
- * If there are multiple arguments to an option, it's a list of strings
155
-
156
- """
157
- args = copy(args)
158
- options = {}
159
- current = None
160
- while len(args) > 0:
161
- arg = args.pop(0)
162
- # New option
163
- if arg.startswith('-'):
164
- current = arg.lstrip('-')
165
- # Treat it as a flag unless we see arguments later
166
- options[current] = True
167
-
168
- # Argument to current option
169
- elif current:
170
- # Was a flag, now has a single value
171
- if options[current] is True:
172
- options[current] = arg
173
- # Was a single value, now a list
174
- elif type(options[current]) != list:
175
- options[current] = [options[current], arg]
176
- # Was a list, so append new value
177
- else:
178
- options[current].append(arg)
179
- return options
180
-
181
-
182
-import re
183
-
184
-def validate(option, arg):
185
- """Check whether an argument is valid for a given option.
186
-
187
- option: An Option to validate
188
- arg: Candidate argument
189
-
190
- Expected/allowed values are inferred from the argformat string.
191
-
192
- argformat patterns to consider:
193
- opta|optb|optc # Either opta, optb, or optc
194
- [100-999] # Any integer between 100 and 999
195
- NUM:NUM # Any two integers separated by a colon
196
- VAR # A single string (VAR can be any all-caps word)
197
- VAR [, VAR] # List of strings
198
- (empty) # Boolean; no argument required
199
-
200
- All very experimental...
201
tovid-0.34.tar.bz2/libtovid/render
Deleted
2
1
-(directory)
2
tovid-0.34.tar.bz2/libtovid/render/__init__.py
Deleted
9
1
2
-__all__ = [
3
- 'animation',
4
- 'drawing',
5
- 'effect',
6
- 'flipbook',
7
- 'layer',
8
-]
9
tovid-0.34.tar.bz2/libtovid/render/animation.py
Deleted
201
1
2
-"""This module provides classes and functions for working with animation.
3
-Two classes are provided:
4
-
5
- `Keyframe`
6
- A frame with a specific data value
7
- `Tween`
8
- A data sequence interpolated from Keyframes
9
-
10
-The data being interpolated may represent color, opacity, location, or anything
11
-else that can be described numerically. Keyframe data may be scalar (single
12
-integers or decimal values) or vector (tuples such as ``(x, y)`` coordinates or
13
-``(r, g, b)`` color values).
14
-
15
-For example, let's define three keyframes::
16
-
17
- >>> keys = [Keyframe(1, 0),
18
- ... Keyframe(6, 50),
19
- ... Keyframe(12, 10)]
20
-
21
-The value increases from 0 to 50 over frames 1-6, then back down to 10
22
-over frames 6-12. The values at intermediate frames (2-5 and 7-11) can be
23
-interpolated or "tweened" automatically, using the Tween class::
24
-
25
- >>> tween = Tween(keys)
26
- >>> tween.data
27
- [0, 10, 20, 30, 40, 50, 43, 36, 30, 23, 16, 10]
28
-
29
-Another example using tweening of ``(x, y)`` coordinates::
30
-
31
- >>> keys = [Keyframe(1, (20, 20)),
32
- ... Keyframe(6, (80, 20)),
33
- ... Keyframe(12, (100, 100))]
34
-
35
-Here, a point on a two-dimensional plane starts at (20, 20), moving first
36
-to the right, to (80, 20), then diagonally to (100, 100)::
37
-
38
- >>> tween = Tween(keys)
39
- >>> for (x, y) in tween.data:
40
- ... print((x, y))
41
- ...
42
- (20, 20)
43
- (32, 20)
44
- (44, 20)
45
- (56, 20)
46
- (68, 20)
47
- (80, 20)
48
- (83, 33)
49
- (86, 46)
50
- (90, 60)
51
- (93, 73)
52
- (96, 86)
53
- (100, 100)
54
-
55
-"""
56
-
57
-__all__ = [
58
- 'Keyframe',
59
- 'Tween',
60
- 'lerp',
61
- 'cos_interp',
62
- 'interpolate',
63
-]
64
-
65
-import copy
66
-import doctest
67
-import math
68
-
69
-class Keyframe:
70
- """Associates a specific frame in an animation with a numeric value.
71
- A Keyframe is a ``(frame, data)`` pair defining a "control point" on a graph::
72
-
73
- 100 |
74
- | Keyframe(10, 50)
75
- data | *
76
- |
77
- 0 |__________________________
78
- 1 10 20 30
79
- frame
80
-
81
- The data can represent anything you like. For instance, opacity::
82
-
83
- 100 |* Keyframe(1, 100)
84
- |
85
- opacity(%) |
86
- |
87
- 0 |____________________* Keyframe(30, 0)
88
- 1 10 20 30
89
- frame
90
-
91
- See the `Tween` class below for what you can do with these Keyframes,
92
- once you have them.
93
- """
94
- def __init__(self, frame, data):
95
- """Create a keyframe, associating a given frame with some data.
96
- The data may be an integer, floating-point value, or a tuple like
97
- (x, y) or (r, g, b).
98
- """
99
- self.frame = frame
100
- self.data = data
101
-
102
-
103
-### --------------------------------------------------------------------------
104
-### Interpolation algorithms
105
-### --------------------------------------------------------------------------
106
-
107
-def lerp(x, (x0, y0), (x1, y1)):
108
- """Do linear interpolation between points ``(x0, y0)``, ``(x1, y1)``, and
109
- return the ``y`` for the given ``x``.
110
-
111
- This form of interpolation simply connects two points with a straight
112
- line. Blunt, but effective.
113
- """
114
- return y0 + (x - x0) * (y1 - y0) / (x1 - x0)
115
-
116
-
117
-def cos_interp(x, (x0, y0), (x1, y1)):
118
- """Do cosine-based interpolation between ``(x0, y0)``, ``(x1, y1)`` and
119
- return the ``y`` for the given ``x``.
120
-
121
- Essentially, a crude alternative to polynomial spline interpolation; this
122
- method transitions between two values by matching a segment of the cosine
123
- curve [0, pi] (for decreasing value) or [pi, 2*pi] (for increasing value)
124
- to the interval between the given points.
125
-
126
- It gives smoother results at inflection points than linear interpolation,
127
- but will result in "ripple" effects if keyframes are too dense or many.
128
- """
129
- # Map the interpolation area (domain of x) to [0, pi]
130
- x_norm = math.pi * (x - x0) / (x1 - x0)
131
- # For y0 < y1, use upward-sloping part of the cosine curve [pi, 2*pi]
132
- if y0 < y1:
133
- x_norm += math.pi
134
- # Calculate and return resulting y-value
135
- y_min = min(y1, y0)
136
- y_diff = abs(y1 - y0)
137
- return y_min + y_diff * (math.cos(x_norm) + 1) / 2.0
138
-
139
-
140
-def interpolate(frame, left, right, method='linear'):
141
- """Return the interpolated value at ``frame``, between two `Keyframe`
142
- endpoints, using the given interpolation method ('linear' or 'cosine').
143
-
144
- The left and right Keyframes mark the endpoints of the curve to be
145
- interpolated. For example, if a value changes from 50 to 80 over the
146
- course of frames 1 to 30::
147
-
148
- >>> left = Keyframe(1, 50)
149
- >>> right = Keyframe(30, 80)
150
-
151
- Then, the value at frame 10 can be interpolated as follows::
152
-
153
- >>> interpolate(10, left, right, 'linear')
154
- 59
155
- >>> interpolate(10, left, right, 'cosine')
156
- 56.582194019564263
157
-
158
- For frames outside the keyframe interval, the corresponding endpoint value
159
- is returned::
160
-
161
- >>> interpolate(0, left, right, 'linear')
162
- 50
163
- >>> interpolate(40, left, right, 'linear')
164
- 80
165
-
166
- """
167
- assert isinstance(left, Keyframe) and isinstance(right, Keyframe)
168
- # At or beyond endpoints, return endpoint value
169
- if frame <= left.frame:
170
- return left.data
171
- elif frame >= right.frame:
172
- return right.data
173
-
174
- # Use the appropriate interpolation function
175
- if method == 'cosine':
176
- interp_func = cos_interp
177
- else: # method == 'linear'
178
- interp_func = lerp
179
-
180
- # Interpolate integers or floats
181
- if isinstance(left.data, int) or isinstance(left.data, float):
182
- p0 = (left.frame, left.data)
183
- p1 = (right.frame, right.data)
184
- return interp_func(frame, p0, p1)
185
- # Interpolate a tuple (x, y, ...)
186
- elif isinstance(left.data, tuple):
187
- # Interpolate each dimension separately
188
- dim = 0
189
- result = []
190
- while dim < len(left.data):
191
- interp_val = interp_func(frame,
192
- (left.frame, left.data[dim]),
193
- (right.frame, right.data[dim]))
194
- result.append(interp_val)
195
- dim += 1
196
- return tuple(result)
197
-
198
-
199
-class Tween:
200
- """An "in-between" sequence, calculated by interpolating the data in a
201
tovid-0.34.tar.bz2/libtovid/render/drawing.py
Deleted
201
1
2
-# -=- encoding: latin-1 -=-
3
-
4
-# Run this script standalone for a demonstration:
5
-# $ python libtovid/render/drawing.py
6
-
7
-# To use this module from your Python interpreter, run:
8
-# $ python
9
-# >>> from libtovid.render.drawing import *
10
-
11
-"""Interactive vector drawing and rendering interface.
12
-
13
-This module provides a class called Drawing, which provides a blank canvas
14
-that can be painted with vector drawing functions, and later rendered to
15
-a raster image file (.png, .jpg etc.) at any desired resolution.
16
-
17
-To create a new, blank Drawing::
18
-
19
- >>> d = Drawing(800, 600) # width, height
20
-
21
-Here, (800, 600) defines two things:
22
-
23
- - On-screen display size, in pixels (800px x 600px)
24
- - Intended viewing aspect ratio (800:600 or 4:3)
25
-
26
-Note that you are still doing vector drawing, so whatever size you pick here
27
-has no bearing on your final target resolution--it's mostly intended for a
28
-convenient "preview" size while doing interactive drawing.
29
-
30
-Back on topic: you can now add shapes to the drawing, fill and stroke them::
31
-
32
- >>> d.circle(500, 300, 150) # (x, y, radius)
33
- >>> d.fill('blue', 0.8) # color name with optional alpha
34
- >>> d.stroke('rgb(0, 128, 255)') # rgb values 0-255
35
-
36
-Then add more shapes::
37
-
38
- >>> d.rectangle(25, 25, 320, 240) # x, y, width, height
39
- >>> d.fill('rgb(40%, 80%, 10%)') # rgb percentages
40
- >>> d.stroke('#FF0080', 0.5) # rgb hex notation with an alpha
41
-
42
-To see what the drawing looks like so far, do::
43
-
44
- >>> display(d) # display at existing size
45
- >>> display(d, 720, 480) # display at different size
46
- >>> display(d, fix_aspect=True) # display in correct aspect ratio
47
-
48
-You may then decide to add more to the drawing::
49
-
50
- >>> d.set_source('white')
51
- >>> d.text("Dennis", 50, 100) # text, x, y
52
-
53
-And preview again::
54
-
55
- >>> display(d)
56
-
57
-Once you finish your beautiful painting, save it as a nice high-res PNG::
58
-
59
- >>> save_png(d, "my.png", 1600, 1200)
60
-
61
-Cairo references:
62
-
63
- [1] http://www.cairographics.org
64
- [2] http://tortall.net/mu/wiki/CairoTutorial
65
-
66
-"""
67
-
68
-__all__ = [
69
- 'Drawing',
70
- 'render',
71
- 'display',
72
- 'save_image',
73
- 'save_jpg',
74
- 'save_pdf',
75
- 'save_png',
76
- 'save_ps',
77
- 'save_svg',
78
- 'write_ppm',
79
-]
80
-
81
-import os
82
-import sys
83
-import time
84
-import commands
85
-from copy import copy
86
-from math import pi, sqrt
87
-import cairo
88
-import Image # for JPG export
89
-import ImageColor # for getrgb, getcolor
90
-import ImageFile # for write_png()
91
-from libtovid import log
92
-from libtovid.util import to_unicode
93
-
94
-def get_surface(width, height, surface_type='image', filename=''):
95
- """Get a cairo surface at the given dimensions.
96
- """
97
- if type(width) != int or type(height) != int:
98
- log.warning("Surface width and height should be integers."\
99
- " Converting to int.")
100
-
101
- if surface_type == 'image':
102
- return cairo.ImageSurface(cairo.FORMAT_ARGB32,
103
- int(width), int(height))
104
- elif surface_type == 'svg':
105
- return cairo.SVGSurface(filename, width, height)
106
- elif surface_type == 'pdf':
107
- return cairo.PDFSurface(filename, width, height)
108
- elif surface_type == 'ps':
109
- return cairo.PSSurface(filename, width, height)
110
-
111
-
112
-
113
-### --------------------------------------------------------------------
114
-### Classes
115
-### --------------------------------------------------------------------
116
-class Step:
117
- """An atomic drawing procedure, consisting of a closed function that
118
- draws on a given cairo surface, and human-readable information about
119
- what parameters were given to it.
120
- """
121
- def __init__(self, function, *args):
122
- self.function = function
123
- self.name = function.__name__.lstrip('_')
124
- self.args = args
125
- def __str__(self):
126
- return "%s%s" % (self.name, self.args)
127
-
128
-
129
-# Drawing class notes
130
-#
131
-# The Drawing class has a number of methods (circle, rectangle, fill, stroke
132
-# and many others) that need to operate on a Cairo surface. But we'd like to
133
-# delay execution of actually drawing on that surface--otherwise, we can't
134
-# easily render a given Drawing to a custom resolution.
135
-#
136
-# Closures save the day here--that is, functions without "free variables".
137
-# Anytime you "paint" on the Drawing, what's actually happening is a new
138
-# function is getting created, whose sole purpose in life is to carry out that
139
-# specific paint operation. These tiny, single-purpose functions are then
140
-# added to a list of steps (self.steps) that will actually be executed at
141
-# rendering-time (i.e., when you do display() or save_png).
142
-#
143
-# This not only lets us render a Drawing to different resolutions, but allows
144
-# the possibility of rendering to different Cairo surfaces.
145
-
146
-class Drawing:
147
-
148
- tk = None # tkinter widget to send redraws to
149
-
150
- def __init__(self, width=800, height=600, autodraw=False):
151
- """Create a blank drawing at the given size.
152
-
153
- width, height
154
- Dimensions of the drawable region, in arbitrary units
155
- autodraw
156
- Redraw a preview image after each drawing operation
157
- """
158
- self.size = (width, height)
159
- self.w = width
160
- self.h = height
161
- self.aspect = float(width) / height
162
- self.autodraw = autodraw
163
- #self.commands = []
164
- self.steps = []
165
- # "Dummy" surface/context at the original resolution;
166
- # should not be drawn on
167
- self.surface = get_surface(width, height, 'image')
168
- self.cr = cairo.Context(self.surface)
169
-
170
-
171
- def addStep(self, func, *args):
172
- """Add a Step to self.steps using the given function and args."""
173
- step = Step(func, *args)
174
- self.steps.append(step)
175
- if self.autodraw and step.name in ['fill', 'stroke']:
176
- display(self, 640, 480, True)
177
-
178
-
179
- def doStep(self, func, *args):
180
- """Add the given Step, and execute it."""
181
- self.addStep(func, *args)
182
- func(self.cr)
183
-
184
-
185
- def history(self):
186
- """Return a formatted string of all steps in this Drawing."""
187
- result = ''
188
- for number, step in enumerate(self.steps):
189
- result += '%d. %s\n' % (number, step)
190
- return result
191
-
192
-
193
- def affine(self, rot_x, rot_y, scale_x, scale_y, translate_x, translate_y):
194
- """Define a 3x3 transformation matrix::
195
-
196
- [ scale_x rot_y translate_x ]
197
- [ rot_x scale_y translate_y ]
198
- [ 0 0 1 ]
199
-
200
- This is scaling, rotation, and translation in a single matrix,
201
tovid-0.34.tar.bz2/libtovid/render/effect.py
Deleted
201
1
2
-"""This module defines classes for creating and drawing effects on a series
3
-of drawings (as in a Flipbook).
4
-
5
-Effect classes are arranged in a (currently) simple hierarchy::
6
-
7
- Effect (base class)
8
- Movement
9
- Translate
10
- Fade
11
- FadeInOut
12
- Colorfade
13
- Spectrum
14
- Scale
15
- Whirl
16
- PhotoZoom
17
- KeyFunction
18
-
19
-"""
20
-
21
-__all__ = [
22
- 'Effect',
23
- 'Movement',
24
- 'Translate',
25
- 'Fade',
26
- 'FadeInOut',
27
- 'Colorfade',
28
- 'Spectrum',
29
- 'Scale',
30
- 'Whirl',
31
- 'PhotoZoom',
32
- 'KeyFunction',
33
-]
34
-
35
-from libtovid.render.drawing import Drawing
36
-from libtovid.render.animation import Keyframe, Tween
37
-from random import randint
38
-
39
-class Effect:
40
- """A "special effect" created by keyframing a Cairo drawing command
41
- along the given frame interval.
42
- """
43
- def __init__(self, start, end):
44
- """Create an effect lasting from start frame to end frame.
45
- """
46
- self.start = start
47
- self.end = end
48
- # List of Keyframes
49
- self.keyframes = [Keyframe(self.start, 0), Keyframe(self.end, 0)]
50
- self.tween = Tween(self.keyframes)
51
-
52
- # Parents
53
- self._parent_flipbook = None
54
- self._parent_layer = None
55
-
56
-
57
- def init_parent_flipbook(self, fb):
58
- self._parent_flipbook = fb
59
-
60
-
61
- def init_parent_layer(self, layer):
62
- self._parent_layer = layer
63
-
64
-
65
- def pre_draw(self, drawing, frame):
66
- """Set up effect elements that must be applied before drawing a Layer.
67
-
68
- drawing
69
- The Drawing to apply effects to
70
- frame
71
- The frame for which to render the effect
72
-
73
- Extend this function in derived classes.
74
- """
75
- drawing.save()
76
-
77
-
78
- def post_draw(self, drawing, frame):
79
- """Finalize effect elements after a Layer is drawn.
80
-
81
- drawing
82
- The Drawing to apply effects to
83
- frame
84
- The frame for which to render the effect
85
-
86
- Extend this function in derived classes.
87
- """
88
- drawing.restore()
89
-
90
-
91
-# New Effect template
92
-#
93
-# Copy and paste this code to create your own Effect
94
-#
95
-# The first line defines your effect's name. (Effect) means it inherits from
96
-# the base Effect class, and shares some properties with it.
97
-
98
-class MyEffect (Effect):
99
- """Modify this documentation string to describe what your effect does.
100
- """
101
- # The __init__ function is called whenever a MyEffect is created. Make
102
- # sure your __init__ takes start and end arguments; additional arguments
103
- # (such as start_val and end_val below) allow someone using your effect
104
- # class to customize its behavior in some way. See the other effects below
105
- # for examples.
106
- def __init__(self, start, end, start_val, end_val):
107
- """Create a MyEffect lasting from start to end frame.
108
- """
109
- # Be sure to call this first-thing:
110
- Effect.__init__(self, start, end)
111
- # It initializes the base Effect class with start and end frames.
112
-
113
- # Next, define any keyframes your effect needs to use. This
114
- # effect just varies something from start_val to end_val:
115
- self.keyframes = [
116
- Keyframe(start, start_val),
117
- Keyframe(end, end_val)
118
- ]
119
-
120
- # Call this afterwards, to calculate the values at all frames
121
- self.tween = Tween(self.keyframes)
122
-
123
- def draw(self, drawing, frame):
124
- """Undocumented"""
125
- # Example function that can be called when drawing a layer.
126
- # The Layer must know that his particular effect requires the
127
- # calling of this function, or to add special parameters, or to
128
- # draw between items in the layer.
129
-
130
- # First, it's good to make sure we really have a Drawing class
131
- assert isinstance(drawing, Drawing)
132
-
133
- # This effect varies the stroke width across a sequence of frames.
134
- # Replace 'stroke_width' with your own drawing function(s)
135
- drawing.stroke_width(self.tween[frame])
136
-
137
- # Effect rendering occurs in two phases: pre_draw and post_draw.
138
- # These functions are already defined in the Effect base class; extend
139
- # them to do your effect rendering.
140
- def pre_draw(self, drawing, frame):
141
- """Do preliminary effect rendering."""
142
- # Always call the base class pre_draw first:
143
- Effect.pre_draw(self, drawing, frame)
144
-
145
- # This effect varies the stroke width across a sequence of frames.
146
- # Replace 'stroke_width' with your own drawing function(s)
147
- drawing.stroke_width(self.tween[frame])
148
-
149
- # Extend post_draw to do any post-rendering cleanup you need to do. Most
150
- # of the time, you won't need to extend this, but if you do, be sure to
151
- # call the base class post_draw at the end:
152
- def post_draw(self, drawing, frame):
153
- """Do post-drawing cleanup."""
154
- # Post-drawing cleanup here
155
- Effect.post_draw(self, drawing, frame)
156
-
157
-
158
-class Movement (Effect):
159
- """A movement effect, from one point to another."""
160
- def __init__(self, start, end, (x0, y0), (x1, y1)):
161
- """Move from start (x0, y0) to end (x1, y1).
162
- """
163
- Effect.__init__(self, start, end)
164
- self.keyframes = [
165
- Keyframe(start, (x0, y0)),
166
- Keyframe(end, (x1, y1))
167
- ]
168
- self.tween = Tween(self.keyframes)
169
-
170
- def pre_draw(self, drawing, frame):
171
- drawing.save()
172
- drawing.translate(*self.tween[frame])
173
-
174
- def post_draw(self, drawing, frame):
175
- drawing.restore()
176
-
177
-class Translate (Movement):
178
- """Translates the layer to some relative (x,y) coordinates
179
- """
180
- def __init__(self, start, end, (dx, dy)):
181
- Movement.__init__(self, start, end, (0, 0), (dx, dy))
182
-
183
-
184
-class Fade (Effect):
185
- """A generic fade effect, varying the opacity of a layer.
186
- """
187
- def __init__(self, keyframes, method='linear'):
188
- """Fade in from start, for fade_length frames; hold at full
189
- opacity, then fade out for fade_length frames before end.
190
-
191
- fade_length
192
- Number of frames to fade-in from start, and number of
193
- frames to fade-out before end. Everything in-between
194
- is at full opacity.
195
- keyframes
196
- A set of Keyframe() objects, determining the fading
197
- curve. Values of the Keyframe() must be floats ranging
198
- from 0.0 to 1.0 (setting opacity).
199
- method
200
- 'linear' or 'cosine' interpolation
201
tovid-0.34.tar.bz2/libtovid/render/flipbook.py
Deleted
201
1
2
-"""This module provides the Flipbook class, a collection of drawings that, when
3
-displayed in sequence, make up an animation or video.
4
-
5
-Run this module standalone for a demonstration:
6
-
7
- $ python flipbook.py
8
-
9
-To use this module interactively, run 'python' from the command-line, and do:
10
-
11
- >>> from libtovid.render.flipbook import Flipbook
12
-
13
-To create a Flipbook 10 seconds long with 'dvd' and 'ntsc' standards, do:
14
-
15
- >>> flipbook = Flipbook(10, 'dvd', 'ntsc', '4:3')
16
-
17
-You can retrieve the canvas width and height with:
18
-
19
- >>> flipbook.canvas
20
- (640, 480)
21
- >>> flipbook.w
22
- 640
23
- >>> flipbook.h
24
- 480
25
-
26
-All drawing upon a Flipbook is achieved through the use of layers (layer.py).
27
-To use them, import the layer module:
28
-
29
- >>> from libtovid.render import layer
30
-
31
-You can add layers to a Flipbook on-the-fly:
32
-
33
- >>> flipbook.add(layer.Background('black'))
34
- >>> flipbook.add(layer.Text("Hello, world"))
35
-
36
-Or, create layers separately before adding them to the Flipbook:
37
-
38
- >>> text = Text("Elephant talk")
39
- >>> flipbook.add(text)
40
-
41
-This latter approach is useful if you plan to apply animation effects to the
42
-Layer. For this, effects classes (effect.py) may be applied. First, import:
43
-
44
- >>> from libtovid.render import effect
45
-
46
-Now, say we want the text "Elephant talk" to move across the screen, say from
47
-(100, 100) to (500, 100) over the course of the first 90 frames. The
48
-effect.Movement class does the trick:
49
-
50
- >>> text.add_effect(effect.Movement(1, 90, (100, 100), (500, 100)))
51
-
52
-You can preview a specific frame of the Flipbook by calling render():
53
-
54
- >>> flipbook.render(50)
55
-
56
-Or, you can generate all frames and create an .m2v video stream file by calling
57
-render_video():
58
-
59
- >>> filename = flipbook.render_video()
60
-
61
-See the demo below for more on what's possible with Flipbooks.
62
-"""
63
-
64
-__all__ = ['Flipbook']
65
-
66
-import os
67
-import sys
68
-import time
69
-import math
70
-import cairo
71
-import shutil
72
-import random
73
-from libtovid.render.animation import Keyframe
74
-from libtovid.render.drawing import Drawing, interlace_drawings
75
-from libtovid.render.drawing import write_ppm, write_png, save_png
76
-from libtovid.render import layer, effect
77
-from libtovid import standard
78
-from libtovid.media import MediaFile
79
-from libtovid.backend import mplex, mplayer, ffmpeg
80
-
81
-
82
-class Flipbook:
83
- """A collection of Drawings that together comprise an animation.
84
- """
85
- def __init__(self, seconds, format, tvsys, aspect='4:3', interlaced=False):
86
- """Create a flipbook of the given length in seconds, at the given
87
- resolution.
88
-
89
- seconds
90
- Length of flipbook playback in seconds
91
- format
92
- 'dvd', 'vcd', 'svcd', 'dvd-vcd', or 'half-dvd'
93
- tvsys
94
- 'ntsc' or 'pal'
95
- aspect
96
- '4:3' or '16:9' (the latter only for format='dvd')
97
- interlaced
98
- True/False. When enabled, the framerate will be doubled,
99
- but only half the frames (twice the fields) will be rendered.
100
-
101
- Once you've created the Flipbook, you can grab the dimensions
102
- in with the property:
103
-
104
- flipbook.canvas as (width, height)
105
-
106
- and with the two properties:
107
-
108
- flipbook.w (width)
109
- flipbook.h (height)
110
- """
111
- self.tmpdir = '/tmp'
112
- if 'TMPDIR' in os.environ:
113
- self.tmpdir = os.environ['TMPDIR']
114
- self.seconds = float(seconds)
115
- self.fps = standard.fps(tvsys)
116
- self.fps_ratio = standard.fps_ratio(tvsys)
117
- if (interlaced):
118
- self.fps *= 2
119
- self.interlaced = interlaced
120
- self.frames = int(seconds * self.fps)
121
- self.output_size = standard.resolution(format, tvsys)
122
- # TODO: We'll need aspect ratio here.. 4:3 or 16:9 anamorphic ?
123
- self.format = format
124
- self.tvsys = tvsys
125
- if (aspect not in ['4:3', '16:9']):
126
- raise ValueError, "aspect must be: '4:3' or '16:9'"
127
- self.aspect = aspect
128
- self.widescreen = False
129
- if (aspect == '16:9'):
130
- self.widescreen = True
131
-
132
- self.canvas = self.get_canvas_size()
133
- self.w = self.canvas[0]
134
- self.h = self.canvas[1]
135
-
136
- # Empty layers, and currently no drawings.
137
- self.layers = []
138
- self.drawings = []
139
-
140
- self.called_init_childs = False
141
-
142
-
143
- def init_childs(self):
144
- """Give access to all descendant layers and effects to their parents.
145
-
146
- In layers, you can access your parent layer (if sublayed) with:
147
- layer._parent_layer
148
- and to the top Flipbook object with:
149
- layer._parent_flipbook
150
-
151
- This function gets called just before rendering a video with
152
- render_video()
153
-
154
- It's also called in emergency if you call directly get_drawing().
155
- """
156
- for x in range(0, len(self.layers)):
157
- self.layers[x][0].init_parent_flipbook(self)
158
- self.layers[x][0].init_childs()
159
-
160
- self.called_init_childs = True
161
-
162
-
163
- def stof(self, seconds):
164
- """Return the number of frames to the specified time (in seconds).
165
- """
166
- return int(self.fps * float(seconds))
167
-
168
-
169
- def get_canvas_size(self):
170
- """Return the dimensions of the canvas.
171
- """
172
- #ow = self.output_size[0]
173
- oh = self.output_size[1]
174
- a = self.aspect.split(':')
175
-
176
- # Calculate the square pixels canvas size based on aspect ratio
177
- # and intended output size.
178
- x = float(a[0]) * float(oh) / float(a[1])
179
- # Make sure they are factor of '2'
180
- nw = int(math.ceil(x / 2.0) * 2)
181
-
182
- # We'll always change only the width, like it seems the standard,
183
- # since on TVs, the number of *lines* can't change (when interlacing
184
- # is into business)
185
- return (nw, oh)
186
-
187
-
188
- def add(self, layer, position=(0, 0)):
189
- """Add a Layer to the flipbook.
190
- """
191
- self.layers.append((layer, position))
192
-
193
-
194
- def render(self, frame=1):
195
- """Render the given frame.
196
- """
197
- print("DEPRECATED FUNCTION.")
198
- exit()
199
-
200
- filename = "/tmp/flipbook_%s.png" % frame
201
tovid-0.34.tar.bz2/libtovid/render/layer.py
Deleted
201
1
2
-"""This module provides a Layer class and several derivatives. A Layer
3
-is a graphical overlay that may be composited onto an image canvas.
4
-
5
-Run this script standalone for a demonstration:
6
-
7
- $ python libtovid/layer.py
8
-
9
-Layer subclasses may combine graphical elements, including other Layers,
10
-into a single interface for drawing and customizing those elements. Layers may
11
-exhibit animation, through the use of keyframed drawing commands, or through
12
-use of the Effect class (and its subclasses, as defined in libtovid/effect.py).
13
-
14
-Each Layer subclass provides (at least) an __init__ function, and a draw
15
-function. For more on how to use Layers, see the Layer class definition and
16
-template example below.
17
-"""
18
-
19
-__all__ = [
20
- 'Layer',
21
- 'Background',
22
- 'Text',
23
- 'ShadedText',
24
- 'Label',
25
- 'VideoClip',
26
- 'Image',
27
- 'Thumb',
28
- 'ThumbGrid',
29
- 'SafeArea',
30
- 'Scatterplot',
31
- 'InterpolationGraph',
32
- 'ColorBars',
33
-]
34
-
35
-import os
36
-import sys
37
-import math
38
-import commands
39
-from libtovid.util import get_file_type
40
-from libtovid.render.drawing import Drawing, save_image
41
-from libtovid.render.effect import Effect
42
-from libtovid.render.animation import Keyframe, Tween
43
-from libtovid.media import MediaFile
44
-from libtovid.backend import transcode
45
-from libtovid import log
46
-
47
-class Layer:
48
- """A visual element, or a composition of visual elements. Conceptually
49
- similar to a layer in the GIMP or Photoshop, with support for animation
50
- effects and sub-Layers.
51
- """
52
- def __init__(self):
53
- """Initialize the layer. Extend this in derived classes to accept
54
- configuration settings for drawing the layer; call this function
55
- from any derived __init__ functions.
56
- """
57
- self.effects = []
58
- self.sublayers = []
59
- self._parent_flipbook = None
60
- self._parent_layer = None
61
-
62
- ###
63
- ### Child-parent initialization
64
- ###
65
- def init_childs(self):
66
- """Give access to all descendant layers and effects to their parents.
67
-
68
- In layers, you can access your parent layer (if sublayed) with:
69
- layer._parent_layer
70
- and to the top Flipbook object with:
71
- layer._parent_flipbook
72
- """
73
- for x in range(0, len(self.effects)):
74
- self.effects[x].init_parent_flipbook(self._parent_flipbook)
75
- self.effects[x].init_parent_layer(self)
76
- for x in range(0, len(self.sublayers)):
77
- self.sublayers[x][0].init_parent_flipbook(self._parent_flipbook)
78
- self.sublayers[x][0].init_parent_layer(self)
79
- self.sublayers[x][0].init_childs(self)
80
-
81
- def init_parent_flipbook(self, flipbook):
82
- self._parent_flipbook = flipbook
83
-
84
- def init_parent_layer(self, layer):
85
- self._parent_layer = layer
86
-
87
-
88
- ###
89
- ### Derived-class interface
90
- ###
91
-
92
- def draw(self, drawing, frame):
93
- """Draw the layer and all sublayers onto the given Drawing. Override
94
- this function in derived layers.
95
- """
96
- assert isinstance(drawing, Drawing)
97
-
98
- ###
99
- ### Sublayer and effect interface
100
- ###
101
-
102
- def add_sublayer(self, layer, position=(0, 0)):
103
- """Add the given Layer as a sublayer of this one, at the given position.
104
- Sublayers are drawn in the order they are added; each sublayer may have
105
- its own effects, but the parent Layer's effects apply to all sublayers.
106
- """
107
- assert isinstance(layer, Layer)
108
- self.sublayers.append((layer, position))
109
-
110
- def draw_sublayers(self, drawing, frame):
111
- """Draw all sublayers onto the given Drawing for the given frame.
112
- """
113
- assert isinstance(drawing, Drawing)
114
- for sublayer, position in self.sublayers:
115
- drawing.save()
116
- drawing.translate(*position)
117
- sublayer.draw(drawing, frame)
118
- drawing.restore()
119
-
120
- def add_effect(self, effect):
121
- """Add the given Effect to this Layer. A Layer may have multiple effects
122
- applied to it; all effects apply to the current layer, and all sublayers.
123
- """
124
- assert isinstance(effect, Effect)
125
- self.effects.append(effect)
126
-
127
- def draw_with_effects(self, drawing, frame):
128
- """Render the entire layer, with all effects applied.
129
-
130
- drawing: A Drawing object to draw the Layer on
131
- frame: The frame number that is being drawn
132
-
133
- """
134
- # Do preliminary effect rendering
135
- for effect in self.effects:
136
- effect.pre_draw(drawing, frame)
137
- # Draw the layer and sublayers
138
- self.draw(drawing, frame)
139
- # Close out effect rendering, in reverse (nested) order
140
- for effect in reversed(self.effects):
141
- effect.post_draw(drawing, frame)
142
-
143
-
144
-# Layer template
145
-#
146
-# Copy and paste the following code to create your own Layer.
147
-#
148
-# Layer subclasses should define two things:
149
-#
150
-# __init__(): How to initialize the layer with parameters
151
-# draw(): How do draw the layer on a Drawing
152
-#
153
-# First, declare the layer class name. Include (Layer) to indicate that your
154
-# class is a Layer.
155
-
156
-class MyLayer (Layer):
157
- """Overlapping semitransparent rectangles.
158
- (Modify this documentation string to describe what's in your layer)"""
159
- # Here's the class initialization function, __init__. Define here any
160
- # parameters that might be used to configure your layer's behavior or
161
- # appearance in some way (along with default values, if you like). Here,
162
- # we're allowing configuration of the fill and stroke colors, with default
163
- # values of 'blue' and 'black', respectively:
164
-
165
- def __init__(self, fill_color='blue', stroke_color='black'):
166
- """Create a MyLayer with the given fill and stroke colors."""
167
- # Initialize the base Layer class. Always do this.
168
- Layer.__init__(self)
169
- # Store the given colors, for later use
170
- self.fill_color = fill_color
171
- self.stroke_color = stroke_color
172
-
173
- # The draw() function is responsible for rendering the contents of the
174
- # layer onto a Drawing. It will use the configuration given to __init__
175
- # (in this case, fill and stroke colors) to render something onto a Drawing
176
- # associated with a particular frame number:
177
-
178
- def draw(self, drawing, frame):
179
- """Draw MyLayer contents onto the given drawing, at the given frame
180
- number."""
181
-
182
- # For safety's sake, make sure you really have a Drawing object:
183
- assert isinstance(drawing, Drawing)
184
-
185
- # Save the drawing context. This prevents any upcoming effects or
186
- # style changes from messing up surrounding layers in the Drawing.
187
- drawing.save()
188
-
189
- # Get a Cairo pattern source for the fill and stroke colors
190
- # (TODO: Make this easier, or use a simpler example)
191
- fc = drawing.create_source(self.fill_color, 0.6)
192
- sc = drawing.create_source(self.stroke_color)
193
-
194
- # And a stroke width of 1, say:
195
- drawing.stroke_width(1)
196
-
197
- # Now, draw something. Here, a couple of pretty semitransparent
198
- # rectangles, using the fill and stroke color patterns created earlier:
199
- drawing.rectangle(0, 0, 50, 20)
200
- drawing.fill(fc)
201
tovid-0.34.tar.bz2/libtovid/runtest.py
Deleted
66
1
2
-# runtest.py
3
-
4
-"""libtovid test script
5
-
6
-Execute this script to run tests on the modules in libtovid. These tests
7
-consist of executing each libtovid module standalone; it is presumed that
8
-each module to be tested contains at least the following::
9
-
10
- import unittest
11
- if __name__ == '__main__':
12
- unittest.main()
13
-
14
-which runs unit tests, or::
15
-
16
- import doctest
17
- if __name__ == '__main__':
18
- doctest.testmod(verbose=True)
19
-
20
-which does an automated verification of the docstrings in each module.
21
-
22
-NB -- You're going to get lots of output, so a ``> log.txt`` is advised.
23
-"""
24
-
25
-import os
26
-import commands
27
-from glob import glob
28
-
29
-libtovid_modules = [
30
- 'author.py',
31
- 'cli.py',
32
- 'deps.py',
33
- 'encode.py',
34
- 'media.py',
35
- 'odict.py',
36
- 'opts.py',
37
- 'standard.py',
38
- 'stats.py',
39
- 'xml.py',
40
-]
41
-
42
-subdirs = [
43
- 'backend',
44
- 'metagui',
45
- 'render',
46
- 'template',
47
- 'test',
48
- 'util',
49
-]
50
-
51
-subdir_modules = []
52
-for subdir in subdirs:
53
- subdir_modules.extend(glob('%s/*.py' % subdir))
54
-
55
-all_modules = libtovid_modules + subdir_modules
56
-
57
-if __name__ == '__main__':
58
- # Execute each module
59
- for mod in all_modules:
60
- print("Testing: %s" % mod)
61
- try:
62
- print(commands.getoutput('python %s' % mod))
63
- except KeyboardInterrupt:
64
- print("Test interrupted.")
65
- exit()
66
tovid-0.34.tar.bz2/libtovid/standard.py
Deleted
149
1
2
-# standard.py
3
-
4
-"""This module defines functions for retrieving information about multimedia
5
-standards, including functions for determining the appropriate resolution,
6
-video and audio codec, fps, and bitrates for a given format.
7
-"""
8
-
9
-__all__ = [
10
- 'abitrate',
11
- 'acodec',
12
- 'fps',
13
- 'fps_ratio',
14
- 'resolution',
15
- 'samprate',
16
- 'vbitrate',
17
- 'vcodec',
18
-]
19
-
20
-def resolution(format, tvsys):
21
- """Return the pixel resolution (x,y) for the given format and TV system.
22
- For example::
23
-
24
- >>> resolution('dvd', 'pal')
25
- (720, 576)
26
- >>> resolution('half-dvd', 'ntsc')
27
- (352, 480)
28
- """
29
- # Valid resolutions, indexed by format and tvsys
30
- valid_size = {
31
- 'vcd':
32
- {'pal': (352, 288), 'ntsc': (352, 240)},
33
- 'dvd-vcd':
34
- {'pal': (352, 288), 'ntsc': (352, 240)},
35
- 'svcd':
36
- {'pal': (480, 576), 'ntsc': (480, 480)},
37
- 'half-dvd':
38
- {'pal': (352, 576), 'ntsc': (352, 480)},
39
- 'dvd':
40
- {'pal': (720, 576), 'ntsc': (720, 480)}
41
- }
42
- return valid_size[format][tvsys]
43
-
44
-
45
-def vcodec(format):
46
- """Return the video codec used by the given format.
47
- For example::
48
-
49
- >>> vcodec('vcd')
50
- 'mpeg1'
51
- >>> vcodec('svcd')
52
- 'mpeg2'
53
- """
54
- if format == 'vcd':
55
- return 'mpeg1'
56
- else:
57
- return 'mpeg2'
58
-
59
-
60
-def acodec(format):
61
- """Return the audio codec (or codecs) supported by the given format.
62
- For example::
63
-
64
- >>> acodec('vcd')
65
- 'mp2'
66
- >>> acodec('dvd')
67
- 'ac3'
68
- """
69
- if format in ['vcd', 'svcd']:
70
- return 'mp2'
71
- else:
72
- return 'ac3'
73
-
74
-
75
-def samprate(format):
76
- """Return the audio sampling rate used by the given format.
77
- """
78
- if format in ['vcd', 'svcd']:
79
- return 44100
80
- else:
81
- return 48000
82
-
83
-
84
-def fps(tvsys):
85
- """Return the number of frames per second for the given TV system.
86
- For example::
87
-
88
- >>> print(fps('ntsc'))
89
- 29.97
90
- >>> print(fps('pal'))
91
- 25.0
92
- """
93
- # Valid frames per second, by TV system
94
- _fps = {
95
- 'pal': 25.0,
96
- 'ntsc': 29.97,
97
- 'ntscfilm': 23.976,
98
- }
99
- return _fps[tvsys]
100
-
101
-
102
-def fps_ratio(tvsys):
103
- """Return the number of frames per second for the given TV system,
104
- in ratio form. For example::
105
-
106
- >>> fps_ratio('ntsc')
107
- '30000:1001'
108
- >>> fps_ratio('pal')
109
- '25:1'
110
- """
111
- # Valid frames per second, by TV system
112
- _fps = {
113
- 'pal': '25:1',
114
- 'ntsc': '30000:1001',
115
- 'ntscfilm': '24000:1001',
116
- }
117
- return _fps[tvsys]
118
-
119
-
120
-def vbitrate(format):
121
- """Return the range (min, max) of valid video bitrates (in kilobits per
122
- second) for the given format. min and max are the same for constant-bitrate
123
- formats.
124
- """
125
- # Valid video bitrates, indexed by format
126
- valid_bitrates = {
127
- 'vcd': (1150, 1150),
128
- 'svcd': (0, 2600),
129
- 'dvd-vcd': (0, 9800),
130
- 'half-dvd': (0, 9800),
131
- 'dvd': (0, 9800)
132
- }
133
- return valid_bitrates[format]
134
-
135
-
136
-def abitrate(format):
137
- """Return the range (min, max) of valid audio bitrates (in kilobits per
138
- second) for the given format. For constant-bitrate formats, min == max.
139
- """
140
- if format == 'vcd':
141
- return (224, 224)
142
- elif format == 'svcd':
143
- return (32, 384)
144
- else:
145
- return (32, 1536)
146
-
147
-
148
-
149
tovid-0.34.tar.bz2/libtovid/stats.py
Deleted
201
1
2
-# stats.py
3
-
4
-"""Classes and functions for dealing with tovid statistics.
5
-
6
-Future interface ideas:
7
-
8
-* Display certain records, or a range of records (records 1-10; last 15 records;
9
- records with a certain field (or any field) matching given text/regexp
10
-* Display formatted output of all records, or a selection of records,
11
- with control over which fields are displayed
12
-
13
-"""
14
-
15
-import csv
16
-import sys
17
-from copy import copy
18
-
19
-# Order of fields in stats.tovid
20
-FIELDS = [
21
- 'tovid_version',
22
- 'final_name',
23
- 'length', # a.k.a. CUR_LENGTH
24
- 'format', # RES
25
- 'tvsys',
26
- 'final_size',
27
- 'tgt_bitrate',
28
- 'avg_bitrate',
29
- 'peak_bitrate',
30
- 'gop_minsize',
31
- 'gop_maxsize',
32
- 'encoding_time', # SCRIPT_TOT_TIME
33
- 'cpu_model',
34
- 'cpu_speed',
35
- 'in_vcodec',
36
- 'in_acodec',
37
- 'encoding_mode',
38
- 'in_md5',
39
- 'in_width',
40
- 'in_height',
41
- 'quant',
42
- 'kbpm',
43
- 'enc_time_ratio',
44
- 'backend',
45
- ]
46
-
47
-# Integer numeric fields
48
-int_fields = [
49
- 'length',
50
- 'avg_bitrate',
51
- 'tgt_bitrate',
52
- 'peak_bitrate',
53
- 'encoding_time',
54
- 'final_size',
55
- 'cpu_speed',
56
- 'in_width',
57
- 'in_height',
58
- 'quant',
59
- 'kbpm',
60
- ]
61
-
62
-class Statlist:
63
- """A list of statistics that may be queried with a simple database-like
64
- interface."""
65
- def __init__(self, records=None, filename=''):
66
- """Create a Statlist, using the given list of records, or by reading
67
- from the given filename (CSV text).
68
- """
69
- # Use provided records, if any
70
- if records:
71
- self.records = copy(records)
72
- # Otherwise, read from any provided filename
73
- else:
74
- self.records = []
75
- if filename != '':
76
- self.read_csv(filename)
77
-
78
-
79
- def read_csv(self, filename):
80
- """Import stats from a CSV (comma-delimited quoted text) file."""
81
- self.records = []
82
- statfile = open(filename, 'r')
83
- csv_reader = csv.DictReader(statfile, FIELDS, skipinitialspace=True)
84
- for line in csv_reader:
85
- # Convert some string and numeric fields
86
- line['format'] = str.lower("%s" % line['format'])
87
- line['tvsys'] = str.lower("%s" % line['tvsys'])
88
- for field in int_fields:
89
- try:
90
- num = int("%s" % line[field])
91
- except (ValueError, TypeError):
92
- num = 0
93
- line[field] = num
94
- self.records.append(line)
95
-
96
- statfile.close()
97
- print("Read %s lines from %s" % (len(self.records), filename))
98
-
99
-
100
- def unique(self, field):
101
- """Return a list of unique values of the given field."""
102
- unique_values = []
103
- for record in self.records:
104
- if record[field] not in unique_values:
105
- unique_values.append(record[field])
106
- return unique_values
107
-
108
-
109
- def count_unique(self, field):
110
- """Count the occurrences of each unique value of the given field.
111
- Return a dictionary of unique values and the number of occurrences
112
- of each."""
113
- counts = {}
114
- # Go through all records and total up occurrences of each value
115
- for record in self.records:
116
- value = record[field]
117
- if value is None or value == '':
118
- pass
119
- elif value not in counts:
120
- counts[value] = 1
121
- else:
122
- counts[value] += 1
123
- return counts
124
-
125
-
126
- def average(self, attribute):
127
- """Calculate the average value for a given numeric VidStat attribute.
128
- For example, average('bitrate') returns the average overall bitrate of
129
- all videos in the list."""
130
- # Error if attribute is non-numeric
131
- if attribute not in int_fields:
132
- print("Can't average %s: not defined as a numeric field")
133
- sys.exit()
134
-
135
- values = []
136
- for record in self.records:
137
- # Only append non-zero values
138
- if record[attribute] != 0:
139
- values.append(record[attribute])
140
- if len(values) > 0:
141
- return float(sum(values) / len(values))
142
- else:
143
- return 0.0
144
-
145
-
146
- def average_by(self, attribute, by_attribute):
147
- """Return a dictionary of averages of an attribute, indexed by another
148
- attribute. For example, average_by('bitrate', 'format') returns average
149
- bitrates for each format."""
150
- # Error if attribute is non-numeric
151
- if attribute not in int_fields:
152
- print("Can't average %s: not defined as a numeric field")
153
- sys.exit()
154
-
155
- values_by = self.list_by(attribute, by_attribute)
156
- # Calculate averages for each value-list
157
- averages = {}
158
- if len(values_by) > 0:
159
- for key, samples in values_by.iteritems():
160
- try:
161
- averages[key] = float(sum(samples) / len(samples))
162
- except ZeroDivisionError:
163
- averages[key] = 0.0
164
- return averages
165
-
166
-
167
- def list_by(self, attribute, by_attribute, sort_lists=False):
168
- """Return a dictionary of lists of values of the given attribute,
169
- indexed by another attribute. If sort_lists is True, sort all lists."""
170
- # Create a dictionary of value-lists, indexed by by_attribute
171
- values_by = {}
172
- for record in self.records:
173
- byval = record[by_attribute]
174
- if not values_by.has_key(byval):
175
- values_by[byval] = []
176
- # Only include non-zero values
177
- if record[attribute] != 0:
178
- values_by[byval].append(record[attribute])
179
- if sort_lists:
180
- for index in values_by.iterkeys():
181
- values_by[index].sort()
182
- return values_by
183
-
184
-
185
- def get_matching(self, attribute, value):
186
- """Return a list of records where the given attribute equals the given
187
- value. Records are field-indexed dictionaries of values.
188
- """
189
- # List of matching records
190
- matches = []
191
- for record in self.records:
192
- if record[attribute] == value:
193
- matches.append(record)
194
- return matches
195
-
196
-
197
- def length(self, field):
198
- """Return the length of the longest record in the given field, or the
199
- width of the field name itself, whichever is greater."""
200
- longest = len(field)
201
tovid-0.34.tar.bz2/libtovid/xml.py
Deleted
140
1
2
-"""This module is for defining XML elements and attributes, and for creating
3
-element hierarchies.
4
-
5
-To create a new element, use the `Element` constructor, providing at
6
-least the element name::
7
-
8
- >>> video = Element('video')
9
-
10
-To see an XML representation of the Element::
11
-
12
- >>> print(video)
13
- <video></video>
14
-
15
-Since this is an empty element with no attributes yet, it's pretty boring.
16
-You can add or change attributes using the `~Element.set` method::
17
-
18
- >>> video.set(file="Brian.mpg")
19
- >>> print(video)
20
- <video file="Brian.mpg"></video>
21
-
22
-To add children to an element, use the `~Element.add` method::
23
-
24
- >>> length = video.add('length', '15')
25
- >>> print(video)
26
- <video file="Brian.mpg">
27
- <length>15</length>
28
- </video>
29
-
30
-See `libtovid.author` and `libtovid.backend.spumux` for additional
31
-examples.
32
-"""
33
-
34
-__all__ = ['Element']
35
-
36
-class Element (object):
37
- """A named XML element having optional content, attributes, and children.
38
-
39
- Attribute values may be set in the constructor, or by calling `set` with a
40
- dictionary and/or attribute=value keywords.
41
-
42
- Use `add` or `add_child` to create a hierarchy of Elements.
43
- """
44
- def __init__(self, name, content='', **attributes):
45
- """Create a new Element with the given attributes.
46
-
47
- name
48
- Name of the Element
49
- content
50
- Text content of the Element
51
- attributes
52
- Keyword=value for specific attributes
53
- """
54
- self.name = name
55
- self.content = content
56
- self.attributes = {}
57
- self.children = []
58
- # Set attributes from those provided
59
- self.set(**attributes)
60
-
61
-
62
- def set(self, **attributes):
63
- """Set values for one or more attributes.
64
-
65
- attributes
66
- Keyword arguments for setting specific attributes
67
-
68
- Underscores in attribute names are converted to hyphens. If you don't
69
- like this behavior, please suggest a workaround :-)
70
- """
71
- # Set attribute values; convert underscores to hyphens
72
- for key, value in attributes.iteritems():
73
- key = key.replace('_', '-')
74
- self.attributes[key] = value
75
-
76
-
77
- def add(self, child_name, content='', **attributes):
78
- """Create and add a new child Element by providing its name, content,
79
- and attributes. Return the newly-added Element.
80
-
81
- child
82
- String name of child element
83
- content
84
- String content of child element
85
- attributes
86
- Keyword arguments for setting child's attributes
87
-
88
- This is a convenience function for creating and adding children
89
- on-the-fly.
90
- """
91
- child = Element(child_name, content, **attributes)
92
- self.children.append(child)
93
- return child
94
-
95
-
96
- def add_child(self, element):
97
- """Add the given Element as a child of this Element.
98
- """
99
- assert isinstance(element, Element)
100
- self.children.append(element)
101
-
102
-
103
- def xml(self, indent_level=0):
104
- """Return formatted XML for this Element and all descendants.
105
- """
106
- indent = ' ' * indent_level
107
- # No children; write a single line
108
- if len(self.children) == 0:
109
- text = indent + self._open() + self.content + self._close() + '\n'
110
- # If children, write an indented block
111
- else:
112
- text = indent + self._open() + self.content + '\n'
113
- for child in self.children:
114
- text += child.xml(indent_level + 1)
115
- text += indent + self._close() + '\n'
116
- return text
117
-
118
-
119
- def __str__(self):
120
- """Return a string containing formatted XML for the Element.
121
- """
122
- return self.xml().rstrip('\n')
123
-
124
-
125
- def _open(self):
126
- """Return the XML opening tag for the Element.
127
- """
128
- attribs = ''
129
- for key, value in self.attributes.items():
130
- attribs += ' %s="%s"' % (key, value)
131
- return '<' + self.name + attribs + '>'
132
-
133
-
134
- def _close(self):
135
- """Return the XML closing tag for the Element.
136
- """
137
- return '</' + self.name + '>'
138
-
139
-
140
tovid-0.34.tar.bz2/src/make_titlesets
Deleted
201
1
2
-#!/bin/bash
3
-# Part of the tovid suite
4
-# =======================
5
-# A bash script that calls the tovid GUI in order to allow titlesets,
6
-# something the GUI is not capable of on its own at the moment.
7
-# This script depends on the GUI, in addition to the other command
8
-# line scripts of the tovid suite such as todisc, makempg, and idvid.
9
-#
10
-# Project homepage: http://tovid.wikia.com
11
-#
12
-# Copyright (C) 2005-2010
13
-#
14
-# This program is free software; you can redistribute it and/or
15
-# modify it under the terms of the GNU General Public License
16
-# as published by the Free Software Foundation; either
17
-# version 2 of the License, or (at your option) any later
18
-# version.
19
-#
20
-# This program is distributed in the hope that it will be useful,
21
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
-# GNU General Public License for more details.
24
-#
25
-# You should have received a copy of the GNU General Public License
26
-# along with this program; if not, write to the Free Software
27
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
28
-#
29
-# http://www.gnu.org/licenses/gpl.txt
30
-
31
-
32
-# Written by Robert ("grepper") Sohn
33
-# grepper at gmail dot com
34
-
35
-#############################################################################
36
-###############################Variables ####################################
37
-#############################################################################
38
-path=$(tovid -prefix)
39
-PATH=$path:$PATH
40
-SEP=$(for i in {1..79}; do printf '='; done)
41
-final_tmp_script=$(mktemp -t todisc.XXXXXXXX)
42
-final_script="$PWD/todisc_commands.bash"
43
-
44
-##############################################################################
45
-################################## Functions #################################
46
-##############################################################################
47
-# read_script name
48
-read_script()
49
-{
50
- script_exists=0
51
- script_name="$1"
52
- # if user just pressed enter, test that the default name exists (it should)
53
- if [[ -z $script_name ]]; then
54
- script_name="$final_script"
55
- [[ -e $script_name ]] && script_exists=1
56
- fi
57
- # else test if the file name path passed in exists
58
- while ! (( script_exists )); do
59
- read script_name
60
- script_name=$(readlink -f "$script_name")
61
- if [[ -e "$script_name" ]] ; then
62
- script_exists=1
63
- else
64
- echo "Sorry, $script_name does not point to an existing file."
65
- echo "Please re-enter the path to the script."
66
- echo "You can use the full path or the path relative to $PWD"
67
- fi
68
- done
69
- SCRIPT="$script_name"
70
-}
71
-
72
-run_gui()
73
-{
74
- todiscgui &>/dev/null &
75
- tovid_pid=$!
76
- sleep 2
77
- echo $SEP
78
- echo "Make your selections, then save your script and exit GUI to continue..."
79
- wait $tovid_pid
80
- echo $SEP
81
- echo "Press <ENTER> to accept the default path and filename "
82
- echo "for the file you just saved."
83
- echo "Or enter the relative or full path"
84
- echo "[${final_script}]"
85
- read script
86
- read_script "$script"
87
-
88
- todisc_tmp=$(mktemp todisc_tmpXXXXXX)
89
- mv "$SCRIPT" "$todisc_tmp"
90
- echo $SEP
91
- echo "Okay, the content is saved, please save to the same file next time."
92
- echo "Press <ENTER> to continue"
93
- read cont
94
-}
95
-
96
-# clean_script file
97
-clean_script()
98
-{
99
- file="$1"
100
- # remove shebang and PATH
101
- sed -i '/\#\!\/usr\/bin\/env bash/d;/PATH/d' "$file"
102
- # remove todisc command
103
- sed -i '/^todisc \\$/d' "$file"
104
- # remove opening blank lines
105
- sed -i '/./,/^$/!d' "$file"
106
-}
107
-
108
-##############################################################################
109
-############################ Main body starts here ###########################
110
-##############################################################################
111
-
112
-##############################################################################
113
-############################## General Options ###############################
114
-##############################################################################
115
-cat <<EOF
116
-
117
-$SEP
118
-We are going to create a complete DVD with titlesets and menus.
119
-
120
-I am going to start tovid gui. Please enter the general
121
-options there that you would like to apply to every titleset.
122
-"Output name" (bottom of main screen) is the only required general
123
-option. When you are done, press the 'Save script' button and save to
124
-"${final_script}"
125
-accepting the default filename and making sure you are
126
-in the correct directory. You must then close the GUI in order to continue.
127
-
128
-Press <ENTER> to continue...
129
-EOF
130
-read cont
131
-if [[ -e $final_script ]]; then
132
- new_name=$(TMPDIR=`pwd` mktemp -t todisc_commands.bash.XXXXXX)
133
- echo "The file we will use to save options: \"${final_script}\",
134
- exists in the current directory. It will be renamed:
135
- to $new_name if you continue." |sed 's/^[ \t]*//;s/[ \t]*$//'
136
- echo "press <ENTER> to continue..."
137
- read cont
138
-fi
139
-[[ -e "$final_script" ]] && mv "$final_script" "$new_name"
140
-
141
-run_gui
142
-##############################################################################
143
-################################# VMGM Menu ##################################
144
-##############################################################################
145
-
146
-####################### Titleset Titles for VMGM menu ########################
147
-cat <<EOF
148
-
149
-Now we will save options for your root (VMGM) menu
150
-The only option you really need is the titleset titles.
151
-Since you can not save titles in the GUI without loading videos
152
-you will need to enter them here.
153
-These titleset names will appear as menu titles for the respective menu
154
-in your DVD
155
-EOF
156
-echo $SEP
157
-echo "Press <ENTER> to continue..."
158
-read cont
159
-cat <<EOF
160
-
161
-Enter the names of your titlesets, one per line pressing <ENTER> each time.
162
-Do not use quotes unless you want them to appear literally in the title.
163
-Type "done" when you are finished.
164
-EOF
165
-
166
-done=0
167
-while ! ((done)); do
168
- read title
169
- if [[ $title == "done" ]]; then
170
- done=1
171
- else
172
- MENU_TITLES+=("$title")
173
- fi
174
-done
175
-# add backslash to last line; add -vmgm and -titles; add menu titles
176
-sed -i "\$s/$/ \\\/" "$todisc_tmp"
177
-sed -i '$ a -vmgm \\' "$todisc_tmp"
178
-sed -i '$ a -titles \\' "$todisc_tmp"
179
-printf '"%s" \\\n' "${MENU_TITLES[@]}" >> "$todisc_tmp"
180
-mv "$todisc_tmp" "$final_tmp_script"
181
-
182
-############################# VMGM Menu options ##############################
183
-cat <<EOF
184
-
185
-Now I will bring the GUI up again - enter options for your root
186
-(VMGM) menu.
187
-Remember that this menu (VMGM) does not need video files.
188
-You still have many options, but none are strictly necessary. For example
189
-you may wish to use background (audio and/or image/video), a
190
-showcased image/video, set the fonts, use a "Playall" button...
191
-You should also set the menu title to a new name. When you are done save
192
-the script again to
193
-$final_script
194
-and close the GUI to continue.
195
-EOF
196
-echo "Press <ENTER> to continue..."
197
-read cont
198
-run_gui
199
-clean_script "$todisc_tmp"
200
-# add backslash to last line
201
tovid-0.34.tar.bz2/src/makemenu
Deleted
201
1
2
-#!/usr/bin/env bash
3
-ME="[makemenu]:"
4
-. tovid-init 2>/dev/null ||
5
-{ echo -e "===============================================================\n"
6
-echo -e "'tovid-init' not found. Was tovid improperly installed?"
7
-echo -e "Or are you trying to run the script directly?"
8
-echo -e "Please run makemenu as:\ntovid menu OPTIONS"
9
-exit 1 ; }
10
-
11
-# version $Id: makemenu 3336 2011-06-30 21:49:22Z grepper $
12
-# makemenu
13
-# Part of the tovid suite
14
-# =======================
15
-# A bash script for generating menus for use with DVD, VCD, or SVCD.
16
-# Given a background image and a list of titles, and an optional audio
17
-# file to use as background music, this script produces an MPEG video
18
-# displaying the specified text, with subtitle-multiplexed menu
19
-# highlights (for DVD) or enumerated titles (for (S)VCD).
20
-#
21
-# Project homepage: http://tovid.wikia.com
22
-#
23
-# Copyright (C) 2005-2010
24
-#
25
-# This program is free software; you can redistribute it and/or
26
-# modify it under the terms of the GNU General Public License
27
-# as published by the Free Software Foundation; either
28
-# version 2 of the License, or (at your option) any later
29
-# version.
30
-#
31
-# This program is distributed in the hope that it will be useful,
32
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
33
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
-# GNU General Public License for more details.
35
-#
36
-# You should have received a copy of the GNU General Public License
37
-# along with this program; if not, write to the Free Software
38
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
39
-#
40
-# http://www.gnu.org/licenses/gpl.txt
41
-
42
-# Options to consider
43
-# font selection
44
-# font color, highlight color, selection color
45
-# font shadow, border
46
-# icons, graphic overlays
47
-# Support for full-motion video menus
48
-
49
-SCRIPT_NAME=`cat << EOF
50
---------------------------------
51
-tovid menu
52
-Generate DVD/(S)VCD menus
53
-Version $TOVID_VERSION
54
-$TOVID_HOME_PAGE
55
---------------------------------
56
-EOF`
57
-
58
-USAGE=`cat << EOF
59
-Usage: tovid menu [OPTIONS] "Title1" "Title2" ... -out {output prefix}
60
-
61
-Common options:
62
-
63
- -pal | -ntsc | -ntscfilm Set TV standard
64
- -dvd | -vcd | -svcd Encode to standard format
65
- -background IMAGE ex: -background star_field.png
66
- -audio AUDIOFILE ex: -audio foo_fighters.mp3
67
- -font "FONTNAME" ex: -font Courier
68
-
69
-Example:
70
-
71
- tovid menu -background ocean.jpg "First" "Second" "Third" -out mymenu
72
- Create 'mymenu.mpg' with three titles and a custom background image.
73
-
74
-See the tovid manual page ('man tovid') for additional documentation.
75
-
76
-EOF`
77
-
78
-# Defaults and function definitions
79
-
80
-# Print script name, usage notes, and optional error message, then exit.
81
-# Args: $@ == text string containing error message
82
-usage_error ()
83
-{
84
- printf "%s\n" "$USAGE"
85
- printf "%s\n" "$SEPARATOR"
86
- printf "*** %s\n" "$@"
87
- exit 1
88
-}
89
-
90
-# Clean up the temporary files
91
-function cleanup()
92
-{
93
- if $DEBUG; then
94
- echo "Leaving temporary files in $TMP_DIR"
95
- echo "Debugging log saved to $LOG_FILE"
96
- else
97
- echo "Cleaning up... "
98
- rm -rf "$TMP_DIR"
99
- fi
100
-}
101
-
102
-# Initializations
103
-
104
-# No background image or audio
105
-BG_IMAGE=""
106
-BG_AUDIO=""
107
-MENU_LENGTH=""
108
-# NTSC DVD
109
-TVSYS="ntsc"
110
-RES="dvd"
111
-# Use a safe area
112
-SAFE_AREA=:
113
-# Number of titles
114
-NUM_TITLES=0
115
-MAX_VCD_TITLES=9
116
-MAX_DVD_TITLES=36
117
-OVER_MAX_TITLES=false
118
-# Scale up and crop non-4:3 images by default
119
-SCALECROP="crop"
120
-# Colors for menu items (RGB)
121
-TEXT_COLOR="white"
122
-HIGHLIGHT_COLOR="yellow"
123
-SELECT_COLOR="red"
124
-# Default title font and point size
125
-TITLE_FONT="Helvetica"
126
-TITLE_SIZE="24"
127
-FONT_DECO="-stroke black -strokewidth 1"
128
-TEXT_ALIGN="northwest"
129
-# Default menu title settings
130
-MAKE_TITLE=false
131
-# Button char
132
-BUTTON_FONT=""
133
-BUTTON_CHAR=">"
134
-BTN_STROKE="none"
135
-# NTSC DVD
136
-SAMPRATE="48000"
137
-ASUF="ac3"
138
-VSUF="m2v"
139
-FPS="2997"
140
-MPEG2ENC_FMT="-f 8"
141
-MPLEX_OPTS="-V"
142
-MPEG2ENC_SYS="-F 4 -n n"
143
-# Figure out what version of ppmtoy4m is in use;
144
-# mjpegtools 1.6.2 seems to require 420_mpeg2
145
-if mplex 2>&1 | grep -q "version 1.6.2"; then
146
- CHROMA_MODE="420_mpeg2"
147
-else
148
- CHROMA_MODE="420mpeg2"
149
-fi
150
-IM_VERSION=$(convert -list configure | awk '/LIB_VERSION_NUMBER/ {print $2}')
151
-if test_version $IM_VERSION 6.3.5.7; then
152
- IM_LISTARG='font'
153
-else
154
- IM_LISTARG='type'
155
-fi
156
-# imagemagick's font listing structure depends on version
157
-if test_version $IM_VERSION 6.4.0.0; then
158
- im_field=2
159
-else
160
- im_field=1
161
-fi
162
-PPM_OPTS="-S $CHROMA_MODE -A 10:11 -F 30000:1001"
163
-# Direct stuff to /dev/null
164
-REDIR="/dev/null"
165
-# Not doing debugging
166
-DEBUG=false
167
-QUIET=false
168
-# Don't overwrite output files
169
-OVERWRITE=false
170
-OUT_PREFIX=""
171
-LOG_FILE="makemenu.log"
172
-NOASK=false
173
-# How far to space titles and buttons
174
-TITLE_BOTTOM_SPACE=12
175
-TITLE_LEFT_SPACE=10
176
-
177
-
178
-# =========================================================================\
179
-# E X E C U T I O N B E G I N S H E R E
180
-#
181
-#
182
-
183
-echo "$SCRIPT_NAME"
184
-
185
-assert_dep "$magick" "You are missing dependencies required for making menus!"
186
-
187
-# Process all options
188
-while test $# -gt 0; do
189
- case "$1" in
190
- "-ntsc" | "-ntscfilm" )
191
- TVSYS="ntsc"
192
- MPEG2ENC_SYS="-F 4 -n n"
193
- PPM_OPTS="-S $CHROMA_MODE -A 10:11 -F 30000:1001"
194
- FPS="2997"
195
- ;;
196
- "-pal" )
197
- TVSYS="pal"
198
- MPEG2ENC_SYS="-F 3 -n p"
199
- PPM_OPTS="-S $CHROMA_MODE -A 59:54 -F 25:1"
200
- FPS="2500"
201
tovid-0.34.tar.bz2/src/makevcd
Deleted
201
1
2
-#!/usr/bin/env bash
3
-ME="[makevcd]:"
4
-. tovid-init 2>/dev/null ||
5
-{ echo -e "===============================================================\n"
6
-echo -e "'tovid-init' not found. Was tovid improperly installed?"
7
-echo -e "Or are you trying to run the script directly?"
8
-echo -e "Please run makevcd as:\ntovid vcd OPTIONS"
9
-exit 1 ; }
10
-
11
-# makevcd
12
-# Part of the tovid suite
13
-# =======================
14
-# A bash script for creating a VCD cue/bin set and burning it
15
-# to a recordable CD.
16
-#
17
-# Project homepage: http://tovid.wikia.com
18
-#
19
-# Copyright (C) 2005-2010
20
-#
21
-# This program is free software; you can redistribute it and/or
22
-# modify it under the terms of the GNU General Public License
23
-# as published by the Free Software Foundation; either
24
-# version 2 of the License, or (at your option) any later
25
-# version.
26
-#
27
-# This program is distributed in the hope that it will be useful,
28
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
29
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30
-# GNU General Public License for more details.
31
-#
32
-# You should have received a copy of the GNU General Public License
33
-# along with this program; if not, write to the Free Software
34
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
35
-#
36
-# http://www.gnu.org/licenses/gpl.txt
37
-
38
-SCRIPTNAME=`cat << EOF
39
---------------------------------
40
-tovid vcd
41
-Create cue/bin files for a (S)VCD and burn them to a CD
42
-Version $TOVID_VERSION
43
-$TOVID_HOME_PAGE
44
---------------------------------
45
-EOF`
46
-
47
-USAGE=`cat << EOF
48
-Usage: tovid vcd [OPTIONS] {VCDIMAGER.xml}
49
-
50
-Where OPTIONS may be any of the following:
51
-
52
- -overwrite Overwrite existing cue/bin image
53
- -burn (default only make image)
54
- -device DEVICE (default /dev/cdrw)
55
- -speed NUM (default 12)
56
- -force Add --force to cdrdao command (needed for short slides)
57
-
58
-And:
59
-
60
- VCDIMAGER.xml is the name of a file containing a VCDImager XML
61
- description (For XML format, see http://www.vcdimager.org/).
62
- If you use(d) 'makexml' to create the XML file, you can use
63
- that as input here.
64
-
65
-See the tovid manual page ('man tovid') for additional documentation.
66
-
67
-EOF`
68
-
69
-SEPARATOR="=========================================="
70
-
71
-# Print script name, usage notes, and optional error message, then exit.
72
-# Args: $1 == text string containing error message
73
-usage_error ()
74
-{
75
- echo "$USAGE"
76
- echo $SEPARATOR
77
- echo "$@"
78
- exit 1
79
-}
80
-
81
-# Print out a runtime error specified as an argument, and exit
82
-runtime_error ()
83
-{
84
- killsubprocs
85
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
86
- echo "makevcd encountered an error during the VCD creation process:"
87
- echo $@
88
- echo "See if anything in the above output helps you diagnose the"
89
- echo "problem, and please file a bug report containing the above"
90
- echo "output to http://code.google.com/p/tovid/issues."
91
- echo "Sorry for the inconvenience!"
92
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
93
- exit 1
94
-}
95
-# Defaults
96
-QUIET=false
97
-IMAGE=:
98
-CDRW_DEVICE="/dev/cdrw"
99
-BURN_SPEED=12
100
-OVERWRITE=false
101
-BURN=false
102
-
103
-# ==========================================================
104
-# EXECUTION BEGINS HERE
105
-echo $"$SCRIPTNAME"
106
-
107
-assert_dep "$vcd" "You are missing dependencies required to image and burn (S)VCDs!"
108
-
109
-# check for valid CD burner. This may fail but at least we tried
110
-OIFS=$IFS \
111
-IFS=$'\n' device=($(find -L /dev -type b -name 'cdrw*' 2>/dev/null )) IFS=$OIFS
112
-CDRW_DEVICE=${device:-$CDRW_DEVICE}
113
-
114
-while test x"${1:0:1}" = "x-"; do
115
- case "$1" in
116
- "-quiet" ) QUIET=: ;;
117
- "-overwrite" )
118
- OVERWRITE=:
119
- ;;
120
- "-burn" )
121
- BURN=:
122
- ;;
123
- "-device" )
124
- shift
125
- CDRW_DEVICE="$1"
126
- ;;
127
- "-speed" )
128
- shift
129
- BURN_SPEED=$1
130
- ;;
131
- "-force" )
132
- FORCE="--force"
133
- ;;
134
- * )
135
- usage_error "Error: Unrecognized command-line option $1"
136
- ;;
137
- esac
138
-
139
- # Get next argument
140
- shift
141
-done
142
-
143
-if test $# -ne 1; then
144
- usage_error "Please provide the name of a VCDimager XML file \
145
-containing the (S)VCD description."
146
-else
147
- # XML input is last argument
148
- VCDIMAGER_XML="$1"
149
-fi
150
-
151
-# Look for earlier attempts to image this VCD
152
-for prev_try in "$VCDIMAGER_XML.cue" "$VCDIMAGER_XML.bin"; do
153
- if test -f "$prev_try"; then
154
- echo "Found a previous makevcd attempt: $prev_try!"
155
- if $OVERWRITE; then
156
- echo -n "Removing it... "
157
- rm -fv "$prev_try"
158
- elif $BURN; then
159
- echo "Will use this for burning the disc."
160
- IMAGE=false
161
- else
162
- echo "Use '-overwrite' to override and re-image; or"
163
- echo "use '-burn' to write this existing image."
164
- echo "Exiting..."
165
- exit 1
166
- fi
167
- fi
168
-done
169
-
170
-
171
-# Create the cue/bin image
172
-if $IMAGE; then
173
- # TODO: Warn if there isn't enough space to make cue/bin
174
- VCDIMAGER_CMD="vcdxbuild -c \"$VCDIMAGER_XML.cue\" -b \
175
- \"$VCDIMAGER_XML.bin\" \"$VCDIMAGER_XML\""
176
- echo $SEPARATOR
177
- echo "Creating cue/bin disc image with the following command:"
178
- echo $VCDIMAGER_CMD
179
- if eval $VCDIMAGER_CMD; then
180
- echo "Done."
181
- $QUIET || echo "Use 'tovid vcd -burn $VCDIMAGER_XML' to burn your VCD."
182
- $QUIET || echo "Thanks for using tovid!"
183
- else
184
- runtime_error "Imaging failed, please see vcdxbuild output above."
185
- fi
186
-fi
187
-
188
-# Burn the VCD
189
-if $BURN; then
190
- # Sanity check: Make sure given device is valid (somehow)
191
- # before creating the cue/bin. Give option to proceed anyway?
192
- # (i.e., could there be any point to proceeding?)
193
- # Here's a simple way: just quit
194
- if test -b $CDRW_DEVICE; then :
195
- else
196
- echo "Couldn't find $CDRW_DEVICE! Stopping here."
197
- exit 1
198
- fi
199
-
200
- # Remind user to insert a CD
201
tovid-0.34.tar.bz2/src/makexml
Deleted
201
1
2
-#!/usr/bin/env bash
3
-ME="[makexml]:"
4
-. tovid-init 2>/dev/null ||
5
-{ echo -e "===============================================================\n"
6
-echo -e "'tovid-init' not found. Was tovid improperly installed?"
7
-echo -e "Or are you trying to run the script directly?"
8
-echo -e "Please run makexml as:\ntovid xml OPTIONS"
9
-exit 1 ; }
10
-
11
-# makexml
12
-# Part of the tovid suite
13
-# =======================
14
-# This bash script generates XML output describing the structure of
15
-# a VCD, SVCD, or DVD disc. The resulting output can be given as input
16
-# to vcdxbuild or dvdauthor. Format, and a list of menus and
17
-# video files in MPEG format, are specified on the command-line, and
18
-# the resulting XML is written to the specified file. Currently
19
-# supports an optional top-level menu, any number of optional sub-menus,
20
-# and any number of videos reachable through those menus.
21
-#
22
-# Project homepage: http://tovid.wikia.com
23
-#
24
-# Copyright (C) 2005-2010
25
-#
26
-# This program is free software; you can redistribute it and/or
27
-# modify it under the terms of the GNU General Public License
28
-# as published by the Free Software Foundation; either
29
-# version 2 of the License, or (at your option) any later
30
-# version.
31
-#
32
-# This program is distributed in the hope that it will be useful,
33
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
34
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35
-# GNU General Public License for more details.
36
-#
37
-# You should have received a copy of the GNU General Public License
38
-# along with this program; if not, write to the Free Software
39
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
40
-#
41
-# http://www.gnu.org/licenses/gpl.txt
42
-
43
-SCRIPTNAME=`cat << EOF
44
---------------------------------
45
-tovid xml
46
-Generate XML for authoring a VCD, SVCD, or DVD.
47
-Version $TOVID_VERSION
48
-$TOVID_HOME_PAGE
49
---------------------------------
50
-EOF`
51
-
52
-USAGE=`cat << EOF
53
-Usage: tovid xml [OPTIONS] {video1.mpg video2.mpg ...} -out OUT_PREFIX
54
-
55
-Common OPTIONS:
56
-
57
- -dvd | -vcd | -svcd Specify the target disc format
58
- -overwrite Overwrite any existing output files
59
-
60
-Provide a list of .mpg video files, and they will be played back in
61
-sequence. You may organize several lists of videos into menus by
62
-providing the name of a menu .mpg:
63
-
64
- tovid xml -menu menu1.mpg \\\\
65
- video1.mpg video2.mpg video3.mpg \\\\
66
- -out mydisc
67
- tovid xml -topmenu topmenu.mpg \\\\
68
- -menu submenu1.mpg vid1.mpg vid2.mpg vid3.mpg \\\\
69
- -menu submenu2.mpg vid4.mpg vid5.mpg vid6.mpg \\\\
70
- -out mydisc2
71
-
72
-See the tovid manual page ('man tovid') for additional documentation.
73
-
74
-EOF`
75
-
76
-SEPARATOR="=========================================="
77
-
78
-# Print script name, usage notes, and optional error message, then exit.
79
-# Args: $1 == text string containing error message
80
-usage_error ()
81
-{
82
- echo "$USAGE"
83
- echo $SEPARATOR
84
- echo "$@"
85
- exit 1
86
-}
87
-
88
-QUIET=false
89
-# Currently-numbered titleset (must have at least 1 titleset)
90
-CUR_TS=1
91
-# Currently-numbered video title under a titleset menu (0 for no titles)
92
-CUR_TITLE=0
93
-# Do we have a top menu yet?
94
-HAVE_TOP_MENU=false
95
-# Do we have any menus yet?
96
-HAVE_MENU=false
97
-# Do not overwrite by default
98
-OVERWRITE=false
99
-# Use dvdauthor XML for DVD authoring
100
-XML_FORMAT="dvd"
101
-# No un-found files yet
102
-FILE_NOT_FOUND=false
103
-# Not doing still titles
104
-STILL_TITLES=false
105
-FIRST_TITLE=:
106
-# Avoid some unbound variables
107
-TOP_MENU_XML=""
108
-TOP_MENU_BUTTONS=""
109
-MENU_BUTTONS=""
110
-TS_TITLES=""
111
-ALL_MENU_XML=""
112
-SEGMENT_ITEMS_XML=""
113
-SEQUENCE_ITEMS_XML=""
114
-PBC_XML=""
115
-PLAYLIST_XML=""
116
-
117
-MAKE_GROUP=false
118
-MAKE_CHAPTERS=:
119
-FORCE_TITLESETS=false
120
-CUR_VIDEO=0
121
-CHAPTER_INTERVAL=5
122
-
123
-STANDARD=133
124
-WIDESCREEN=177
125
-NOPANSCAN=''
126
-TV_FORMAT=ntsc
127
-PAUSE=0
128
-
129
-# ==========================================================
130
-# Backslash-escape the given special character (and any EOLs)
131
-# Usage:
132
-# sedprep "$TEXT" /
133
-# echo $TEXT | sed "s/PATTERN/$(sedprep "$REPLACEMENT" /)/"
134
-function sedprep ()
135
-{
136
- delim=${2:-/}
137
- echo "$1" |sed -e 's/[\&'"$delim"']/\\&/g' -e '$!s,$,\\,';
138
-}
139
-
140
-# ==========================================================
141
-# Check for the existence of a file and print an error if it
142
-# does not exist in the current directory
143
-# Args: $1 = file to look for
144
-function checkExistence ()
145
-{
146
- if test -e "$1"; then :
147
- else
148
- echo "The file "$1" was not found. Exiting."
149
- FILE_NOT_FOUND=:
150
- exit 1
151
- fi
152
-}
153
-
154
-# ==========================================================
155
-# Find a video's aspect ratio and set dvd behavior accordingly
156
-# Args: $1 = video file to find aspect for
157
-# Usage: noPanScan foo.avi
158
-# Sets NOPANSCAN to either: widescreen="nopanscan"
159
-# or: <null>
160
-function noPanScan ()
161
-{
162
- ASPECT=$(idvid -fast -terse "$1" | grep "ASPECT" | awk -F '=' '{print $2}')
163
- $QUIET || echo -n " $1 has aspect $ASPECT "
164
- if test $ASPECT -eq $WIDESCREEN; then
165
- NOPANSCAN='widescreen="nopanscan"'
166
- $QUIET || echo "(widescreen)."
167
- else
168
- NOPANSCAN=''
169
- $QUIET || echo "(standard)."
170
- fi
171
-
172
-}
173
-
174
-function getFormat ()
175
-{
176
- # Set TV format - default is ntsc
177
- VID_INFO=$(tovid id -fast -terse "$1")
178
- grep -q PAL_DVD <<< "$VID_INFO" && TV_FORMAT=pal
179
-}
180
-
181
-# ==========================================================
182
-# Add a top-level VMGM menu to the DVD
183
-# Args: $1 = video file to use for top menu
184
-function addTopMenu ()
185
-{
186
- HAVE_TOP_MENU=:
187
- echo "Adding top-level menu using file: $1"
188
-
189
- # --------------------------
190
- # For DVD
191
- if test $XML_FORMAT = "dvd"; then
192
- # Set NOPANSCAN
193
- noPanScan "$1"
194
- # Generate XML for the top menu, with a placeholder for
195
- # the titleset menu buttons (to be replaced later by sed)
196
- TOP_MENU_XML=`cat << EOF
197
- <menus>
198
- <video $NOPANSCAN />
199
- <pgc entry="title">
200
- <vob file="$1" />
201
tovid-0.34.tar.bz2/src/postproc
Deleted
201
1
2
-#!/usr/bin/env bash
3
-ME="[postproc]:"
4
-. tovid-init 2>/dev/null ||
5
-{ echo -e "===============================================================\n"
6
-echo -e "'tovid-init' not found. Was tovid improperly installed?"
7
-echo -e "Or are you trying to run the script directly?"
8
-echo -e "Please run postproc as:\ntovid postproc OPTIONS"
9
-exit 1 ; }
10
-
11
-# postproc
12
-# Part of the tovid suite
13
-# =======================
14
-# A bash script for doing post-encoding processing on
15
-# MPEG video files. Can requantize (shrink) video and
16
-# adjust A/V sync.
17
-#
18
-# Project homepage: http://tovid.wikia.com
19
-#
20
-# Copyright (C) 2005-2010
21
-#
22
-# This program is free software; you can redistribute it and/or
23
-# modify it under the terms of the GNU General Public License
24
-# as published by the Free Software Foundation; either
25
-# version 2 of the License, or (at your option) any later
26
-# version.
27
-#
28
-# This program is distributed in the hope that it will be useful,
29
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
30
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
-# GNU General Public License for more details.
32
-#
33
-# You should have received a copy of the GNU General Public License
34
-# along with this program; if not, write to the Free Software
35
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
36
-#
37
-# http://www.gnu.org/licenses/gpl.txt
38
-
39
-SCRIPT_NAME=`cat << EOF
40
---------------------------------
41
-tovid postproc
42
-Post-process video files
43
-Version $TOVID_VERSION
44
-$TOVID_HOME_PAGE
45
---------------------------------
46
-EOF`
47
-
48
-USAGE=`cat << EOF
49
-Usage: tovid postproc [OPTIONS] {input file} {output file}
50
-
51
-Where OPTIONS may be any of the following:
52
-
53
- -audiodelay NUM Delay audio by NUM milliseconds
54
- -normalize Normalize the audio
55
- -amplitudeNUM[dB] Apply a gain of NUM (0 - 1.0, add dB for decibel gain)
56
- -shrink NUM Shrink video by factor NUM (1.0 - 2.0)
57
- -parallel Run all processes in parallel (can save time)
58
- -debug Keep a log of actions and output
59
-
60
-See the tovid manual page ('man tovid') for additional documentation.
61
-
62
-EOF`
63
-
64
-SEPARATOR="========================================================="
65
-
66
-# Default values
67
-TMP_FILE="postproc.fileinfo.$PPID"
68
-AUDIO_DELAY=""
69
-SHRINK_FACTOR=""
70
-DO_NORM=false
71
-AUDIO_AMPLITUDE=""
72
-DO_SHRINK=false
73
-MUX_OPTS=""
74
-DEBUG=false
75
-# File to use for saving postprocessing statistics
76
-STAT_DIR=$HOME/.tovid
77
-STAT_FILE="$STAT_DIR/stats.postproc"
78
-SHRINK_PERCENT="0"
79
-PARALLEL=false
80
-# Video format in use
81
-VIDEO_FORMAT="DVD"
82
-BACKGR=""
83
-
84
-# Print script name, usage notes, and optional error message, then exit.
85
-# Args: $1 == text string containing error message
86
-usage_error ()
87
-{
88
- echo "$USAGE"
89
- echo "$SEPARATOR"
90
- echo "$@"
91
- exit 1
92
-}
93
-
94
-# Remove temporary files
95
-cleanup ()
96
-{
97
- echo "Cleaning up..."
98
- rm -fv video_shrink video_dump audio_dump normed_audio
99
-
100
-}
101
-
102
-
103
-# ***********************************
104
-# EXECUTION BEGINS HERE
105
-# ***********************************
106
-
107
-echo "$SCRIPT_NAME"
108
-
109
-# Make sure there are at least two arguments (infile and outfile)
110
-if test $# -lt 2; then
111
- usage_error "Error: Please provide an input filename and an output filename."
112
-fi
113
-
114
-while test ${1:0:1} = "-"; do
115
- case "$1" in
116
- "-audiodelay" )
117
- shift
118
- AUDIO_DELAY="-O ${1}ms"
119
- ;;
120
- "-shrink" )
121
- shift
122
- DO_SHRINK=:
123
- SHRINK_FACTOR="$1"
124
- assert_dep "$transcode" "You are missing dependencies required for shrinking video!"
125
- ;;
126
- "-parallel" )
127
- PARALLEL=:
128
- cleanup
129
- mkfifo video_dump
130
- mkfifo audio_dump
131
- mkfifo video_shrink
132
- BACKGR="&"
133
- ;;
134
- "-normalize" )
135
- DO_NORM=:
136
- ;;
137
- "-amplitude" )
138
- shift
139
- AUDIO_AMPLITUDE="--amplitude=$1"
140
- DO_NORM=:
141
- ;;
142
- "-debug" )
143
- DEBUG=:
144
- ;;
145
- esac
146
-
147
- # Get next argument
148
- shift
149
-done
150
-
151
-
152
-IN_FILE="$1"
153
-shift
154
-OUT_FILE="$1"
155
-
156
-echo $SEPARATOR
157
-
158
-$DO_NORM && assert_dep "sox" "You are missing dependancies necessarily for processing audio wav's"
159
-if $DO_NORM && $PARALLEL; then
160
- echo "Cannot normalize audio in parallel mode! Turning off -parallel."
161
- PARALLEL=false
162
- cleanup
163
-fi
164
-
165
-# Figure out what format it is. 44.1khz audio can be VCD or SVCD,
166
-# 48khz audio is DVD.
167
-echo "Gathering file information. This may take a while."
168
-if eval $(idvid -terse "$IN_FILE"); then :; else
169
- echo "Could not identify source video: $IN_FILE"
170
- exit 1
171
-fi
172
-video_format=$(tr A-Z a-z <<< $ID_VIDEO_FORMAT)video
173
-
174
-if test $ID_AUDIO_RATE -eq "48000"; then
175
- MUX_OPTS="-V -f 8"
176
- VIDEO_FORMAT="DVD"
177
-elif test $ID_AUDIO_RATE -eq "44100"; then
178
- # VCD is 352 wide, SVCD is 480 wide
179
- if test $ID_VIDEO_WIDTH -eq "352"; then
180
- MUX_OPTS="-f 1"
181
- VIDEO_FORMAT="VCD"
182
- elif test $ID_VIDEO_WIDTH -eq "480"; then
183
- MUX_OPTS="-V -f 4"
184
- VIDEO_FORMAT="SVCD"
185
- fi
186
-fi
187
-
188
-echo "Dumping audio and video streams with the following commands:"
189
-
190
-# Dump audio and video
191
-if $DO_NORM; then
192
- AUDIO_DUMP="ffmpeg -i \"$IN_FILE\" -vn -f wav -y audio_dump"
193
-else
194
- #AUDIO_DUMP="mplayer \"$IN_FILE\" -quiet -dumpaudio -dumpfile audio_dump"
195
- AUDIO_DUMP="ffmpeg -i \"$IN_FILE\" -vn -f $ID_AUDIO_CODEC -acodec copy -y audio_dump"
196
-fi
197
-VIDEO_DUMP="ffmpeg -i \"$IN_FILE\" -an -f $video_format -vcodec copy -y video_dump"
198
-VID_STREAM="video_dump"
199
-
200
-echo "$AUDIO_DUMP"
201
tovid-0.34.tar.bz2/src/tovid-batch
Deleted
98
1
2
-#!/usr/bin/env bash
3
-ME="[tovid-batch]:"
4
-. tovid-init 2>/dev/null ||
5
-{ echo -e "===============================================================\n"
6
-echo -e "'tovid-init' not found. Was tovid improperly installed?"
7
-echo -e "Or are you trying to run the script directly?"
8
-echo -e "Please run tovid-batch as:\ntovid batch OPTIONS"
9
-exit 1 ; }
10
-
11
-# tovid-batch
12
-# Part of the tovid suite
13
-# =======================
14
-# A bash script for batch video conversion.
15
-#
16
-# Project homepage: http://tovid.wikia.com
17
-#
18
-# Copyright (C) 2005-2010
19
-#
20
-# This program is free software; you can redistribute it and/or
21
-# modify it under the terms of the GNU General Public License
22
-# as published by the Free Software Foundation; either
23
-# version 2 of the License, or (at your option) any later
24
-# version.
25
-#
26
-# This program is distributed in the hope that it will be useful,
27
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
28
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
-# GNU General Public License for more details.
30
-#
31
-# You should have received a copy of the GNU General Public License
32
-# along with this program; if not, write to the Free Software
33
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
34
-#
35
-# http://www.gnu.org/licenses/gpl.txt
36
-
37
-SCRIPT_NAME=`cat << EOF
38
---------------------------------
39
-tovid-batch
40
-A batch conversion script using tovid
41
-Part of the tovid suite, version $TOVID_VERSION
42
-$TOVID_HOME_PAGE
43
---------------------------------
44
-EOF`
45
-
46
-USAGE=`cat << EOF
47
-Usage: tovid batch [OPTIONS] -infiles <input files>
48
-
49
-OPTIONS may be any options that tovid accepts. See 'man tovid'.
50
-
51
-EOF`
52
-
53
-SEPARATOR="=============================================================================="
54
-
55
-# No tovid arguments to start with
56
-TOVID_ARGS=""
57
-
58
-# ***********************************
59
-# EXECUTION BEGINS HERE
60
-# ***********************************
61
-
62
-precho "$SCRIPT_NAME"
63
-
64
-# Get all arguments up to -infiles
65
-while test $# -gt 0; do
66
- if test "$1" = "-infiles"; then
67
- shift
68
- break
69
- else
70
- TOVID_ARGS="$TOVID_ARGS $1"
71
- fi
72
-
73
- # Get next argument
74
- shift
75
-done
76
-
77
-# If no infiles, print usage notes
78
-if test $# -le 0; then
79
- precho "$USAGE"
80
- echo "$SEPARATOR"
81
- echo "Please provide a list of files to encode using -infiles"
82
- exit 1
83
-fi
84
-
85
-# For every input filename provided, run tovid with the given options
86
-for FILE in "$@"; do
87
- echo $SEPARATOR
88
- if test -e "$FILE"; then
89
- EXT=$(echo "$FILE" | awk -F '.' '{ print $NF }')
90
- FILENAME=$(basename "$FILE" ."$EXT")
91
- TOVID_CMD="tovid mpg -noask $TOVID_ARGS -in \"$FILE\" -out \"$FILENAME.tovid_encoded\""
92
- precho $TOVID_CMD
93
- eval $TOVID_CMD
94
- else
95
- echo "Couldn't find file \"$FILE\", not encoding it."
96
- fi
97
-done
98
tovid-0.34.tar.bz2/src/tovid-interactive
Deleted
183
1
2
-#!/usr/bin/env bash
3
-ME="[tovid-interactive]:"
4
-. tovid-init 2>/dev/null ||
5
-{ echo -e "===============================================================\n"
6
-echo -e "'tovid-init' not found. Was tovid improperly installed?"
7
-echo -e "Or are you trying to run the script directly?"
8
-echo -e "Please run tovid-interactive as:\ntovid interactive OPTIONS"
9
-exit 1 ; }
10
-
11
-# tovid-interactive
12
-# Part of the tovid suite
13
-# =======================
14
-# A bash script with an interactive frontend to the tovid
15
-# script. This script prompts the user for all options, and
16
-# then runs the tovid script with the selected options.
17
-#
18
-# Project homepage: http://tovid.wikia.com
19
-#
20
-# Copyright (C) 2005-2010
21
-#
22
-# This program is free software; you can redistribute it and/or
23
-# modify it under the terms of the GNU General Public License
24
-# as published by the Free Software Foundation; either
25
-# version 2 of the License, or (at your option) any later
26
-# version.
27
-#
28
-# This program is distributed in the hope that it will be useful,
29
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
30
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31
-# GNU General Public License for more details.
32
-#
33
-# You should have received a copy of the GNU General Public License
34
-# along with this program; if not, write to the Free Software
35
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
36
-#
37
-# http://www.gnu.org/licenses/gpl.txt
38
-
39
-WELCOME=`cat << EOF
40
---------------------------------
41
-tovid-interactive
42
-Interactive CLI front-end to tovid
43
-Part of the tovid suite, version $TOVID_VERSION
44
-$TOVID_HOME_PAGE
45
---------------------------------
46
-
47
-Welcome to the tovid-interactive script. This script is an interactive front-end for the tovid video conversion script. I will ask you several questions about the video you want to encode, and then run the tovid script with the options you choose.
48
-
49
-EOF`
50
-
51
-SEPARATOR="==============================================================================="
52
-
53
-precho $"$WELCOME"
54
-echo $SEPARATOR
55
-
56
-# Make sure tovid is in the path
57
-if ! test -x $(which tovid); then
58
- precho "Oops! I can't find tovid in your path. Before you use this script, please install the tovid suite by running the 'configure' script from the directory where you unzipped tovid."
59
- exit 1
60
-fi
61
-
62
-# 7 Get the file to encode
63
-echo "Step 1 of 7:"
64
-if test $# -eq 1; then
65
- INFILE="$1"
66
- echo "Encoding the filename provided on the command-line:"
67
- echo "$1"
68
- echo $SEPARATOR
69
-else
70
- INFILE=""
71
- if test $# -gt 1; then
72
- echo "I found more than one command line paramter! Please give only one"
73
- echo "video to encode. You gave me $#:"
74
- echo "$@"
75
- fi
76
- precho "What video file do you want to encode? Please use the full path name if the file is not in the current directory. Hint: if you don't know the full name of the file, you can press [control]-C now, and run tovid-interactive followed by the name of the file."
77
- while ! test -e "$INFILE"; do
78
- echo -n "filename: "
79
- read INFILE
80
- if ! test -e "$INFILE"; then
81
- echo "Cannot find \"$INFILE\"! Please try again."
82
- fi
83
- done
84
- echo $SEPARATOR
85
-fi
86
-
87
-# 6 Ask for format
88
-echo "Step 2 of 7:"
89
-echo "You can encode this video to one of the following formats:"
90
-echo "For burning onto DVD:"
91
-echo " dvd DVD format 720x480 NTSC, 720x576 PAL"
92
-echo " half-dvd Half-DVD format 352x480 NTSC, 352x576 PAL"
93
-echo " dvd-vcd VCD-on-DVD format 352x240 NTSC, 352x288 PAL"
94
-echo "For burning onto CD:"
95
-echo " vcd Video CD format 352x240 NTSC, 352x288 PAL"
96
-echo " svcd Super Video CD format 480x480 NTSC, 480x576 PAL"
97
-
98
-VIDFORMAT="none"
99
-until $(verify $VIDFORMAT set "dvd half-dvd dvd-vcd vcd svcd")
100
-do
101
- echo "Please enter one of the formats listed (dvd, half-dvd, dvd-vcd, vcd, svcd)."
102
- echo -n "format: "
103
- read VIDFORMAT
104
-done
105
- echo $SEPARATOR
106
-
107
-# 5 Ask for NTSC or PAL
108
-echo "Step 3 of 7:"
109
-precho "Do you want the video to be NTSC or PAL? If you live in the Americas or Japan, you probably want NTSC; if you live in Europe, Australia, or New Zealand, you probably want PAL."
110
-
111
-TVSYS="none"
112
-until $(verify $TVSYS set "ntsc pal")
113
-do
114
- echo "Please use lowercase (ntsc, pal)."
115
- echo -n "ntsc or pal: "
116
- read TVSYS
117
-done
118
-echo $SEPARATOR
119
-
120
-# 4 Ask for aspect ratio
121
-echo "Step 4 of 7:"
122
-echo "You can encode to three different screen formats:"
123
-echo " full If your video is full-screen (4:3 aspect ratio)"
124
-echo " wide If your video is wide-screen (16:9 aspect ratio)"
125
-echo " panavision If your video is theatrical wide-screen (2.35:1 aspect ratio)"
126
-precho "If you choose wide or panavision, the video will be 'letterboxed' to fit a standard TV screen. Most TV programs are 'full'; many movies are 'wide', and some movies are 'panavision' (if they look very wide and skinny)."
127
-
128
-ASPECT="none"
129
-until $(verify $ASPECT set "full wide panavision")
130
-do
131
-echo "Please enter one of the screen formats listed (full, wide, panavision)."
132
-echo -n "screen format: "
133
-read ASPECT
134
-done
135
-echo $SEPARATOR
136
-
137
-# 3 Normalize audio?
138
-echo "Step 5 of 7:"
139
-precho "In some videos, the volume may be too quiet or too loud. You can fix this by normalizing the audio."
140
-
141
-NORMALIZE="none"
142
-until $(verify $NORMALIZE set "n N y Y yes Yes")
143
-do
144
-echo -n "normalize audio (default yes) [y/n]? "
145
-read NORMALIZE
146
-done
147
-if test "x$NORMALIZE" = "xn" || test "x$NORMALIZE" = "xN"; then
148
- NORMALIZE=""
149
-else
150
- NORMALIZE="-normalize"
151
-fi
152
-echo $SEPARATOR
153
-
154
-# 2 Any custom options?
155
-echo "Step 6 of 7:"
156
-precho "Would you like to pass other options to tovid? (see man tovid for more) Add any other options you want as if you were calling tovid. For example, if you wanted to add subtitles, you would type '-subtitles <file>'. Type [enter] for no custom options."
157
-echo -n "custom tovid options: "
158
-read CUSTOM_OPTIONS
159
-echo $SEPARATOR
160
-
161
-# 1 Get output prefix
162
-echo "Step 7 of 7:"
163
-precho "You are almost ready to encode your video. All I need now is the name you want to use for the output file. You don't need to give a filename extension (like .mpg); just type a name like 'MyVideo1'."
164
-echo -n "output name: "
165
-read OUT_PREFIX
166
-echo $SEPARATOR
167
-
168
-# Print last message and call tovid
169
-echo "Great! I will now start tovid with the options you chose. Here is the"
170
-echo "command that will be executed:"
171
-TOVID_CMD="tovid $NORMALIZE -$VIDFORMAT -$TVSYS -$ASPECT $CUSTOM_OPTIONS -in \"$INFILE\" -out \"$OUT_PREFIX\""
172
-echo $SEPARATOR
173
-precho "$TOVID_CMD"
174
-echo $SEPARATOR
175
-echo "Starting tovid in 5 seconds..."
176
-for COUNTER in 5 4 3 2 1; do
177
- sleep 1s
178
- echo -n "$COUNTER "
179
-done
180
-echo "Here goes!"
181
-eval $TOVID_CMD
182
-exit 0
183
tovid-0.34.tar.bz2/INSTALL -> tovid-0.35.tar.gz/INSTALL
Changed
32
1
2
3
This file contains configuration and installation instructions for tovid.
4
5
-!!!!
6
-NOTE: Prior releases of tovid used autoconf and automake, but these will
7
-be discontinued in a future release. As of tovid-0.33, setup.py is the
8
-recommended installation method.
9
-!!!!
10
-
11
-
12
=====================================================
13
INSTALLING FROM DISTRIBUTED SOURCE (*.tar.gz)
14
=====================================================
15
16
or
17
$ sudo ./setup.py install
18
19
+If you want to install to somewhere other than /usr/local, you can use:
20
+ $ su -c './setup.py install --prefix=/opt' for example.
21
+Note: with some versions of python's distutils this will by default install
22
+modules to .../site-packages rather than .../dist-packages even if that is
23
+where your system's python looks for them. See:
24
+https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570
25
+As a workaround, if you are using --prefix you can add:
26
+ --install-layout=deb .
27
+
28
+
29
If you want to uninstall tovid, do this:
30
31
$ su -c './setup.py uninstall'
32
tovid-0.34.tar.bz2/PKG-INFO -> tovid-0.35.tar.gz/PKG-INFO
Changed
9
1
2
Metadata-Version: 1.0
3
Name: tovid
4
-Version: 0.34
5
+Version: 0.35
6
Summary: UNKNOWN
7
Home-page: http://tovid.wikia.com/
8
Author: Eric Pierce
9
tovid-0.34.tar.bz2/docs/man/tovid.1 -> tovid-0.35.tar.gz/docs/man/tovid.1
Changed
201
1
2
.TH "tovid manual" 1 "" ""
3
4
+
5
.SH Name
6
+
7
.P
8
tovid: Make DVDs from video files
9
10
.SH Description
11
+
12
.P
13
\fBtovid\fR is a command\-line tool for creating DVDs. It can encode your video
14
files to DVD\-compliant MPEG format, generate simple or complex DVD menus,
15
16
graphical interface is also provided to make the process even easier.
17
18
.P
19
-\fBNOTE\fR: As of tovid 0.32, this is the only manual page provided by tovid.
20
-There is now a single executable frontend to all functionality in the suite, so
21
-if you were expecting to find manpages for \fBtodisc\fR, \fBidvid\fR, \fBmakemenu\fR
22
-and their kin, they can all be found in the \fBtovid\fR manpage you are reading now.
23
+\fBNOTE\fR: As of tovid 0.35, the legacy scripts \fBmakemenu\fR and \fBmakexml\fR
24
+have been removed and no longer appear in this manpage.
25
+All of their functions and more can be done with the 'tovid disc' command,
26
+(todisc script). See \fBCommand:disc\fR and the wiki (http://tovid.wikia.com)
27
+for more info.
28
29
.P
30
+Also note that as of tovid 0.32, this is the only manual page provided by tovid.
31
+There is now a single executable frontend to all functionality in the suite, so
32
+if you were expecting to find manpages for \fBtodisc\fR, \fBidvid\fR, \fBmakempg\fR
33
+and their kin, they can all be found in the \fBtovid\fR manpage you are reading now.
34
And yes, this makes for a pretty large manual page. If you are viewing this
35
manpage from the command\-line \fBman\fR utility, which normally pages through the
36
\fBless\fR utility, you can skip to a section by searching with the \fB/\fR key,
37
38
to navigate.
39
40
.SH Usage
41
+
42
.P
43
\fBtovid\fR \fICOMMAND\fR [\fIOPTIONS\fR]
44
45
.P
46
Where \fICOMMAND\fR is one of the following:
47
48
+.P
49
+ Main Commands
50
+
51
+.TP
52
+\fBdisc\fR
53
+Encode, make menus, author, burn. (was \fBtodisc\fR. See \fBCommand:disc\fR)
54
.TP
55
\fBgui\fR
56
Start the tovid GUI (was \fBtodiscgui\fR. See \fBCommand:gui\fR)
57
.TP
58
\fBtitlesets\fR
59
-A tovid GUI wizard for multiple titlesets. (new: See \fBCommand:titlesets\fR)
60
-.TP
61
-\fBdisc\fR
62
-Create a DVD with menus (was \fBtodisc\fR. See \fBCommand:disc\fR)
63
+A GUI wizard for multiple titlesets. (new: See \fBCommand:titlesets\fR)
64
+
65
+.P
66
+ Helper Commands
67
+
68
.TP
69
\fBmpg\fR
70
Encode videos to MPEG format (was \fBtovid\fR. See \fBCommand:mpg\fR)
71
.TP
72
-\fBid\fR
73
-Identify one or more video files (was \fBidvid\fR. See \fBCommand:id\fR)
74
-.TP
75
-\fBmenu\fR
76
-Create an MPEG menu (was \fBmakemenu\fR. See \fBCommand:menu\fR)
77
-.TP
78
-\fBxml\fR
79
-Create (S)VCD or DVD .xml file (was \fBmakexml\fR. See \fBCommand:xml\fR)
80
-.TP
81
\fBdvd\fR
82
Author and/or burn a DVD (was \fBmakedvd\fR. See \fBCommand:dvd\fR)
83
.TP
84
-\fBvcd\fR
85
-Author and/or burn a VCD (was \fBmakevcd\fR. See \fBCommand:vcd\fR)
86
-.TP
87
-\fBpostproc\fR
88
-Post\-process an MPEG video file (was \fBpostproc\fR. See \fBCommand:postproc\fR)
89
+\fBid\fR
90
+Identify one or more video files (was \fBidvid\fR. See \fBCommand:id\fR)
91
.TP
92
\fBchapters\fR
93
A GUI using mplayer for setting chapter points. It will return a string of
94
-chapter points in a format recognized by 'tovid disc' (todisc) or
95
-by 'tovid gui', for the \fB\-chapters\fR option.
96
+chapter points to the terminal, in a format recognized by 'tovid disc'
97
+(todisc) or by 'tovid gui', for the \fB\-chapters\fR option.
98
99
.P
100
The \fIOPTIONS\fR differ for each command; run \fBtovid <command>\fR with no
101
further arguments to get help on a command, and what options it expects.
102
103
.SH Configuration
104
+
105
.P
106
Two configuration files are created the first time you run tovid:
107
108
.TP
109
\fB~/.tovid/preferences\fR
110
Defines working directory for all scripts.
111
-In addition you can define the output directory for makempg here.
112
+You can define the output directory for makempg here.
113
+The 'ffmpeg' executable can be set here: ffmpeg or avconv (TOVID_FFMPEG)
114
.TP
115
\fB~/.tovid/tovid.ini\fR
116
Includes command\-line options that should be passed to the various
117
-\fBtovid\fR sub\-commands.
118
+\fBtovid\fR sub\-commands. Note: each sub\-command has its own section,
119
+starting with the line [sub\-command], for example:
120
+.nf
121
+ [disc]
122
+ ; -no-warn
123
+ -static
124
+ -no-ask
125
+.fi
126
+
127
128
+
129
+.P
130
Edit these files if you wish to change your configuration.
131
132
+.P
133
The following environment variables are also honoured:
134
-TOVID_WORKING_DIR (working directory for all scripts).
135
-TOVID_OUTPUT_DIR (output directory for the makempg script).
136
+
137
+.nf
138
+ TOVID_HOME (directory containing preferences: ~/.tovid)
139
+ TOVID_WORKING_DIR (working directory for all scripts).
140
+ TOVID_OUTPUT_DIR (output directory for the makempg script).
141
+ TOVID_FFMPEG_CMD (the 'ffmpeg' executable to use: ffmpeg or avconv)
142
+.fi
143
+
144
+
145
+.P
146
+These will override 'TOVID_HOME', 'WORKING_DIR', 'OUTPUT_DIR',
147
+and 'TOVID_FFMPEG' if set in ~/.tovid/preferences.
148
149
.SH Command:gui
150
+
151
+.SH Usage
152
+
153
+.P
154
+\fBtovid gui\fR [\fIOPTIONS\fR]
155
+
156
.P
157
\fBtovid gui\fR starts the graphical user interface (GUI) for tovid. This is
158
-the easiest way to start creating DVDs with tovid. At this time, there are no
159
-additional command\-line options; the GUI controls take care of everything,
160
-and all help is integrated in the form of tooltips. You can also see
161
-**Command:disc ** for more detail about the options. Note: if you wish to
162
-make multiple titlesets on the same DVD use 'tovid titlesets', which is a wizard
163
-that uses the the tovid GUI. Chapter submenus can be made with 'tovid gui'
164
-however.
165
+the easiest way to start creating DVDs with tovid. The optional arguments
166
+\fIOPTIONS\fR are any option used by todisc ('tovid disc') which will save
167
+entering it manually, OR the full path to a saved script from the GUI.
168
+You can also combine these, but the script must be the FIRST option
169
+directly after \fBtovid gui\fR . (This option to save the contents of your
170
+project allows you to use it as a bash script later, or to reload the
171
+project to continue working with it at another time.)
172
+
173
+.P
174
+\fBtovid gui\fR will also take the option \fB\-\-position\fR, which denotes the
175
+screen position that the GUI will start at, in the form '+X+Y', similar to
176
+this part of the Xorg \-geometry string.
177
+
178
+.P
179
+All help is integrated in the form of tooltips. You can also see
180
+**Command:disc ** for more detail about the options. Note: if you wish to use
181
+a GUI to make multiple titlesets on the same DVD use \fB*tovid titlesets*\fR,
182
+which is a wizard that uses the the 'tovid gui. See \fB*Command:titlesets*\fR.
183
+
184
+.P
185
+Please note that although the interface may seem complex with so many options,
186
+you can create a fully functional DVD with only a few options on the opening
187
+tab of the GUI (select video files and an output name).
188
189
.SH Command:titlesets
190
+
191
.P
192
\fBtovid titlesets\fR will assist in making a DVD with multiple titlesets. It can
193
be started without any options, or you can feed it the path to a saved titleset
194
-script as an option.
195
+script as an option. The option to save a script is also useful as the resulting
196
+script can be run later from a terminal.
197
198
.SH Command:disc
199
+
200
.P
201
tovid-0.34.tar.bz2/docs/sphinx/conf.py -> tovid-0.35.tar.gz/docs/sphinx/conf.py
Changed
13
1
2
# built documents.
3
#
4
# The short X.Y version.
5
-version = '0.33'
6
+version = '0.34'
7
# The full version, including alpha/beta/rc tags.
8
-release = '0.33'
9
+release = '0.34'
10
11
# The language for content autogenerated by Sphinx. Refer to documentation
12
# for a list of supported languages.
13
tovid-0.34.tar.bz2/docs/sphinx/man/tovid.rst -> tovid-0.35.tar.gz/docs/sphinx/man/tovid.rst
Changed
201
1
2
-===============================================================
3
-tovid manual
4
-===============================================================
5
+Name
6
+====
7
8
+tovid: Make DVDs from video files
9
10
Description
11
-===============================================================================
12
+===========
13
+
14
+**tovid** is a command-line tool for creating DVDs. It can encode your
15
+video files to DVD-compliant MPEG format, generate simple or complex DVD
16
+menus, author and burn a ready-to-watch DVD, with just a few shell
17
+commands. A graphical interface is also provided to make the process
18
+even easier.
19
+
20
+**NOTE**: As of tovid 0.35, the legacy scripts **makemenu**,
21
+**makexml**, **makevcd** have been deprecated and no longer appear in
22
+this manpage. They are still included with tovid for now, and can be
23
+used by doing: tovid menu|xml|vcd|postproc
24
+as done in the previous 3 versions of tovid.
25
+
26
+Also note that as of tovid 0.32, this is the only manual page provided
27
+by tovid. There is now a single executable frontend to all functionality
28
+in the suite, so if you were expecting to find manpages for **todisc**,
29
+**idvid**, **makempg** and their kin, they can all be found in the
30
+**tovid** manpage you are reading now.
31
+
32
+And yes, this makes for a pretty large manual page. If you are viewing
33
+this manpage from the command-line **man** utility, which normally pages
34
+through the **less** utility, you can skip to a section by searching
35
+with the **/** key, followed by a **^** to match the given section name.
36
+For example, to skip to the **mpg** command, type **/^Command:mpg**. See
37
+**man less** for more on how to navigate.
38
39
-**tovid** is a command-line tool for creating DVDs. It can encode your video
40
-files to DVD-compliant MPEG format, generate simple or complex DVD menus,
41
-author and burn a ready-to-watch DVD, with just a few shell commands. A
42
-graphical interface is also provided to make the process even easier.
43
+Usage
44
+=====
45
46
-**NOTE**: As of tovid 0.32, this is the only manual page provided by tovid.
47
-There is now a single executable frontend to all functionality in the suite, so
48
-if you were expecting to find manpages for **todisc**, **idvid**, **makemenu**
49
-and their kin, they can all be found in the **tovid** manpage you are reading now.
50
+**tovid** *COMMAND* [*OPTIONS*]
51
52
-And yes, this makes for a pretty large manual page. If you are viewing this
53
-manpage from the command-line **man** utility, which normally pages through the
54
-**less** utility, you can skip to a section by searching with the **/** key,
55
-followed by a **^** to match the given section name. For example, to skip to
56
-the **mpg** command, type **/^Command:mpg**. See :manpage:`less(1)` for more on how
57
-to navigate.
58
+Where *COMMAND* is one of the following:
59
60
-Usage
61
-===============================================================================
62
+Main Commands
63
64
-::
65
+**disc**
66
+ Encode, make menus, author, burn. (was **todisc**. See
67
+ **Command:disc**)
68
69
- tovid COMMAND [OPTIONS]
70
+**gui**
71
+ Start the tovid GUI (was **todiscgui**. See **Command:gui**)
72
73
-Where *COMMAND* is one of the following:
74
+**titlesets**
75
+ A GUI wizard for multiple titlesets. (new: See
76
+ **Command:titlesets**)
77
78
- gui
79
- Start the tovid GUI (was **todiscgui**. See :ref:`command-gui`)
80
- disc
81
- Create a DVD with menus (was **todisc**. See :ref:`command-disc`)
82
- mpg
83
- Encode videos to MPEG format (was **tovid**. See :ref:`command-mpg`)
84
- id
85
- Identify one or more video files (was **idvid**. See :ref:`command-id`)
86
- menu
87
- Create an MPEG menu (was **makemenu**. See :ref:`command-menu`)
88
- xml
89
- Create (S)VCD or DVD .xml file (was **makexml**. See :ref:`command-xml`)
90
- dvd
91
- Author and/or burn a DVD (was **makedvd**. See :ref:`command-dvd`)
92
- vcd
93
- Author and/or burn a VCD (was **makevcd**. See :ref:`command-vcd`)
94
- postproc
95
- Post-process an MPEG video file (was **postproc**. See :ref:`command-postproc`)
96
-
97
-The *OPTIONS* differ for each command; run **tovid <command>** with no
98
-further arguments to get help on a command, and what options it expects.
99
+Helper Commands
100
101
-Configuration
102
-===============================================================================
103
+**mpg**
104
+ Encode videos to MPEG format (was **tovid**. See **Command:mpg**)
105
106
-Two configuration files are created the first time you run tovid:
107
+**dvd**
108
+ Author and/or burn a DVD (was **makedvd**. See **Command:dvd**)
109
110
-``~/.tovid/preferences``
111
- Defines working directory for all scripts.
112
- In addition you can define the output directory for makempg here.
113
-``~/.tovid/tovid.config``
114
- Includes command-line options that should always be passed to
115
- makempg.
116
+**id**
117
+ Identify one or more video files (was **idvid**. See **Command:id**)
118
119
- Edit these files if you wish to change your configuration.
120
+**chapters**
121
+ A GUI using mplayer for setting chapter points. It will return a
122
+ string of chapter points to the terminal, in a format recognized by
123
+ ’tovid disc’ (todisc) or by ’tovid gui’, for the **-chapters**
124
+ option.
125
126
-The following environment variables are also honoured:
127
+The *OPTIONS* differ for each command; run **tovid
128
+<command>** with no further arguments to get help on
129
+a command, and what options it expects.
130
131
-``TOVID_WORKING_DIR``
132
- working directory for all scripts
133
-``TOVID_OUTPUT_DIR``
134
- output directory for the makempg script
135
+Configuration
136
+=============
137
138
+Two configuration files are created the first time you run tovid:
139
140
-.. _command-gui:
141
+**~{**/.tovid/preferences}
142
+ Defines working directory for all scripts. In addition you can
143
+ define the output directory for makempg here.
144
145
-Command:gui
146
-===============================================================================
147
+**~{**/.tovid/tovid.ini}
148
+ Includes command-line options that should be passed to the various
149
+ **tovid** sub-commands.
150
151
-**tovid gui** starts the graphical user interface (GUI) for tovid. This is
152
-the easiest way to start creating DVDs with tovid. At this time, there are no
153
-additional command-line options; the GUI controls take care of everything,
154
-and all help is integrated in the form of tooltips. You can also see
155
-:ref:`command-disc` for more detail about the options. Note: one limitation of
156
-the gui at present is that it does not do multiple titlesets (though it will do
157
-chapter menus). Use the **tovid disc** command (below) for titlesets.
158
+ Edit these files if you wish to change your configuration.
159
160
+ The following environment variables are also honoured:
161
+ TOVID\_WORKING\_DIR (working directory for all scripts).
162
+ TOVID\_OUTPUT\_DIR (output directory for the makempg script).
163
164
-.. _command-disc:
165
+Command:gui
166
+===========
167
+
168
+**tovid gui** starts the graphical user interface (GUI) for tovid. This
169
+is the easiest way to start creating DVDs with tovid. The optional
170
+arguments are any option used by todisc (’tovid disc’) which will save
171
+entering it manually, OR the full path to a saved script from the GUI.
172
+This option to save the contents of your project allows you to use it as
173
+a bash script later, or to reload the project to continue working with
174
+it at another time. Note: this feature is still in development so some
175
+options may not load properly - make sure to check that your selections
176
+were all loaded.
177
+
178
+All help is integrated in the form of tooltips. You can also see
179
+\*\*Command:disc \*\* for more detail about the options. Note: if you
180
+wish to use a GUI to make multiple titlesets on the same DVD use ’tovid
181
+titlesets’, which is a wizard that uses the the ’tovid gui.
182
+
183
+Command:titlesets
184
+=================
185
+
186
+**tovid titlesets** will assist in making a DVD with multiple titlesets.
187
+It can be started without any options, or you can feed it the path to a
188
+saved titleset script as an option. The option to save a script is also
189
+useful as the resulting script can be run later from a terminal.
190
191
Command:disc
192
-===============================================================================
193
-
194
-**tovid disc** creates a DVD file-system with menus, from a list of multimedia
195
-video files and their titles. As this is a low level script it is the easiest
196
-command line program for creating a DVD from start to finish, including
197
-automatically converting non-compliant videos and prompting to burn at
198
-completion. It does animated menus, static thumbnail menus and text only
199
-menus. In addition, it can do slideshows, using images as input, and combine
200
-slideshows with videos. It supports sub-menus for chapter breaks, configurable
201
tovid-0.34.tar.bz2/docs/src/en/tovid.t2t -> tovid-0.35.tar.gz/docs/src/en/tovid.t2t
Changed
201
1
2
author and burn a ready-to-watch DVD, with just a few shell commands. A
3
graphical interface is also provided to make the process even easier.
4
5
-**NOTE**: As of tovid 0.32, this is the only manual page provided by tovid.
6
+**NOTE**: As of tovid 0.35, the legacy scripts **makemenu** and **makexml**
7
+have been removed and no longer appear in this manpage.
8
+All of their functions and more can be done with the 'tovid disc' command,
9
+(todisc script). See **Command:disc** and the [wiki http://tovid.wikia.com]
10
+for more info.
11
+
12
+Also note that as of tovid 0.32, this is the only manual page provided by tovid.
13
There is now a single executable frontend to all functionality in the suite, so
14
-if you were expecting to find manpages for **todisc**, **idvid**, **makemenu**
15
+if you were expecting to find manpages for **todisc**, **idvid**, **makempg**
16
and their kin, they can all be found in the **tovid** manpage you are reading now.
17
-
18
And yes, this makes for a pretty large manual page. If you are viewing this
19
manpage from the command-line **man** utility, which normally pages through the
20
**less** utility, you can skip to a section by searching with the **/** key,
21
22
23
Where //COMMAND// is one of the following:
24
25
+ Main Commands
26
+: **disc**
27
+ Encode, make menus, author, burn. (was **todisc**. See **Command:disc**)
28
: **gui**
29
Start the tovid GUI (was **todiscgui**. See **Command:gui**)
30
: **titlesets**
31
- A tovid GUI wizard for multiple titlesets. (new: See **Command:titlesets**)
32
-: **disc**
33
- Create a DVD with menus (was **todisc**. See **Command:disc**)
34
+ A GUI wizard for multiple titlesets. (new: See **Command:titlesets**)
35
+
36
+
37
+ Helper Commands
38
: **mpg**
39
Encode videos to MPEG format (was **tovid**. See **Command:mpg**)
40
-: **id**
41
- Identify one or more video files (was **idvid**. See **Command:id**)
42
-: **menu**
43
- Create an MPEG menu (was **makemenu**. See **Command:menu**)
44
-: **xml**
45
- Create (S)VCD or DVD .xml file (was **makexml**. See **Command:xml**)
46
: **dvd**
47
Author and/or burn a DVD (was **makedvd**. See **Command:dvd**)
48
-: **vcd**
49
- Author and/or burn a VCD (was **makevcd**. See **Command:vcd**)
50
-: **postproc**
51
- Post-process an MPEG video file (was **postproc**. See **Command:postproc**)
52
+: **id**
53
+ Identify one or more video files (was **idvid**. See **Command:id**)
54
: **chapters**
55
A GUI using mplayer for setting chapter points. It will return a string of
56
- chapter points in a format recognized by 'tovid disc' (todisc) or
57
- by 'tovid gui', for the **-chapters** option.
58
-
59
+ chapter points to the terminal, in a format recognized by 'tovid disc'
60
+ (todisc) or by 'tovid gui', for the **-chapters** option.
61
+
62
63
The //OPTIONS// differ for each command; run **tovid <command>** with no
64
further arguments to get help on a command, and what options it expects.
65
66
67
: **~/.tovid/preferences**
68
Defines working directory for all scripts.
69
- In addition you can define the output directory for makempg here.
70
+ You can define the output directory for makempg here.
71
+ The 'ffmpeg' executable can be set here: ffmpeg or avconv (TOVID_FFMPEG)
72
: **~/.tovid/tovid.ini**
73
Includes command-line options that should be passed to the various
74
- **tovid** sub-commands.
75
+ **tovid** sub-commands. Note: each sub-command has its own section,
76
+ starting with the line [sub-command], for example:
77
+```
78
+ [disc]
79
+ ; -no-warn
80
+ -static
81
+ -no-ask
82
+```
83
+
84
85
Edit these files if you wish to change your configuration.
86
87
+
88
The following environment variables are also honoured:
89
-TOVID_WORKING_DIR (working directory for all scripts).
90
-TOVID_OUTPUT_DIR (output directory for the makempg script).
91
+```
92
+ TOVID_HOME (directory containing preferences: ~/.tovid)
93
+ TOVID_WORKING_DIR (working directory for all scripts).
94
+ TOVID_OUTPUT_DIR (output directory for the makempg script).
95
+ TOVID_FFMPEG_CMD (the 'ffmpeg' executable to use: ffmpeg or avconv)
96
+```
97
+These will override 'TOVID_HOME', 'WORKING_DIR', 'OUTPUT_DIR',
98
+and 'TOVID_FFMPEG' if set in ~/.tovid/preferences.
99
100
101
=Command:gui=
102
103
+=Usage=
104
+
105
+**tovid gui** [//OPTIONS//]
106
+
107
**tovid gui** starts the graphical user interface (GUI) for tovid. This is
108
-the easiest way to start creating DVDs with tovid. At this time, there are no
109
-additional command-line options; the GUI controls take care of everything,
110
-and all help is integrated in the form of tooltips. You can also see
111
-**Command:disc ** for more detail about the options. Note: if you wish to
112
-make multiple titlesets on the same DVD use 'tovid titlesets', which is a wizard
113
-that uses the the tovid GUI. Chapter submenus can be made with 'tovid gui'
114
-however.
115
+the easiest way to start creating DVDs with tovid. The optional arguments
116
+//OPTIONS// are any option used by todisc ('tovid disc') which will save
117
+entering it manually, OR the full path to a saved script from the GUI.
118
+You can also combine these, but the script must be the FIRST option
119
+directly after **tovid gui** . (This option to save the contents of your
120
+project allows you to use it as a bash script later, or to reload the
121
+project to continue working with it at another time.)
122
+
123
+
124
+**tovid gui** will also take the option **--position**, which denotes the
125
+screen position that the GUI will start at, in the form '+X+Y', similar to
126
+this part of the Xorg -geometry string.
127
+
128
+All help is integrated in the form of tooltips. You can also see
129
+**Command:disc ** for more detail about the options. Note: if you wish to use
130
+a GUI to make multiple titlesets on the same DVD use ***tovid titlesets***,
131
+which is a wizard that uses the the 'tovid gui. See ***Command:titlesets***.
132
+
133
+
134
+Please note that although the interface may seem complex with so many options,
135
+you can create a fully functional DVD with only a few options on the opening
136
+tab of the GUI (select video files and an output name).
137
138
139
=Command:titlesets=
140
141
**tovid titlesets** will assist in making a DVD with multiple titlesets. It can
142
be started without any options, or you can feed it the path to a saved titleset
143
-script as an option.
144
+script as an option. The option to save a script is also useful as the resulting
145
+script can be run later from a terminal.
146
147
148
=Command:disc=
149
150
-**tovid disc** creates a DVD file-system with menus, from a list of multimedia
151
-video files and their titles. As this is a low level script it is the easiest
152
-command line program for creating a DVD from start to finish, including
153
-automatically converting non-compliant videos and prompting to burn at
154
-completion. It does animated menus, static thumbnail menus and text only
155
-menus. In addition, it can do slideshows, using images as input, and combine
156
-slideshows with videos. It supports sub-menus for chapter breaks, configurable
157
-menu style, animated backgrounds and transparency effects.
158
+**tovid disc** creates a DVD file-system with optional menus, from a list of
159
+multimedia video files and their titles. As todisc can function as a master
160
+script, calling other scripts as it needs them, it is the easiest command line
161
+program for creating a DVD from start to finish, including automatically
162
+converting non-compliant videos and prompting to burn at completion. It can do
163
+animated menus, static thumbnail menus, text-only menus, or author with no menu.
164
+In addition, it can do slideshows, using images as input, and even combine
165
+slideshows with videos. It supports sub-menus for chapter breaks,
166
+configurable menu style, animated backgrounds and transparency effects.
167
+From simple (no menu) to complex (switched menus and titlesets), you should
168
+be able to do what you want with 'tovid disc'.
169
170
171
==Usage==
172
173
```
174
tovid disc [OPTIONS] \
175
-files <file list> -titles <title list>
176
- -out OUT_PREFIX
177
+ -out mydvd
178
```
179
180
For example:
181
182
as titles. If you are doing a slideshow or multiple slideshows, use
183
**-slides** rather than **-files** for passing in the images. You may use
184
-files and -slides more than once to create an ordering in a mixed
185
-slideshows/videos menu. See SLIDESHOWS part of Usage section, below.
186
+slideshows/videos menu. See Slideshows part of Usage section, below.
187
188
If the input files are not mpeg, you will have the option to auto-encode them.
189
190
+General Options
191
+
192
**At present there are 2 display arrangements or "templates":**
193
194
: A. (Default)
195
196
$ tovid disc -submenus \
197
-files file1.mpg file2.mpg ... \
198
-titles "Short 1" "Short 2" \
199
+ -submenus \
200
-submenu-titles "Long Title One" "Long Title Two" \
201
tovid-0.34.tar.bz2/libtovid/__init__.py -> tovid-0.35.tar.gz/libtovid/__init__.py
Changed
49
1
2
3
__all__ = [
4
# Subdirectories
5
- 'backend',
6
- 'gui',
7
'guis',
8
'metagui',
9
- 'render',
10
- 'template',
11
- 'test',
12
- 'util',
13
# .py files
14
- 'author',
15
'cli',
16
- 'deps',
17
- 'encode',
18
'odict',
19
- 'opts',
20
- 'rip',
21
- 'standard',
22
- 'stats',
23
'utils',
24
- 'xml',
25
]
26
27
import os
28
+from sys import version_info
29
30
# Python < 3.x
31
try:
32
33
except ImportError:
34
from configparser import ConfigParser
35
36
+# Python 3.x compatibility assignments
37
+if version_info[0] < 3: # python 3.x
38
+ unicode = unicode
39
+ basestring = basestring
40
+ xrange = xrange
41
+else: # Python 3.x
42
+ unicode = str
43
+ basestring = str
44
+ xrange = range
45
+
46
# Configuration file reader/writer
47
class Config (ConfigParser):
48
"""Interface for reading/writing tovid configuration files. Just a wrapper
49
tovid-0.34.tar.bz2/libtovid/cli.py -> tovid-0.35.tar.gz/libtovid/cli.py
Changed
16
1
2
import subprocess
3
import signal
4
import os
5
-
6
# Small workaround for Python 3.x
7
-try:
8
- _temp = unicode
9
-except NameError:
10
- unicode = str
11
+from libtovid import unicode, basestring
12
+
13
14
class ProgramNotFound (ValueError):
15
"""Raised when the program given to a command is not available.
16
tovid-0.34.tar.bz2/libtovid/guis/helpers.py -> tovid-0.35.tar.gz/libtovid/guis/helpers.py
Changed
201
1
2
-import Tkinter as tk
3
import time
4
import shlex
5
-import commands
6
import re
7
import os
8
import fnmatch
9
from libtovid.metagui import *
10
from libtovid.metagui.control import _SubList
11
from libtovid.util import filetypes
12
-from subprocess import Popen, PIPE, STDOUT
13
-from tempfile import mkdtemp
14
+from subprocess import Popen, PIPE
15
+from tempfile import mkdtemp, mkstemp
16
+from sys import stdout
17
+
18
+try:
19
+ from commands import getstatusoutput, getoutput
20
+ import Tkinter as tk
21
+except ImportError:
22
+ # python 3
23
+ from subprocess import getstatusoutput, getoutput
24
+ import tkinter as tk
25
26
__all__ = [ 'VideoGui', 'SetChapters', 'Chapters', 'strip_all', 'to_title',
27
'find_masks', 'nodupes', 'video_filetypes', 'image_filetypes',
28
'visual_filetypes', 'dvd_video_files', 'av_filetypes', 'sys_dir',
29
'thumb_masks', 'home_dir', 'tovid_prefix', 'tovid_icon', 'os_path',
30
-'heading_text', '_files_and_titles', '_out' ]
31
+'heading_text', '_files_and_titles', '_out', 'CopyableInfo' ]
32
+
33
34
class VideoGui(tk.Frame):
35
"""A basic GUI to play video files. It runs mplayer in slave mode
36
37
Without subclassing it only contains a 'play/pause button
38
and an 'exit' button.
39
"""
40
- def __init__(self, master, args='', title='', callback=None, style='popup'):
41
+ def __init__(self, master, args='', title='', callback=None):
42
"""Initialize GUI
43
44
master
45
46
the wm title given to the master widget.
47
callback
48
a function run at program exit, before cleanup of temp files
49
- style
50
- may be one of 'popup' (default), 'standalone', or 'embedded'(TBA)
51
"""
52
tk.Frame.__init__(self, master)
53
54
55
try:
56
self.master.title(title)
57
except AttributeError:
58
- print "Error: " + \
59
- "VideoGui master must be a root window for 'title' option"
60
+ print("Error: " + \
61
+ "VideoGui master must be a root window for 'title' option")
62
self.callback = callback
63
- self.style = style
64
-
65
+ self.v_width = 540
66
+ self.v_height = 405
67
self.is_running = tk.BooleanVar()
68
self.is_running.set(False)
69
self.pauseplay = tk.StringVar()
70
- self.pauseplay.set('play')
71
+ self.pauseplay.set('Play')
72
# temporary directory for fifo and other mplayer files
73
+ self.make_tmps()
74
+ self.draw()
75
+
76
+ def make_tmps(self):
77
+ """Make temporary directory containing fifo for mplayer commmands,
78
+ editlist, and log
79
+ """
80
self.tempdir = mkdtemp(prefix='tovid-')
81
self.cmd_pipe = os.path.join(self.tempdir, 'slave.fifo')
82
self.editlist = os.path.join(self.tempdir, 'editlist')
83
os.mkfifo(self.cmd_pipe)
84
self.log = os.path.join(self.tempdir, 'mplayer.log')
85
- self.draw()
86
-
87
+
88
def draw(self):
89
"""Draw the GUI in self.master and get X11 identifier for container"""
90
self.root_frame = tk.Frame(self)
91
self.root_frame.pack(side='top', fill='both', expand=1, pady=20)
92
self.container = tk.Frame(self.root_frame, bg='black', container=1, colormap='new')
93
+ self.container.configure(width=self.v_width, height=self.v_height, bg='black')
94
self.container.pack()
95
# X11 identifier for the container frame
96
self.xid = self.tk.call('winfo', 'id', self.container)
97
- # bindings for exit
98
- if self.style == 'standalone':
99
- self._root().protocol("WM_DELETE_WINDOW", self.confirm_exit)
100
- self._root().bind('<Control-q>', self.confirm_exit)
101
self.add_widgets()
102
103
def add_widgets(self):
104
- """
105
- Add buttons to the VideoGui. Override this to customize buttons.
106
+ """Add buttons to the VideoGui. Override this to customize buttons.
107
root_frame has 'grab_set()' applied to it so make sure widgets go
108
into this frame or they will not be functional!
109
This function is called in draw()
110
"""
111
button_frame = tk.Frame(self.root_frame)
112
button_frame.pack(side='bottom', fill='x', expand=1)
113
- control_frame = tk.Frame(button_frame, borderwidth=1, relief='groove')
114
- control_frame.pack()
115
- exit_button = tk.Button(control_frame, command=self.exit_mplayer, text='exit')
116
- pause_button = tk.Button(control_frame, command=self.pause,
117
+ self.control_frame = tk.Frame(button_frame, borderwidth=1, relief='groove')
118
+ self.control_frame.pack()
119
+ self.load_button = tk.Button(self.control_frame,
120
+ command=self.load, text='load video')
121
+ self.load_button.pack(side='left')
122
+ exit_button = tk.Button(self.control_frame, command=self.exit_mplayer, text='exit')
123
+ self.pause_button = tk.Button(self.control_frame, command=self.pause,
124
width=12, textvariable=self.pauseplay)
125
- exit_button.pack(side='left')
126
- pause_button.pack(side='left')
127
+ self.pause_button.pack(side='left')
128
+ exit_button.pack(side='left', padx=5)
129
+ self.mp_ctrls = [self.pause_button]
130
+ self.toggle_controls('disabled', self.mp_ctrls)
131
132
133
def identify(self, video):
134
- """
135
- Get information about video from mplayer -identify.
136
+ """Get information about video from mplayer -identify.
137
Called by set_container()
138
"""
139
140
- output = commands.getoutput('mplayer -vo null -ao null -frames 5 \
141
- -channels 6 -identify %s' %video)
142
- return output
143
+ cmd = 'mplayer -vo null -ao null -frames 5 -channels 6 -identify'
144
+ cmd = shlex.split(cmd) + [video]
145
+ output = Popen(cmd, stdout=PIPE, stderr=PIPE)
146
+ return output.communicate()[0]
147
148
- def set_container(self, video):
149
+ def load(self, event=None):
150
+ """Load a file to play in the GUI"""
151
+ try:
152
+ from tkFileDialog import askopenfilename
153
+ except ImportError:
154
+ # python 3
155
+ from tkinter.filedialog import askopenfilename
156
+ vid_name = askopenfilename()
157
+ if vid_name:
158
+ self.toggle_controls('normal', self.mp_ctrls)
159
+ if self.pauseplay.get() == 'Pause':
160
+ self.pauseplay.set('Play')
161
+ self.run(vid_name)
162
+
163
+ def set_container(self, video=None):
164
"""Get aspect ratio and set dimensions of video container.
165
Called by run().
166
"""
167
- if self.style == 'standalone':
168
- v_width = 600
169
- else:
170
- v_width = 540
171
media_info = self.identify(video)
172
- asr = re.findall('ID_VIDEO_ASPECT=.*', media_info)
173
+ asr = re.findall('ID_VIDEO_ASPECT=.*', str(media_info))
174
# get last occurence as the first is 0.0 with mplayer
175
if asr:
176
asr = sorted(asr, reverse=True)[0].split('=')[1]
177
- try:
178
- asr = float(asr)
179
- except ValueError:
180
- asr = 0.0
181
+ try:
182
+ asr = float(asr)
183
+ except ValueError:
184
+ asr = 0.0
185
# get largest value as mplayer prints it out before playing file
186
if asr and asr > 0.0:
187
- v_height = int(v_width/asr)
188
+ v_height = int(self.v_width/asr)
189
else:
190
# default to 4:3 if identify fails
191
- v_height = int(v_width/1.333)
192
- self.container.configure(width=v_width, height=v_height)
193
+ v_height = int(self.v_width/1.333)
194
+ self.container.configure(width=self.v_width, height=v_height)
195
196
def run(self, video):
197
"""Play video in this GUI using mplayer."""
198
+ if video == None:
199
+ self.toggle_controls('disabled', self.mp_ctrls)
200
+ return
201
tovid-0.34.tar.bz2/libtovid/guis/todisc.py -> tovid-0.35.tar.gz/libtovid/guis/todisc.py
Changed
201
1
2
"""A GUI for the todisc command-line program.
3
"""
4
5
-import Tkinter as tk
6
+try:
7
+ import Tkinter as tk
8
+except ImportError:
9
+ # python 3
10
+ import tkinter as tk
11
12
# Get supporting classes from libtovid.metagui
13
from libtovid.metagui import *
14
15
Number('Columns', '', 13, '', 0, 13))
16
17
_quick_menu = Flag('Quick menu (may need a menu video)',
18
- '-quick-menu', False, 'Note: may not be available in your ffmpeg '
19
- 'as the needed "vhooks" have been deprecated. Ten times faster than '
20
- 'normal showcase animation. A showcase or background video is required '
21
- 'unless doing switched menus. Menu links are text only. Not compatible '
22
- 'with wave or rotate options.')
23
+ '-quick-menu', False, 'Note: you need a recent ffmpeg with the "movie" '
24
+ 'filter enabled. Ten times faster than normal showcase animation. A '
25
+ 'showcase or background video is required unless doing switched menus. '
26
+ 'Menu links are text only. Not compatible with wave or rotate options.')
27
28
_switched_menus = Flag('Switched menus (try with "Quick menu" !)',
29
'-switched-menus', False,
30
31
_thumb_shape = Choice('Thumb shape', '-thumb-shape', 'none',
32
'Apply a shaped transparency mask to thumbnail videos or images. These '
33
'"feathered" shapes look best against a plain background or used with '
34
- '**-thumb-mist** [COLOR]. To use a "mist" background behind each thumb, '
35
+ '-thumb-mist [COLOR]. To use a "mist" background behind each thumb, '
36
'see "Thumb mist" section. No frame will be used for this option. '
37
+ 'See "man tovid" (-thumb-shape) for info on how to add your own masks.'
38
'Leave at "none" to not use a feathered shape.',
39
thumb_masks, 'dropdown')
40
41
42
'(4 videos only). Not a showcase option.')
43
44
_align = Choice('Align', '-align', 'north',
45
- 'Controls positioning of the thumbnails and their titles. '
46
- 'With some arrangements this will have limited effects however.',
47
+ 'Controls positioning of the thumbnails (if any) and video titles. '
48
+ 'With some arrangements this will have limited effects however.'
49
+ 'For example only north|south|center can be used with the default montage '
50
+ 'of thumbs arrangement, or with showcase with thumb arrangement. '
51
+ 'It will be most effective with single column showcase and textmenu styles',
52
'north|south|east|west|center', 'dropdown')
53
54
_seek = SpacedText('Thumbnail seek(s)', '-seek', '',
55
56
'A single value or space separated list, 1 value per video. '
57
'Also used for seeking in switched menus.')
58
59
+_user_thumbs = List('Image(s)', '-user-thumbs', None,
60
+ 'Images for thumbnails. This option requires one image for each title.',
61
+ Filename('', filetypes=image_filetypes))
62
63
### --------------------------------------------------------------------
64
### Fonts and font colors
65
### --------------------------------------------------------------------
66
67
# Menu title font
68
-_menu_font = Font('', '-menu-font', 'Helvetica',
69
+_menu_font = Font('', '-title-font', 'Helvetica',
70
'The font to use for the menu title')
71
72
-_menu_fontsize = Number('Size', '-menu-fontsize', 24,
73
+_menu_fontsize = Number('Size', '-title-fontsize', 24,
74
'The font size to use for the menu title',
75
0, 80, 'pixels', toggles=True)
76
77
78
# Video title font
79
_titles_font = Font('', '-titles-font', 'Helvetica',
80
'The font to use for the video titles')
81
+# unused FIXME
82
+_titles_font_deco = SpacedText('Custom font decoration', '', '',
83
+ 'Space-separated list of custom options to imagemagick.'),
84
85
_titles_fontsize = Number('Size', '-titles-fontsize', 12,
86
'The font size to use for the video titles. '
87
88
),
89
VPanel('Backgrounds',
90
VPanel('Image or video options',
91
- _bgvideo_seek,
92
- _bg_color),
93
+ HPanel('', _bgvideo_seek,
94
+ _bg_color)),
95
VPanel('Audio options',
96
HPanel('', _bgaudio_seek, _menu_audio_fade)),
97
+ HPanel('Menu alignment', _align),
98
),
99
),
100
),
101
102
HPanel('',
103
Number('Number of slides shown on menu', '-menu-slide-total', 0,
104
'Use this many slides for making the slideshow menu. '
105
- 'The default is to use all the slides given.',
106
+ 'Leave at 0 for default: use all slides given.',
107
0, 100),
108
_submenu_slide_total,
109
),
110
111
slideshows = Tabs('Slideshows', *tab_list)
112
113
114
-thumbnails = VPanel("Thumbnails",
115
+thumbnails = Tabs("Thumbnails",
116
+ VPanel('Menu link thumbnails',
117
+ VPanel('',
118
HPanel('',
119
- VPanel('Menu link thumbnails',
120
- HPanel('Seeking', _seek),
121
+ VPanel('',
122
+ HPanel('',
123
+ VPanel('Aspect ratio', Label('Automatic: force video ratio on "Playback" tab')),
124
+ VPanel('Seeking', _seek),
125
+ ),
126
+ HPanel('',
127
VPanel("Effects",
128
HPanel('',_opacity, Label('(Also affects showcase thumb)')),
129
HPanel('', _blur, _3dthumbs),
130
131
_thumb_framesize,
132
_thumb_frame_color,
133
_thumb_columns,
134
- _align,
135
+ ),
136
),
137
),
138
+ ),
139
+ VPanel('User supplied thumbs',
140
+ VPanel('',
141
+ Label("Use this only if you want to substitute your own thumbs for default thumbnails.", 'center'),
142
+ _user_thumbs,
143
+ ),
144
+ ),
145
+ ),
146
+ ),
147
VPanel("Showcase thumbnail",
148
HPanel('Seeking', _showcase_seek),
149
+ HPanel('',
150
VPanel('Effects',
151
_wave,
152
HPanel('', _showcase_blur, _3dshowcase),
153
154
_showcase_frame_color,
155
_showcase_geo),
156
),
157
- ),
158
- HPanel('Aspect ratio', Label('Note: the aspect ratio of menu link '
159
- 'thumbnails is automatic: (force video ratio on "Playback" tab)')),
160
+ ),
161
)
162
163
from libtovid.guis import tovid
164
165
166
encoding = VPanel('Encoding',
167
Label("\nVideo re-encoding options - you may leave these at defaults.", 'center'),
168
- Tabs('tovid options',
169
+ Tabs('',
170
tovid.BASIC_OPTS,
171
tovid.VIDEO,
172
tovid.AUDIO,
173
tovid.BEHAVIOR,
174
),
175
- SpacedText('Custom makempg options', '', '',
176
+ Flag('Encode only', '-encode-only', False,
177
+ 'Use this GUI for encoding only. On the Main tab, load files and '
178
+ 'select an out filename'),
179
+ SpacedText('Custom makempg ("tovid mpg") options', '', '',
180
'Space-separated list of custom options to pass to makempg.'),
181
+
182
)
183
184
### --------------------------------------------------------------------
185
186
-def run(args=None):
187
+def run(args=None, position='', project=''):
188
+ from libtovid.guis.helpers import get_loadable_opts, load_script
189
+ import os
190
+ # if the first arg is a text file, treat it as a script and try to load
191
+ # the options from it as a list into args
192
+ # load_script from helpers overrides load_script from gui.py as the latter
193
+ # suffers from the load_args bug mentioned in that file.
194
+ if args:
195
+ script = args[0]
196
+ if not script.startswith('-'):
197
+ try:
198
+ from commands import getoutput
199
+ except ImportError:
200
+ # python 3
201
tovid-0.34.tar.bz2/libtovid/guis/tovid.py -> tovid-0.35.tar.gz/libtovid/guis/tovid.py
Changed
10
1
2
0, 4400, units='MiB')
3
4
# Encoder options
5
-_mplayeropts = SpacedText('mplayer options', '-mplayeropts', '', 'TODO: Tooltip')
6
+_mplayeropts = Text('mplayer options', '-mplayeropts', '', 'TODO: Tooltip')
7
_filters = Choice('mplayer filters', '-filters', 'none', 'TODO: Tooltip',
8
'none|denoise|deblock|contrast|all', side='top')
9
_ffmpeg = Flag('Encode using ffmpeg', '-ffmpeg', False)
10
tovid-0.34.tar.bz2/libtovid/metagui/control.py -> tovid-0.35.tar.gz/libtovid/metagui/control.py
Changed
48
1
2
def any(iterable):
3
"""Return True if bool(x) is True for any x in iterable."""
4
for item in iterable:
5
- if not item:
6
- return False
7
- return True
8
+ if item:
9
+ return True
10
+ return False
11
+
12
+
13
14
# Python < 3.x
15
try:
16
17
(asksaveasfilename, askopenfilename, askopenfilenames)
18
from tkinter.colorchooser import askcolor
19
20
+# Python 3.x
21
+from libtovid import basestring
22
+
23
from libtovid.metagui.widget import Widget
24
from libtovid.metagui.variable import VAR_TYPES, ListVar
25
from libtovid.metagui.support import \
26
27
"""Event handler to update the color preview.
28
"""
29
color = self.variable.get().strip()
30
- self.set(color)
31
+ try:
32
+ self.set(color)
33
+ except (ValueError):
34
+ pass
35
36
37
def pick_color(self):
38
39
def next_item(self, event):
40
"""Select the next item in the parent listbox.
41
"""
42
- self.parent_list.listbox.next_item(event)
43
+ if self.parent_list is not None:
44
+ self.parent_list.listbox.next_item(event)
45
46
47
class SpacedText (Text):
48
tovid-0.34.tar.bz2/libtovid/metagui/gui.py -> tovid-0.35.tar.gz/libtovid/metagui/gui.py
Changed
201
1
2
import tempfile
3
import shlex
4
import subprocess
5
-from sys import exit
6
+from sys import exit, argv
7
8
# Python < 3.x
9
try:
10
+ import Tix
11
import Tkinter as tk
12
from ScrolledText import ScrolledText
13
- from tkFileDialog import \
14
- (asksaveasfilename, askopenfilename)
15
from tkMessageBox import showinfo, showerror
16
- import Tix
17
+ from tkFileDialog import (
18
+ asksaveasfilename, askopenfilename
19
+ )
20
21
# Python 3.x
22
except ImportError:
23
import tkinter as tk
24
+ import tkinter.tix as Tix
25
from tkinter.scrolledtext import ScrolledText
26
- from tkinter.filedialog import \
27
- (asksaveasfilename, askopenfilename)
28
from tkinter.messagebox import showinfo, showerror
29
- import tkinter.tix as Tix
30
+ from tkinter.filedialog import (
31
+ asksaveasfilename, askopenfilename
32
+ )
33
34
from libtovid import cli
35
from libtovid.metagui.widget import Widget
36
from libtovid.metagui.panel import Panel, Tabs
37
-from libtovid.metagui.support import \
38
- (ConfigWindow, Style, ensure_type, askyesno, get_photo_image, show_icons)
39
from libtovid.metagui.control import Control, NoSuchControl
40
+from libtovid.metagui.support import (
41
+ ConfigWindow, Style, ensure_type, askyesno, get_photo_image, show_icons
42
+ )
43
44
45
DEFAULT_CONFIG = os.path.expanduser('~/.metagui/config')
46
47
self.notify("Output saved to '%s'" % filename)
48
49
50
+from textwrap import dedent
51
class Application (Widget):
52
"""Graphical frontend for a command-line program
53
"""
54
55
"""Draw the Application in the given master.
56
"""
57
Widget.draw(self, master)
58
+ self.master = master
59
# Draw all panels as tabs
60
self.tabs = Tabs('', *self.panels)
61
self.tabs.draw(self)
62
self.tabs.pack(anchor='n', fill='both', expand=True)
63
+ # need to wait until draw is called before setting this variable
64
+ self.script = tk.StringVar()
65
+ self.script.set('')
66
67
68
def draw_toolbar(self, config_function, exit_function):
69
70
self.executor.notify("Cancelled.")
71
self.toolbar.enable()
72
73
+ def set_scriptname(self, name):
74
+ """Set script filename. Called externally, this sets the variable
75
+ that used used for save_exit() as well as the 'initial file' for
76
+ prompt_save_script().
77
+ """
78
+ self.script.set(name)
79
+
80
81
def prompt_save_script(self):
82
"""Prompt for a script filename, then save the current
83
84
# TODO: Make initialfile same as last saved script, if it exists
85
filename = asksaveasfilename(parent=self,
86
title="Select a filename for the script",
87
- initialfile='%s_commands.bash' % self.program)
88
+ #initialfile='%s_commands.bash' % self.program)
89
+ initialfile=self.script.get() or '%s_commands.bash' % self.program)
90
91
if not filename:
92
return
93
94
showerror(title="Error", message="Failed to save '%s'" % filename)
95
raise
96
else:
97
+ saved_script = os.path.split(filename)[1]
98
showinfo(title="Script saved", message="Saved '%s'" % filename)
99
100
101
def save_exit(self):
102
- filename = os.getcwd() + os.path.sep + '%s_commands.bash' % self.program
103
+ """Save current command to script and exit, without prompt
104
+ """
105
+ # hack for titleset wizard to get gui's screen position
106
+ from sys import stderr
107
+ stderr.write("%s %+d%+d"
108
+ %('gui position', self._root().winfo_x(), self._root().winfo_y()))
109
+
110
+ default = os.getcwd() + os.path.sep + '%s_commands.bash' % self.program
111
+ filename = self.script.get() or default
112
self.save_script(filename)
113
- # exit code borrowed from apache so wizard knows it has a file to read
114
- exit(200)
115
+ exit()
116
117
118
def prompt_load_script(self):
119
- """Prompt for a script filename, then load current Control settings
120
- from that file.
121
+ """Prompt for script filename; reload gui with current Control settings
122
"""
123
+ #"""Prompt for a script filename, then load current Control settings
124
+ #from that file.
125
+ #"""
126
+ # Hack: This is broken (commented section), presumably because of
127
+ # load_args limitations. This hack fixes it for libtovid, but does not
128
+ # belong in metagui. So refactor this when load_args is fixed.
129
+ # see http://code.google.com/p/tovid/issues/detail?id=121
130
filename = askopenfilename(parent=self,
131
title="Select a shell script or text file to load",
132
filetypes=[('Shell scripts', '*.sh *.bash'),
133
134
135
if not filename:
136
return
137
-
138
+ # begin Hack
139
+ geometry = self._root().winfo_x(), self._root().winfo_y()
140
+ command = argv[0]
141
try:
142
- self.reset()
143
- self.load_script(filename)
144
+ cmd = command, '--position', '+%s+%s' %geometry, filename
145
+ os.execlp(cmd[0], *cmd)
146
except:
147
- showerror(title="Error", message="Failed to load '%s'" % filename)
148
+ showerror(title="Error", message="Failed load '%s'" %filename)
149
raise
150
- else:
151
- showinfo(title="Script loaded", message="Loaded '%s'" % filename)
152
+ #try:
153
+ # self.reset()
154
+ # self.load_script(filename)
155
+ #except:
156
+ # showerror(title="Error", message="Failed to load '%s')
157
+ # raise
158
+ #else:
159
+ # showinfo(title="Script loaded", message="Loaded '%s'" % filename)
160
161
162
def save_script(self, filename):
163
164
165
166
def load_script(self, filename):
167
- """Load current Control settings from a text file.
168
- """
169
+ # this is now disabled and its functionality passed to guis.helpers.py
170
+ # see http://code.google.com/p/tovid/issues/detail?id=121
171
+ pass
172
+ #"""Load current Control settings from a text file.
173
+ #"""
174
# Read lines from the file and reassemble the command
175
- command = ''
176
- for line in open(filename, 'r'):
177
- line = line.strip()
178
+ #command = ''
179
+ #for line in open(filename, 'r'):
180
+ # line = line.strip()
181
# Discard comment lines and PATH assignment
182
- if line and not (line.startswith('#') or line.startswith('PATH=')):
183
- command += line.rstrip('\\')
184
+ # if line and not (line.startswith('#') or line.startswith('PATH=')):
185
+ # command += line.rstrip('\\')
186
# Split the full command into arguments, according to shell syntax
187
- args = shlex.split(command)
188
+ #args = shlex.split(command)
189
190
# Ensure the expected program is being run
191
- program = args.pop(0)
192
- if program != self.program:
193
- raise ValueError("This script runs '%s', expected '%s'" %
194
- (program, self.program))
195
+ #program = args.pop(0)
196
+ #if program != self.program:
197
+ # raise ValueError("This script runs '%s', expected '%s'" %
198
+ # (program, self.program))
199
# Load the rest of the arguments
200
- self.load_args(args)
201
tovid-0.34.tar.bz2/libtovid/metagui/panel.py -> tovid-0.35.tar.gz/libtovid/metagui/panel.py
Changed
20
1
2
except ImportError:
3
import tkinter as tk
4
5
+from base64 import b64encode
6
from libtovid import cli
7
from libtovid.odict import Odict
8
from libtovid.metagui.widget import Widget
9
from libtovid.metagui.control import Control, Flag
10
-from libtovid.metagui.support import \
11
- (ComboBox, ensure_type, divide_list, get_photo_image)
12
from libtovid.metagui.variable import ListVar
13
-from base64 import b64encode
14
+from libtovid.metagui.support import (
15
+ ComboBox, ensure_type, divide_list, get_photo_image
16
+ )
17
18
19
class Label (Widget):
20
tovid-0.34.tar.bz2/libtovid/metagui/support.py -> tovid-0.35.tar.gz/libtovid/metagui/support.py
Changed
18
1
2
import tkinter.tix as Tix
3
import tkinter.font as tkFont
4
5
+# Python 2.4
6
+try:
7
+ all
8
+except NameError:
9
+ def all(iterable):
10
+ for element in iterable:
11
+ if not element:
12
+ return False
13
+ return True
14
+
15
from libtovid import cli
16
from libtovid.util import imagemagick_fonts
17
from libtovid.metagui.variable import ListVar
18
tovid-0.34.tar.bz2/libtovid/metagui/widget.py -> tovid-0.35.tar.gz/libtovid/metagui/widget.py
Changed
11
1
2
except ImportError:
3
import tkinter as tk
4
5
+# Python 3 compatibility
6
+from libtovid import basestring
7
+
8
class Widget (tk.Frame):
9
"""Generic metagui widget, suitable for Controls, Panels, etc.
10
"""
11
tovid-0.34.tar.bz2/libtovid/util/__init__.py -> tovid-0.35.tar.gz/libtovid/util/__init__.py
Changed
43
1
2
import doctest
3
import mimetypes
4
import tempfile
5
+# Python 3 compatibility
6
+from libtovid import basestring, unicode
7
8
# Special characters that may need escaping
9
special_chars = '\\ #*:;&?!<>[]()"\''
10
11
# Split text into lines, converting tabs to spaces
12
lines = text.expandtabs().splitlines()
13
# Determine minimum indentation (except first line)
14
- indent = sys.maxint
15
+ try:
16
+ MAXINT = sys.maxint
17
+ # python 3 compatibility
18
+ except AttributeError:
19
+ MAXINT = sys.maxsize
20
+
21
+ indent = MAXINT
22
+
23
for line in lines[1:]:
24
stripped = line.lstrip()
25
if stripped:
26
indent = min(indent, len(line) - len(stripped))
27
# Remove indentation (first line is special)
28
trimmed = [lines[0].strip()]
29
- if indent < sys.maxint:
30
+ if indent < MAXINT:
31
for line in lines[1:]:
32
# Append line, minus indentation
33
trimmed.append(line[indent:].rstrip())
34
35
"""Print a message and pause for the given number of seconds.
36
"""
37
print("Resuming in %s seconds..." % seconds)
38
- os.system('sleep %ss' % seconds)
39
+ os.system('sleep %s' % seconds)
40
41
42
def imagemagick_version():
43
tovid-0.34.tar.bz2/setup.py -> tovid-0.35.tar.gz/setup.py
Changed
60
1
2
as a string like 'svn-r1234'. If svn is not installed, or if something goes
3
wrong, return 'svn-unknown'
4
"""
5
- from commands import getoutput
6
+ try:
7
+ from commands import getoutput
8
+ except ImportError:
9
+ # python 3
10
+ from subprocess import getoutput
11
+
12
rev_line = getoutput('svn info 2>/dev/null | grep ^Revision')
13
# If rev_line is found, get the revision number
14
if rev_line:
15
16
# Current SVN version number
17
#_tovid_version = svn_version()
18
# Official release number
19
-_tovid_version = '0.34'
20
+_tovid_version = '0.35'
21
22
23
import os
24
25
26
# Build tovid-init with regular 'build' command
27
build.sub_commands.append(('build_tovid_init', None))
28
-#build.sub_commands.append(('build_docs', None))
29
+build.sub_commands.append(('build_docs', None))
30
31
# The actual setup
32
setup(
33
34
'libtovid.guis',
35
'libtovid.util',
36
'libtovid.metagui',
37
- 'libtovid.render',
38
- 'libtovid.backend',
39
],
40
41
# Executable files go into /$PREFIX/bin/
42
43
# Bash scripts
44
'src/idvid',
45
'src/makedvd',
46
- 'src/makemenu',
47
- 'src/makevcd',
48
- 'src/makexml',
49
- 'src/postproc',
50
'src/todisc',
51
'src/todisc-fade-routine',
52
'src/makempg',
53
- 'src/tovid-batch',
54
'src/tovid-init',
55
- 'src/tovid-interactive',
56
- 'src/make_titlesets',
57
58
# Python scripts
59
'src/todiscgui',
60
tovid-0.34.tar.bz2/src/idvid -> tovid-0.35.tar.gz/src/idvid
Changed
201
1
2
#!/usr/bin/env bash
3
-#set -u
4
5
ME="[idvid]:"
6
. tovid-init 2>/dev/null ||
7
8
echo -e "Or are you trying to run the script directly?"
9
echo -e "Please run idvid as:\ntovid id OPTIONS"
10
exit 1 ; }
11
-
12
# idvid
13
# Part of the tovid suite
14
# =======================
15
16
#
17
# Project homepage: http://tovid.wikia.com
18
#
19
-# Copyright (C) 2005-2010
20
+# Copyright (C) 2005-2015
21
#
22
# This program is free software; you can redistribute it and/or
23
# modify it under the terms of the GNU General Public License
24
25
-terse Suitable for parsing
26
-verbose Also use ffmpeg and tcprobe
27
-accurate Do accurate duration estimation
28
+ -keepfiles Keep temporary directory for debugging
29
-isformat [ntsc-vcd|pal-vcd|ntsc-svcd|pal-svcd|ntsc-dvd|pal-dvd]
30
Tell whether the first file is compliant with the given
31
format; prints "true" or "false" (returns shell 0 or 1)
32
33
MATCH_FORMAT=""
34
MATCH_TVSYS=""
35
TABULAR=false
36
-USE_MENCODER=:
37
+GET_FFMPEG_LEN=:
38
USE_NAVLOG=false
39
+KEEPFILES=false
40
ID_FILES=""
41
42
mkdir -p "$STAT_DIR"
43
44
echo "Identifying video with ffmpeg..."
45
echo $SEPARATOR
46
# ffmpeg puts its output on standard error
47
- ffmpeg -i "$INFILE" 2>&1 | tee -a "$SCRATCH_FILE"
48
+ $FFmpeg -i "$INFILE" 2>&1 | tee -a "$SCRATCH_FILE"
49
else
50
- ffmpeg -i "$INFILE" >> "$SCRATCH_FILE" 2>&1
51
+ $FFmpeg -i "$INFILE" >> "$SCRATCH_FILE" 2>&1
52
fi
53
fi
54
+ # avconv messed with formatting, so we need to move to ffprobe/avprobe
55
+ # ffprobe and avprobe show slightly different formatting, but this should do
56
+ # adds a new line after [/STREAM] (ffmpeg). avconv already has it.
57
+ if test -n $FFprobe; then
58
+ i=0
59
+ while IFS= read -r line; do
60
+ [[ $line ]] || { ((++i)); continue; }
61
+ probe_info[i]+=$line$'\n'
62
+ done < <($FFprobe -show_streams "$INFILE" 2>/dev/null | \
63
+ sed '/\[\/STREAM\]/{G;s/$//;};/DISPOSITION/d')
64
+ fi
65
+ # avprobe begins with a # comment\n so delete that index and flatten array
66
+ for i in ${!probe_info[@]}; do
67
+ grep -q '^#' <<< ${probe_info[i]} && unset probe_info[i]
68
+ done
69
+ # if index 0 is unset flatten array
70
+ [[ ${probe_info[0]+unset} ]] || probe_info=( "${probe_info[@]}" )
71
+
72
# Identify video using tcprobe
73
if test -n "$TCPROBE"; then
74
if $VERBOSE ; then
75
echo $SEPARATOR
76
echo "Identifying video with tcprobe..."
77
echo $SEPARATOR
78
- tcprobe -i "$INFILE" 2>&1 | tee -a "$SCRATCH_FILE"
79
+ tcprobe -i "$INFILE" 2>&1 | tee -a "$SCRATCH_FILE" 2>/dev/null
80
else
81
tcprobe -i "$INFILE" >> "$SCRATCH_FILE" 2>/dev/null
82
fi
83
84
fi
85
exit 1
86
fi
87
+ # remove ffmpeg metadata from scratch file
88
+ # make portable for bsd sed etc
89
+ #sed '/Metadata/,/Duration/{//!d}' "$SCRATCH_FILE" > "${SCRATCH_FILE}2"
90
+ #mv "${SCRATCH_FILE}2" "$SCRATCH_FILE"
91
92
# Defaults. Many of these values may be overridden by
93
# vars from mplayer's output to be sourced later.
94
95
V_DURATION=""
96
ID_LENGTH="0"
97
98
- # bash appears to have no way of initializing empty arrays; we append to these later,
99
- # so unsetting them clears out their previous contents
100
- unset A_SAMPRATES
101
- unset A_BITRATES
102
- unset A_CODECS
103
- unset A_HEX_TRACKS
104
- unset A_TRACKS
105
- unset wavs
106
+ # arrays
107
+ A_SAMPRATES=()
108
+ A_BITRATES=()
109
+ A_CODECS=()
110
+ A_HEX_TRACKS=()
111
+ A_TRACKS=()
112
+ MPL_AIDS=()
113
+ wavs=()
114
+ probe_audio_info=()
115
116
# send formated mplayer's output to a vars file to be sourced to set relevant variables.
117
# (ID_V(ideo), ID_A(udio), and ID_L(ength))
118
119
# get array of mplayer audio ids, used if no hextracks from ffmpeg
120
while read; do MPL_AIDS+=(${REPLY##*=}); done < <(grep ID_AUDIO_ID "$SCRATCH_FILE")
121
122
- ID_VIDEO_FRAMES=$(grep 'length:' "$SCRATCH_FILE" | \
123
- awk -F ' ' '{print $2}')
124
- test -z $ID_VIDEO_FRAMES && ID_VIDEO_FRAMES="0"
125
-
126
- # ffmpeg has a better concept of the actual bitrate than mplayer
127
- TOTAL_AV_BITRATE=$(awk -F: '{gsub("kb/s", "")}; /bitrate:/ {print $6*1000}' "$SCRATCH_FILE")
128
- ## take the lower of the two
129
- if test $ID_VIDEO_BITRATE -eq 0 || test $TOTAL_AV_BITRATE -lt $ID_VIDEO_BITRATE; then
130
- # make sure we have a value from ffmpeg
131
- if test_is_number $TOTAL_AV_BITRATE; then
132
- ID_VIDEO_BITRATE=$TOTAL_AV_BITRATE
133
+ # try tcprobe to determine length (# of frames)
134
+ # assuming it is installed, otherwise this should 'fail' silently
135
+ ID_VIDEO_FRAMES=$(awk '/length:/ {print $2}' "$SCRATCH_FILE")
136
+ ((ID_VIDEO_FRAMES)) || ID_VIDEO_FRAMES="0"
137
+
138
+ FF_V_BITRATE=$(sed -n 's/.*Stream.*Video:.*\(\ [0-9][0-9][0-9]*\) kb\/s.*/\1/p' "$SCRATCH_FILE" |uniq)
139
+ FF_V_BITRATE=${FF_V_BITRATE// /} # trim spaces
140
+ # make sure we have a value from ffmpeg (a number and non zero)
141
+ if test_is_number "$FF_V_BITRATE" && (( FF_V_BITRATE )); then
142
+ # kilobits to bits
143
+ ID_VIDEO_BITRATE=${FF_V_BITRATE}000
144
+ elif [[ -z $ID_VIDEO_BITRATE || $ID_VIDEO_BITRATE = 0 ]]; then
145
+ mplayer_stats_br=$(sed '/VIDEO:/!d;s/.*(//; s/).*=\ /:/;s/[kK][bB].*//g' "$SCRATCH_FILE")
146
+ # make an integer
147
+ mplayer_stats_br=${mplayer_stats_br%.*}
148
+ # make sure it is a number
149
+ if test_is_number $mplayer_stats_br && (( mplayer_stats_br )); then
150
+ ID_VIDEO_BITRATE=$(( mplayer_stats_br * 8 * 1000 ))
151
fi
152
- else
153
- ID_VIDEO_BITRATE=$ID_VIDEO_BITRATE
154
fi
155
+ # if mplayer decides there is no video, unset ID_VIDEO_BITRATE
156
+ # else it will still show a value from TOTAL_AV_BITRATE
157
+ grep -qi "no video" "$SCRATCH_FILE" && unset ID_VIDEO_BITRATE
158
# if we still don't have a value for ID_VIDEO_WIDTH and ID_VIDEO_HEIGHT
159
MP_FRAMESIZE=$(awk '/=>/ {print $3}' "$SCRATCH_FILE")
160
if test $ID_VIDEO_WIDTH -eq 0; then
161
- test_is_number ${MP_FRAMESIZE%x*} && ID_VIDEO_WIDTH=${MP_FRAMESIZE%x*}
162
+ test_is_number ${MP_FRAMESIZE%x*} && ID_VIDEO_WIDTH=${MP_FRAMESIZE%x*}
163
fi
164
if test $ID_VIDEO_HEIGHT -eq 0; then
165
test_is_number ${MP_FRAMESIZE#*x} && ID_VIDEO_HEIGHT=${MP_FRAMESIZE#*x}
166
167
168
# Find out which channel is the video channel ( 1st )
169
# TODO Do we want to worry about videos with multiple channels of video ?
170
- VIDEO_INFO=$(grep "Video:" "$SCRATCH_FILE")
171
- ID_VIDEO_TRACKS=( $(sed -r 's/.*Stream #([0-9]\.[0-9]+).*/\1/' <<< "$VIDEO_INFO") )
172
- ID_VIDEO_TRACK="${ID_VIDEO_TRACKS[0]}"
173
+ VIDEO_INFO=$(grep "Video:" "$SCRATCH_FILE" 2>&1| uniq)
174
+ ID_VIDEO_TRACKS=( $(sed -r 's/.*Stream #([0-9][:.][0-9]+).*/\1/' <<< "$VIDEO_INFO") )
175
+ #ID_VIDEO_TRACKS=( $(awk '/Stream.*Video/ { gsub("#|: ", " ") ; print $2}' <<< "$VIDEO_INFO") )
176
+ test_is_number "${ID_VIDEO_TRACKS[0]/:/}" && ID_VIDEO_TRACK="${ID_VIDEO_TRACKS[0]}"
177
# Find out what audio channels are available
178
+ for p in ${!probe_info[@]}; do
179
+ if grep -q codec_type=audio <<< "${probe_info[p]}"; then
180
+ probe_audio_info+=( "${probe_info[p]}" )
181
+ fi
182
+ done
183
if test -n "$ID_AUDIO_ID"; then
184
- AUDIO_INFO=$(grep -w "Audio:" "$SCRATCH_FILE")
185
+ # grep for Steam.*Audio instead of just "Audio:" fixes some wmv issues
186
+ AUDIO_INFO=$(grep "Stream.*Audio:" "$SCRATCH_FILE")
187
# ID_AUDIO_ID needs "TRACKS" var to remain in columns
188
- TRACKS=$(sed -r 's/.*Stream #([0-9]\.[0-9]+).*/\1/' <<< "$AUDIO_INFO")
189
+ TRACKS=$(sed -r 's/.*Stream #([0-9][:.][0-9]+).*/\1/' <<< "$AUDIO_INFO")
190
A_TRACKS=(${TRACKS//$'\n'/ })
191
# Get hexadecimal track IDs, if present
192
if grep -q "\[0x[0-9a-fA-F]*]" <<< $AUDIO_INFO; then
193
- HEX_TRACKS=$(awk -F [][] '{gsub("0x", ""); print $2}' <<< "$AUDIO_INFO")
194
+ HEX_TRACKS=$(awk -F '[][]' '{gsub("0x", ""); print $2}' <<< "$AUDIO_INFO")
195
HEX_TRACKS=(${HEX_TRACKS//$'\n'/ })
196
USE_HEX_TRACKS=:
197
else
198
199
# Loop through available tracks and get specs on each
200
for ((i=0; i<${#A_TRACKS[@]}; i++)); do
201
tovid-0.34.tar.bz2/src/makedvd -> tovid-0.35.tar.gz/src/makedvd
Changed
55
1
2
#
3
# Project homepage: http://tovid.wikia.com
4
#
5
-# Copyright (C) 2005-2010
6
+# Copyright (C) 2005-2015
7
#
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU General Public License
10
11
EOF`
12
13
USAGE=`cat << EOF
14
-Usage: tovid dvd [OPTIONS] FILE.xml
15
- or: tovid dvd [OPTIONS] DVD_DIR
16
+Usage: tovid dvd [OPTIONS] DVD_DIR
17
18
-With FILE.xml, containing dvdauthor XML as generated by 'makexml',
19
-or DVD_DIR, a directory containing a DVD filesystem (VIDEO_TS, namely).
20
+DVD_DIR: a directory containing a DVD filesystem (VIDEO_TS, namely).
21
22
OPTIONS may be any of the following:
23
24
- -author Create DVD filesystem from FILE.xml
25
-burn Burn DVD filesystem from DVD_DIR
26
-eject Eject the DVD tray after burning
27
-device DEVFS_NAME DVD recorder device name (Default: /dev/dvdrw)
28
29
30
# See what kind of file we're working with, and do the right thing
31
# Author an XML file
32
+# This first if block is no longer really needed as makexml has
33
+# been removed from tovid but I will leave it here for now.
34
if echo "$DISC_NAME" | grep -q -i '\.xml$'; then
35
DVDAUTHOR_XML="$DISC_NAME"
36
DO_AUTHOR=:
37
38
export VIDEO_FORMAT=ntsc
39
echo -e '\n***'
40
echo "No default video format defined!!!"
41
- echo "Was this xml created by a recent version of tovid/makexml?"
42
+ echo "Was this xml created by a recent version of tovid/todisc?"
43
echo "Using default video format of 'ntsc'."
44
echo "Run 'export VIDEO_FORMAT=\"pal\"' if this is wrong for your disc."
45
echo -e '\n***'
46
47
echo "Found $DISC_STATUS $DISC_TYPE. Please insert a usable DVD into $DVDRW_DEVICE."
48
for COUNTER in {10..1}; do
49
printf "Trying again in %2s seconds...\r" $((COUNTER * TIME_SCALE))
50
- sleep ${TIME_SCALE}s
51
+ sleep $TIME_SCALE
52
done
53
((COUNT++))
54
echo
55
tovid-0.34.tar.bz2/src/makempg -> tovid-0.35.tar.gz/src/makempg
Changed
201
1
2
#!/usr/bin/env bash
3
-ME="[tovid]:"
4
+ME="[makempg]:"
5
. tovid-init 2>/dev/null ||
6
{ echo -e "===============================================================\n"
7
echo -e "'tovid-init' not found. Was tovid improperly installed?"
8
9
#
10
# Project homepage: http://tovid.wikia.com
11
#
12
-# Copyright (C) 2005-2010
13
+# Copyright (C) 2005-2015
14
#
15
# This program is free software; you can redistribute it and/or
16
# modify it under the terms of the GNU General Public License
17
18
# Audio bitrate (for ac3 or mp2)
19
AUD_BITRATE="224"
20
# Don't generate an empty audio stream
21
+NEWAUDIO_OPT=false
22
GENERATE_AUDIO=false
23
# Amplitude used when adjusting audio (-amplitude)
24
AUDIO_AMPLITUDE=""
25
26
yecho
27
return
28
else
29
- eval "$@" 2>&1 | strings >> "$LOG_FILE" &
30
+ eval "$@" 2>&1 | $std_buf strings >> "$LOG_FILE" &
31
PIDS="$PIDS $!"
32
fi
33
}
34
35
# ******************************************************************************
36
function check_disk_space()
37
{
38
+ # this function is very inaccurate, needs attention
39
# Determine space available in current directory (in MB)
40
- AVAIL_SPACE=$(df -mP . | awk 'NR != 1 {print $4;}')
41
+ # os compatibility patch from 'virtualestates' as per issue #152
42
+ AVAIL_SPACE=$(df -P . | awk 'NR==1 {sub("-blocks", "", $2); blocksize=$2} NR!=1 {print int($4/1024*blocksize/1024)}')
43
# Rough estimates of KB/sec for different formats
44
K_PER_SEC=200
45
test "$TGT_RES" = "VCD" && K_PER_SEC=172
46
47
# based on original file size
48
$SLICE && VIDEO_DURATION=$CLIP_LENGTH || VIDEO_DURATION=$V_DURATION
49
if test "$VIDEO_DURATION" = "0"; then
50
- CUR_SIZE=$(du -Dck \"$IN_FILE\" | awk 'END{print $1}')
51
+ CUR_SIZE=$(du -Dck "$IN_FILE" | awk 'END{print $1}')
52
NEED_SPACE=$(expr $CUR_SIZE \* 2)
53
- yecho "The encoding process will require about"
54
# Estimate space based as kbps * duration
55
else
56
NEED_SPACE=$(expr $VIDEO_DURATION \* $K_PER_SEC \/ 500)
57
- yecho "The encoding process is estimated to require $NEED_SPACE MB of disk space."
58
fi
59
-
60
+ # ffmpeg can do a+v 'at once' so half as much space needed
61
+ $USE_FFMPEG && ! $DO_NORM && ! [[ $ASYNC ]] && NEED_SPACE=$((NEED_SPACE/2))
62
+ yecho "The encoding process is estimated to require $NEED_SPACE MB of disk space."
63
yecho "You currently have $AVAIL_SPACE MB available in this directory."
64
}
65
66
67
"-downmix" )
68
DOWNMIX=:
69
;;
70
- "-ffmpeg" )
71
+ "-ffmpeg" | "-avconv" )
72
USE_FFMPEG=:
73
;;
74
"-nofifo" )
75
76
PEAK_BITRATE=$(grep 'Peak bit-rate' "$LOG_FILE" | awk '{print $6}')
77
if $USE_FFMPEG && ! $DO_NORM && ! $VIDEO_OK; then
78
# get lines with frame= , and print last field with kbit/s removed
79
- bitrates=$(awk -F= '/^frame=/ {gsub("kbits/s", ""); print $NF}' "$LOG_FILE")
80
+ bitrates=$(sed -n 's/kbits\/s//g;s/^.*bitrate= *\([^ ]*\).*/\1/p' "$LOG_FILE")
81
# get highest value, and remove spaces with sed
82
bitrates=$(sort -un <<< "$bitrates" | sed 's/^[ \t]*//;s/[ \t]*$//')
83
# average the values. Add 000, so it is in bits.
84
85
KB_PER_MIN=$(expr $FINAL_SIZE \* 60 \/ $V_DURATION \+ 1)
86
ENC_TIME_RATIO=$(echo "scale = 2; $SCRIPT_TOT_TIME / $V_DURATION" | bc)
87
if $USE_FFMPEG; then
88
- BACKEND="ffmpeg"
89
+ BACKEND="$FFmpeg"
90
else
91
BACKEND="mpeg2enc"
92
fi
93
94
if ! $QUIET; then
95
yecho "Your encoded video should be in the file(s) $OUT_FILENAME."
96
echo
97
- echo "You can author a disc with this video on it by running:"
98
- echo " tovid xml $OUT_FILENAME -out MyDisc"
99
- echo " tovid dvd MyDisc.xml"
100
- echo "You can also use todisc or makemenu to create menus for your disc."
101
- echo "See the tovid manual page ('man tovid') for more information."
102
+ echo "You can author a simple disc with this video on it by running:"
103
+ echo " tovid disc -no-menu \"$OUT_FILENAME\" -out MyDisc"
104
+ echo "Add -burn for a prompt to burn (-device and -speed optional)"
105
+ echo "Or use todisc (tovid disc) to create text-only or animated menus."
106
+ echo "See the manual ('man tovid') for more information and options."
107
echo
108
echo "Please report bugs to:"
109
echo " http://code.google.com/p/tovid/issues/list"
110
111
fi
112
113
if ((USE_FILTERS)) && $USE_FFMPEG; then
114
- usage_error "Sorry, you are using ffmpeg to encode
115
+ usage_error "Sorry, you are using $FFmpeg to encode
116
video, either by choice or another option requires it.
117
You can not use -filters with -ffmpeg"
118
fi
119
+
120
+# see if ffmpeg is new enough to support -b:v etc
121
+# remove this when 0.9x ffmpeg is the oldest tovid will support
122
+# note ffmpeg is used for audio so this must run even when using mpeg2enc
123
+if $FFmpeg -f rawvideo -pix_fmt yuv420p -s cif \
124
+ -i /dev/zero -t 1 -r 30 -f rawvideo \
125
+ -b:v 500k -y /dev/null > /dev/null 2>&1; then
126
+ VB=-b:v
127
+ AB=-b:a
128
+ CA=-c:a
129
+else
130
+ VB=-b
131
+ AB=-ab
132
+ CA=-acodec
133
+fi
134
+
135
# make sure we are not running from the gui and set some options
136
! $FROM_GUI && NOCONSOLE_CONTROLS="-noconsolecontrols"
137
138
139
usage_error "Please provide an output name with the -out option."
140
fi
141
142
+# check that outfile does not contain a comma because of a mpeg2enc limitation
143
+if ! $USE_FFMPEG && [[ "$OUT_PREFIX" = *,* || "$IN_FILE" = *,* ]]; then
144
+ exit_with_error "Comma illegal in -out and -in NAME (mpeg2enc limitation)"
145
+fi
146
+# check that outfile or infile don't use $$ or $[0-9] because of mpeg2 'bug'
147
+if ! $USE_FFMPEG && [[ "$OUT_PREFIX" = *\$\$* || "$IN_FILE" = *\$\$* ]]; then
148
+ exit_with_error '"$$" illegal in -out and -in NAME (mpeg2enc limitation)'
149
+elif ! $USE_FFMPEG && [[ "$OUT_PREFIX" = *\$[0-9]* || "$IN_FILE" = *\$[0-9]* ]]; then
150
+ exit_with_error '"$" followed by a digit illegal in -out and -in NAME (mpeg2enc limitation)'
151
+fi
152
# check that outfile is not a directory
153
if test -d "$OUT_PREFIX"; then
154
exit_with_error "Error: The specified output file is a directory. A filename must be specified."
155
156
157
# If multiple CPUs are available, do multithreading in mpeg2enc
158
if $MULTIPLE_CPUS; then
159
- yecho "Multiple CPUs detected; mpeg2enc and ffmpeg will use multithreading."
160
+ yecho "Multiple CPUs detected; mpeg2enc and $FFmpeg will use multithreading."
161
MTHREAD="--multi-thread 2"
162
FF_THREAD="-threads 4"
163
else
164
165
166
# Check for available space and prompt if it's not enough
167
# not needed if using ffmpeg to encode video and audio "at once"
168
- if ($USE_FFMPEG && (! $DO_NORM || ! [[ $ASYNC ]])) || $PARALLEL; then
169
+ if $PARALLEL; then
170
:
171
else
172
check_disk_space
173
- if test "$AVAIL_SPACE" -lt "$NEED_SPACE" && ! test $FROM_GUI -o $NOASK ; then
174
+ if ((AVAIL_SPACE < NEED_SPACE)) && ! $FROM_GUI && ! $NOASK; then
175
yecho "Available: $AVAIL_SPACE, needed: $NEED_SPACE"
176
echo "It doesn't look like you have enough space to encode this video."
177
echo "Of course, I could be wrong. Do you want to proceed anyway? (y/n)"
178
179
yecho "I can't find any deinterlacing options to use. No deinterlacing"
180
yecho "will be done on this video (but encoding will continue)."
181
yecho "Encoding will resume in 5 seconds..."
182
- sleep 5s
183
+ sleep 5
184
fi
185
# Deinterlacing for ffmpeg
186
FF_ILACE="-deinterlace"
187
188
fi
189
190
# ffmpeg's -vf aspect is more dependable than -aspect, if ffmpeg is new enough
191
-FF_FILTERS=$(ffmpeg -filters 2>&1)
192
+FF_FILTERS=$($FFmpeg -filters 2>&1)
193
# newer ffmpeg's use setdar= and setsar=
194
-if grep -qw ^setdar <<< "$FF_FILTERS"; then
195
+if grep -qw setdar <<< "$FF_FILTERS"; then
196
FF_ASPECT="setdar="
197
# somewhat older rev's used aspect=
198
elif grep -qw ^aspect <<< "$FF_FILTERS"; then
199
200
FF_ASPECT='-aspect '
201
tovid-0.34.tar.bz2/src/set_chapters -> tovid-0.35.tar.gz/src/set_chapters
Changed
37
1
2
3
import sys
4
import Tkinter as tk
5
-from libtovid.guis.helpers import SetChapters
6
+from libtovid.guis.helpers import SetChaptersGui
7
from os import path
8
9
if len(sys.argv) < 2:
10
- print("Usage: set_chapters.py video")
11
- exit()
12
-
13
-video = sys.argv[1]
14
-if not path.exists(video):
15
- print('Error: %s does not exist' %video)
16
- exit()
17
-
18
-def print_chapters():
19
- if app.get_chapters():
20
- sys.stdout.write(app.get_chapters() + '\n')
21
+ video = None
22
+else:
23
+ video = sys.argv[1]
24
+ if not path.exists(video):
25
+ print('Error: the video file "%s" does not exist' %video)
26
+ exit()
27
28
root = tk.Tk()
29
-app = SetChapters(root, '-menu', 'Mplayer', print_chapters, style='standalone')
30
+app = SetChaptersGui(root, '-osdlevel 3', 'Set chapter points with Mplayer')
31
app.run(video)
32
app.pack()
33
34
-root.mainloop()
35
+app.mainloop()
36
37
tovid-0.34.tar.bz2/src/titleset-wizard -> tovid-0.35.tar.gz/src/titleset-wizard
Changed
201
1
2
3
import os.path
4
import shlex
5
-import commands
6
-import tkFont
7
import re
8
-from Tkinter import *
9
-from tkMessageBox import *
10
-from tkSimpleDialog import askstring
11
-from tkFileDialog import asksaveasfilename
12
-from subprocess import Popen, PIPE
13
-from libtovid.metagui import Style
14
-from libtovid.metagui.support import PrettyLabel, show_icons, get_photo_image
15
-from libtovid.cli import _enc_arg, Command
16
-from libtovid.util import trim
17
from time import sleep
18
from tempfile import mktemp
19
from sys import argv, exit
20
from base64 import b64encode
21
from copy import deepcopy
22
-
23
-class Wizard(Frame):
24
- """A frame to hold the wizard pages. It will also hold the commands
25
- that will be processed and written out as a script. Its base frame
26
- holds a frame common to all pages that displays an icon, title, and
27
- status panel. It also has a bottom frame that contains the [Next] and
28
- [Exit] buttons. It will hold a list of all of the wizard pages.
29
+from subprocess import Popen, PIPE
30
+from libtovid import xrange
31
+from libtovid.cli import _enc_arg, Command
32
+from libtovid.util import trim
33
+from libtovid.metagui import Style
34
+from libtovid.metagui.support import (
35
+ PrettyLabel, show_icons, get_photo_image
36
+)
37
+
38
+# Python 3 compatibility
39
+try:
40
+ import Tkinter as tk
41
+ import tkFont
42
+ from tkSimpleDialog import askstring
43
+ from tkFileDialog import asksaveasfilename
44
+ from commands import getoutput, getstatusoutput
45
+ from tkMessageBox import (
46
+ askyesno, showwarning, showinfo, showerror, askokcancel
47
+ )
48
+except ImportError:
49
+ import tkinter as tk
50
+ import tkinter.font as tkFont
51
+ from tkinter.simpledialog import askstring
52
+ from tkinter.filedialog import asksaveasfilename
53
+ from subprocess import getoutput, getstatusoutput
54
+ from tkinter.messagebox import (
55
+ askyesno, showwarning, showinfo, showerror, askokcancel
56
+ )
57
+
58
+def get_screen_info(icon):
59
+ """Get window manager's title bar height and screen height.
60
+ This function masquerades as a progress bar.
61
+ winfo_? includes the top panel if it exists, xwininfo just the titlebar.
62
+ Returns tuple: screen h, deco w, deco h.
63
+ """
64
+ try:
65
+ import Tix
66
+ # Python 3
67
+ except ImportError:
68
+ import tkinter.tix as Tix
69
+ import time
70
+ r = Tix.Tk()
71
+ r.withdraw()
72
+ top = Tix.Toplevel(r)
73
+ top.title('Loading ...')
74
+ top.geometry('+0+0')
75
+ show_icons(top, icon)
76
+ top.update_idletasks()
77
+ p = Tix.Meter(top, value=0.0)
78
+ p.pack()
79
+ for i in range(100):
80
+ time.sleep(0.01)
81
+ p.configure(value=(i/100.0))
82
+ p.update_idletasks()
83
+ xid = top.wm_frame()
84
+ # xwininfo returns a geometry string like '+2+23': split it on '+'
85
+ # it tends to give just window decoration h, w rather than including a panel
86
+ Xwininfo = \
87
+ getoutput("xwininfo -frame -id %s |awk '/Corners:/ {print $2}'" %xid)
88
+ X_x = Xwininfo.split('+')[1]
89
+ X_y = Xwininfo.split('+')[2]
90
+ # winfo_x() winfo_y() tend to give panel AND window decoration
91
+ TK_x = top.winfo_x()
92
+ TK_y = top.winfo_y()
93
+ # so subtract the xwininfo x dimension from winfo_x; same for the y dimensions
94
+ # if xwininfo gives a lesser value, assume it just window deco, and subtract it
95
+ # else default to the greater (or equal) value of winfo_x (same for y dimension)
96
+ if TK_x > int(X_x):
97
+ frame_width = TK_x - int(X_x)
98
+ else:
99
+ frame_width = TK_x
100
+ if TK_y > int(X_y):
101
+ frame_height = TK_y - int(X_y)
102
+ else:
103
+ frame_height = TK_y
104
+ screeninfo = top.winfo_screenheight(), frame_width, frame_height
105
+ r.destroy()
106
+ return screeninfo
107
+
108
+
109
+
110
+class Wizard(tk.Frame):
111
+ """A frame to hold the wizard pages.
112
+ It will also hold the commands that will be processed and written out
113
+ as a script. Its base frame holds a frame common to all pages that
114
+ displays an icon, title, and status panel. It also has a bottom frame
115
+ that contains the [Next] and [Exit] buttons.
116
+ It will hold a list of all of the wizard pages.
117
118
master: the Tk() instance called by __main__
119
- icon: Path to an image file (gif) to display on the left frame
120
text: The text for the wizard title above and/or below the icon
121
Use \n to break title into above\nbelow.
122
+ icon: Path to an image file (gif) to display on the left frame
123
+ infile: an infile provided as a saved project, that will be loaded
124
125
"""
126
- def __init__(self, master, text, icon):
127
- Frame.__init__(self, master)
128
+ def __init__(self, master, text, icon, infile=''):
129
+ tk.Frame.__init__(self, master)
130
self.pages = []
131
- self.index = IntVar()
132
+ self.index = tk.IntVar()
133
self.text = text
134
self.icon = icon
135
self.master = master
136
self.root = self._root()
137
self.commands = []
138
+ self.screen_info = []
139
# for cancelling run_gui if exit is called
140
- self.is_running = BooleanVar()
141
+ self.is_running = tk.BooleanVar()
142
self.is_running.set(True)
143
# for waiting on [Next>>>] being pushed to continue titleset loop
144
- self.waitVar = BooleanVar()
145
+ self.waitVar = tk.BooleanVar()
146
self.waitVar.set(False)
147
- # pid for xterm, to allow clean exit
148
- # need this to make sure we don't have zombie processes
149
- self.xterm_is_running = BooleanVar()
150
- self.check = ''
151
- self.xterm_is_running.set(False)
152
+ # variable for name of final script
153
+ self.project = ''
154
+ # variable for possible pre-loaded script -
155
+ self.is_infile = False
156
# bindings for exit
157
self.root.protocol("WM_DELETE_WINDOW", self.confirm_exit)
158
self.root.bind('<Control-q>', self.confirm_exit)
159
self.root.title('Tovid titleset wizard')
160
161
# button frame
162
- self.button_frame = Frame(master)
163
+ self.button_frame = tk.Frame(master)
164
self.button_frame.pack(side='bottom', fill='x', expand=1, anchor='se')
165
- self.exit_button = Button(self.button_frame, text='Exit',
166
+ self.exit_button = tk.Button(self.button_frame, text='Exit',
167
command=self.confirm_exit)
168
self.exit_button.pack(side='left', anchor='sw')
169
- self.next_button = Button(self.button_frame, text='Next >>',
170
+ self.next_button = tk.Button(self.button_frame, text='Next >>',
171
command=self.next)
172
self.next_button.pack(side='right', anchor='se')
173
- self.prev_button = Button(self.button_frame, text='<< Back',
174
+ self.prev_button = tk.Button(self.button_frame, text='<< Back',
175
command=self.previous)
176
# frame for icon and status display
177
- self.frame1 = Frame(master)
178
+ self.frame1 = tk.Frame(master)
179
self.frame1.pack(side='left', anchor='nw', padx=10, pady=80)
180
inifile = os.path.expanduser('~/.metagui/config')
181
style = Style()
182
- style.load(inifile)
183
+ # make sure ~/.metagui and the config file exist
184
+ if os.path.exists(inifile):
185
+ style.load(inifile)
186
+ print("Loading style from config file: '%s'" % inifile)
187
+ else:
188
+ print("Creating config file: '%s'" % inifile)
189
+ style.save(inifile)
190
self.font = style.font
191
self.draw()
192
193
+ # if a script is being loaded (infile), then assign to self.project
194
+ if infile:
195
+ self.is_infile = True
196
+ self.project = infile
197
+
198
def draw(self):
199
# get fonts
200
font = self.font
201
tovid-0.34.tar.bz2/src/todisc -> tovid-0.35.tar.gz/src/todisc
Changed
201
1
2
#
3
# Project homepage: http://tovid.wikia.com
4
#
5
-# Copyright (C) 2005-2010
6
+# Copyright (C) 2005-2015
7
#
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU General Public License
10
11
# grepper on irc.freenode.net
12
13
SCRIPT_NAME=`cat << EOF
14
+
15
--------------------------------
16
tovid disc
17
-Generate a DVD filesystem with animated thumbnail menus
18
+Generate a DVD file-system with optional menus, from a list of multimedia files.
19
+Menus can be moving or static thumbnails, or text. Encoding done automatically.
20
+
21
Version $TOVID_VERSION
22
$TOVID_HOME_PAGE
23
--------------------------------
24
+
25
EOF`
26
27
USAGE=`cat << EOF
28
Usage:
29
-
30
- todisc [OPTIONS] \\\\
31
- -files File1.mpg File2.mpg ... \\\\
32
+ tovid disc [OPTIONS] \\\\
33
+ -files File1.mpg File2.avi ... \\\\
34
-titles "Title 1" "Title 2" ... \\\\
35
- -out OUT_PREFIX
36
+ -menu-title "Tovid Demo" \\\\
37
+ -out OUT_DIRECTORY
38
39
You can also do slideshows using -slides IMAGES rather than -files VIDEOS
40
+General Options:
41
+ -no-ask, -no-warn, -keep-files, -jobs, -grid, -no-confirm-backup
42
+Other quick examples:
43
+Create 'text menu' DVD filesystem:
44
+ tovid disc -text-menu -files ... -titles .. -out OUT_DIRECTORY
45
+Create DVD filesystem with no menu, encoding with ffmpeg and prompt for burn:
46
+ tovid disc -files *.mp4 -ffmpeg -no-menu -burn -out OUT_DIRECTORY
47
+Create DVD compatible mpeg2 files using makempg (and ffmpeg) and then quit:
48
+ tovid disc -encode-only -ffmpeg -quality 8 -files *.avi (no -out required)
49
See the tovid manual page ('man tovid') for additional documentation.
50
51
EOF`
52
# check that needed todisc deps are installed
53
assert_dep "$todisc_deps"
54
assert_dep strings "'strings' is part of binutils. In most distros the package
55
-is called by the same name. http://www.gnu.org/software/binutils/ ."
56
+is called binutils. http://www.gnu.org/software/binutils/ ."
57
SCRIPT_START_TIME=`date +%s`
58
59
# check if symlink in /tmp exists and use time stamped link if so
60
WORK_DIR="/tmp/todisc-work"
61
62
LOG_FILE=$(readlink -f todisc.log)
63
-OUT_PREFIX=""
64
+OUT_DIRECTORY=""
65
TV_STANDARD=ntsc
66
PIXEL_AR="10:11"
67
MENU_LEN=( 20 )
68
69
SUBMENU_LEN=(10)
70
MAX_MENU_LEN=""
71
TARGET=dvd
72
-FRAME_RATE=29.970
73
+FRAME_RATE=29.970 # for bc. mjpegtools and transcode convert this to 30000/1001
74
+ff_frame_rate="30000/1001" # ffmpeg needs to be explicitly told exact framerate
75
VIDSIZE=720x480
76
+VF_SCALE=${VIDSIZE%x*}:${VIDSIZE#*x}
77
MENU_TITLE="My Video Collection"
78
STATIC=false
79
SUB_MENU=false
80
81
SM_TITLE_CLR="#EAEAEA"
82
THUMB_BG_CLR=white
83
TITLES_CLR=""
84
-BUTTON_STYLE="rect"
85
+BUTTON_STYLE="line"
86
MIST_COLOUR=white
87
MIST_OPACITY=60
88
-TITLE_STROKE=""
89
+M_TITLE_STROKE=""
90
SUBMENU_STROKE="none"
91
BG_AUDIO=""
92
BG_PIC=""
93
94
USER_SM_AUDIO_SEEK=false
95
SC_THUMB=:
96
TEXTMENU=false
97
-SC_TITLE_ALIGN=center
98
-THUMB_TITLE_ALIGN=center
99
+SC_TITLE_ALIGN="center"
100
+EDGE_JUSTIFY=false
101
ALIGN_OVERRIDE=false
102
MULTILINE_TITLE=false
103
SAFE_AREA=50 # undocumented: you can set this from CLI with -showcase-safe-area
104
-SAFE_OFFSET=36
105
+SAFE_OFFSET=0 # we only add this offset if center title align, to keep onscreen
106
ASPECT_RATIO=4:3
107
AR=1.333
108
ASPECT_ARG=all
109
WIDE_SCREEN=false
110
WIDESCREEN="nopanscan"
111
+GROUP_ARR=""
112
GROUPING=false
113
TEXT_YSTART=$SAFE_AREA
114
BUTTON_GRAVITY=north
115
XGEO=0
116
YGEO=45
117
USER_GRAVITY=false
118
-USER_GEO=false
119
USER_SPLIT=false
120
TITLE_GRAVITY=south
121
SPACER=15
122
123
USER_AUDIOLENGTH=false
124
BURN=false
125
EJECT=''
126
+BURN_PROG="makedvd"
127
BURN_DEVICE="/dev/dvdrw"
128
QUICK_MENU=false
129
BG_CLR='#101010'
130
131
JUSTIFY="center"
132
CONTRAST_CLR='gray'
133
NOMENU=false
134
+ENCODE_ONLY=false
135
SC_AR=133
136
THUMB_COLUMNS=""
137
FAST_SEEK=false # ffmpeg: default:decode during seek (more accurate but slower)
138
USER_THUMBS=false # is user providing images for the menu link thumbs ?
139
-FRAME_SAFE=false # (-static) if true take the best of 9 frames. default: 1 frame
140
-PIPE_FORMAT="-pix_fmt yuv420p -f yuv4mpegpipe"
141
+FRAME_SAFE=false # (-static) if true take the best of 9 frames. default 1 frame
142
+USE_V_TITLES_DECO=false
143
+USE_M_TITLE_DECO=false
144
+PIPE_FORMAT=""
145
IMG_DEPTH="-depth 8" # when converting to png: ppmtoy4m needs 8 bit
146
+AUDIO_EXT="ac3"
147
+SAMPLERATE="48000"
148
+AUDIO_OPTS="-ab 224k -ar $SAMPLERATE -acodec $AUDIO_EXT"
149
+MPLEX_FORMAT="8"
150
+FROM_GUI=false # needed to disable tput (colour output) in GUI
151
TOVID_PREFIX=$(tovid -prefix)
152
+use_transcode=:
153
+yuv_correct="yuvcorrect -T NO_HEADER"
154
155
##############################################################################
156
# Functions #
157
##############################################################################
158
159
-# Y-echo: echo to two places at once (stdout and logfile)
160
+# Y-echo: print to two places at once (stdout and logfile)
161
# Output is preceded by the script name that produced it
162
# Args: $@ == any text string
163
-# If no args are given, echo a separator bar
164
+# If no args are given, print a separator bar
165
+# If empty string is the arg, print a newline
166
# Use yecho if you want output to go to the logfile
167
yecho()
168
{
169
- if test $# -eq 0; then
170
+ # arg supplied but empty (""): just print a newline
171
+ if [[ "${1+defined}" && -z $1 ]]; then
172
+ printf "\n"
173
+ [[ -e "$LOG_FILE" ]] && printf "\n" >> "$LOG_FILE"
174
+ # no arg supplied at all, just 'yecho': print \n[todisc]:\n
175
+ elif test $# -eq 0; then
176
printf "\n%s\n\n" "$SEPARATOR"
177
# If logfile exists, copy output to it (with pretty formatting)
178
test -e "$LOG_FILE" && \
179
180
fold -bs >> "$LOG_FILE"
181
fi
182
}
183
-# ******************************************************************************
184
-# Execute the given command-line string, with appropriate stream redirection
185
-# Args: $@ == text string containing complete command-line
186
-# Returns: Exit status of the subprocess
187
-# To filter/prettify the subprocess output before writing it to the log file,
188
-# set the LOG_FILTER variable before calling this function, to e.g.
189
-# LOG_FILTER="sed 's/\r/\r\n/g'" # Replace LF with CR/LF
190
-# ******************************************************************************
191
192
# Print script name, usage notes, and optional error message, then exit.
193
# Args: $@ == text string(s) containing error message and help
194
195
fi
196
exit 1
197
}
198
-warning_message()
199
+
200
+# Usage: continue_in [SECONDS]
201
tovid-0.34.tar.bz2/src/todisc-fade-routine -> tovid-0.35.tar.gz/src/todisc-fade-routine
Changed
10
1
2
#
3
# Project homepage: http://tovid.wikia.com
4
#
5
-# Copyright (C) 2005-2010
6
+# Copyright (C) 2005-2015
7
#
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU General Public License
10
tovid-0.34.tar.bz2/src/todiscgui -> tovid-0.35.tar.gz/src/todiscgui
Changed
23
1
2
import sys
3
from libtovid.guis import todisc
4
5
+command = []
6
+position = ''
7
+project = ''
8
if __name__ == '__main__':
9
- todisc.run(sys.argv[1:])
10
+ args = sys.argv[1:]
11
+ while args:
12
+ arg = args.pop(0)
13
+ # if passing --position pop next arg as well
14
+ if arg in ['--position', '-position']:
15
+ position = args.pop(0)
16
+ elif arg in ['--project', '-project']:
17
+ project = args.pop(0)
18
+ else:
19
+ # if --position or --project not passed, all args append to command
20
+ command.append(arg)
21
+ todisc.run(command, position=position, project=project)
22
23
tovid-0.34.tar.bz2/src/tovid -> tovid-0.35.tar.gz/src/tovid
Changed
136
1
2
-#! /usr/bin/env python
3
+#!/usr/bin/python
4
# tovid.py
5
6
"""Frontend to the tovid suite.
7
8
9
Where 'command' is one of the following:
10
11
- Command Description Formerly
12
- -----------------------------------------------------------------
13
- id Identify one or more video files idvid
14
- dvd Author and/or burn a DVD makedvd
15
- menu Create an MPEG menu makemenu
16
- vcd Author and/or burn a VCD makevcd
17
- xml Create (S)VCD or DVD .xml file makexml
18
- postproc Post-process an MPEG video file postproc
19
- disc Create a DVD with menus todisc
20
- gui Start the tovid GUI todiscgui
21
- mpg Encode videos to MPEG format tovid
22
- titlesets Start the titleset wizard (new)
23
- chapters Set video chapter points with mplayer (new)
24
+ Main commands (one step DVD creation)
25
+
26
+ Command Description Formerly
27
+ -----------------------------------------------------------------------
28
+ disc Options to encode, make menus, author and burn todisc
29
+ gui Start the tovid GUI todiscgui
30
+ titlesets Start the titleset wizard GUI (new)
31
+
32
+
33
+ Helper commands (used by 'Main commands' or run standalone)
34
+
35
+ Command Description Formerly
36
+ -----------------------------------------------------------------------
37
+ mpg Encode videos to MPEG format tovid
38
+ id Identify one or more video files idvid
39
+ dvd Author and/or burn a DVD makedvd
40
+ chapters A GUI to set chapter points with mplayer (new)
41
+
42
43
The following general options are also available:
44
--prefix | -prefix Return the tovid install prefix
45
46
import time
47
import shlex
48
import shutil
49
-from ConfigParser import ConfigParser
50
+# python 3 compatibility
51
+try:
52
+ from ConfigParser import ConfigParser
53
+except ImportError:
54
+ from configparser import ConfigParser
55
56
# Command names to script mappings
57
_scripts = {
58
'id': 'idvid',
59
'dvd': 'makedvd',
60
- 'menu': 'makemenu',
61
- 'vcd': 'makevcd',
62
- 'xml': 'makexml',
63
- 'postproc': 'postproc',
64
'disc': 'todisc',
65
'gui': 'todiscgui',
66
'mpg': 'makempg',
67
68
"""Return the tovid version string.
69
"""
70
tovid_init = self.script_dir + '/tovid-init'
71
- cmd = shlex.split("bash -c '. %s && printf $TOVID_VERSION'" % tovid_init)
72
- return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
73
+ # can't just source tovid-init to get TOVID_VERSION - sourcing may fail
74
+ cmd = shlex.split("awk -F= '/^TOVID_VERSION/ {print $2}' %s" % tovid_init)
75
+ result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
76
+ # Python 3 needs decode("utf-8") as it returns a byte string not str
77
+ return result.decode("utf-8").replace('"', '').strip()
78
79
80
def parse_options(self, args):
81
82
arg = args.pop(0)
83
84
if arg in ['-prefix', '--prefix']:
85
- print self.prefix
86
+ print(self.prefix)
87
sys.exit(0)
88
89
elif arg in ['-version', '--version']:
90
- print self.version
91
+ print(self.version)
92
sys.exit(0)
93
94
elif arg in ['-info', '--info']:
95
96
return
97
98
# Create ~/.tovid if it doesn't exist already
99
- user_tovid_dir = os.path.expanduser('~/.tovid')
100
- if not os.path.exists(user_tovid_dir):
101
- print("Creating '%s'" % user_tovid_dir)
102
- os.mkdir(user_tovid_dir)
103
-
104
+ # honour TOVID_HOME environment variable
105
+ self.user_tovid_dir = os.getenv('TOVID_HOME') or os.path.expanduser('~/.tovid')
106
+ #user_tovid_dir = os.path.expanduser('~/.tovid')
107
+
108
+ if not os.path.exists(self.user_tovid_dir):
109
+ try:
110
+ os.mkdir(self.user_tovid_dir)
111
+ print("Creating '%s'" % self.user_tovid_dir)
112
+ except OSError:
113
+ print("Cannot create %s, exiting ..." %self.user_tovid_dir)
114
+ sys.exit(1)
115
# Copy default tovid.ini to ~/.tovid if it doesn't exist already
116
- user_tovid_ini = os.path.join(user_tovid_dir, 'tovid.ini')
117
- if not os.path.exists(user_tovid_ini):
118
- print("Creating '%s'" % user_tovid_ini)
119
- shutil.copy(default_tovid_ini, user_tovid_ini)
120
+ self.user_tovid_ini = os.path.join(self.user_tovid_dir, 'tovid.ini')
121
+ if not os.path.exists(self.user_tovid_ini):
122
+ print("Creating '%s'" % self.user_tovid_ini)
123
+ shutil.copy(default_tovid_ini, self.user_tovid_ini)
124
125
126
def get_config_options(self, command):
127
"""Return any options found in ~/.tovid/tovid.ini for the given command.
128
"""
129
# Parse the user's tovid.ini file
130
- filename = os.path.expanduser('~/.tovid/tovid.ini')
131
+ #filename = os.path.expanduser('~/.tovid/tovid.ini')
132
+ filename = self.user_tovid_ini
133
config = ConfigParser()
134
config.read(filename)
135
# If no [command] section exists, or if there's no 'options' setting,
136
tovid-0.34.tar.bz2/src/tovid-init -> tovid-0.35.tar.gz/src/tovid-init
Changed
185
1
2
#
3
# Project homepage: http://tovid.wikia.com
4
#
5
-# Copyright (C) 2005-2010
6
+# Copyright (C) 2005-2014
7
#
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU General Public License
10
11
#set -u
12
13
# Suite version
14
-TOVID_VERSION="0.34"
15
+TOVID_VERSION="0.35"
16
17
# String used to separate blocks of output
18
SEPARATOR="========================================================="
19
20
TOVID_HOME="$HOME/.tovid"
21
TOVID_HOME_PAGE="http://tovid.wikia.com"
22
TOVID_FORUMS="http://groups.google.com/group/tovid-users"
23
-
24
+TOVID_ISSUES="http://code.google.com/p/tovid/issues/list"
25
26
# ******************************************************************************
27
# ******************************************************************************
28
29
# ******************************************************************************
30
# Take a string containing a time (like "02:15:25.3") and
31
# format it as an integer number of seconds. Fractional seconds
32
-# are truncated. Result is echoed to stdout, so to use the output
33
-# as a "return value", call the function like this:
34
-# RETURN_VALUE=$(unformat_time $TIME_STRING)
35
+# are truncated. Result is echoed to stdout, so to use the output you can
36
+# call the function like this: var=$(unformat_time $TIME_STRING)
37
# ******************************************************************************
38
function unformat_time()
39
{
40
41
else
42
TOT_SECONDS=$1
43
fi
44
- echo $TOT_SECONDS
45
+ if [[ -n $2 && $2 = "int" ]]; then
46
+ echo ${TOT_SECONDS%%.*}
47
+ else
48
+ echo $TOT_SECONDS
49
+ fi
50
}
51
52
# *****************************************************************************
53
54
# Wait for input file to appear
55
# After a 30-second timeout, exit gracefully
56
CUR_TIME=30
57
- while test $CUR_TIME -gt 0; do
58
+ while test $CUR_TIME -gt 0; do
59
+ sleep 3
60
# If file exists, wait a few more seconds, then break out
61
if test -e "$FOP_OUTFILE"; then
62
- printf "Processing started. Please wait... "
63
- sleep 3s
64
+ $QUIET || printf "Processing started. Please wait... "
65
+ sleep 1
66
+ CUR_TIME=1
67
break
68
fi
69
printf "Waiting $CUR_TIME seconds for output file \"$FOP_BASENAME_NAME\" to appear...\r"
70
- sleep 1s
71
+ sleep 1
72
CUR_TIME=$(expr $CUR_TIME - 1)
73
done
74
75
76
77
# Doze a bit to let the file size increase
78
# (SLEEP_TIME defaults to 1s if unset)
79
- sleep ${SLEEP_TIME-"1s"}
80
+ sleep ${SLEEP_TIME-"1"}
81
82
FOP_LAST_SIZE=$FOP_CUR_SIZE
83
FOP_CUR_SIZE=$(du -b "$FOP_OUTFILE" | awk '{print $1}')
84
done
85
- printf "\n\n"
86
+ $QUIET && printf "\n" || printf "\n\n"
87
}
88
89
# ******************************************************************************
90
91
count=$(seq 1 $LAST)
92
for _CNTR in $(sort -nr <<< "$count")
93
do
94
- echo -n -e " in $_CNTR seconds...\r";
95
- sleep 1s;
96
+ echo -n -e " in $_CNTR seconds...or press <ENTER>\r";
97
+ read -t 1 && break;
98
done
99
}
100
101
102
done
103
return 0
104
}
105
-
106
+# *****************************************************************************
107
+# takes 1 arg: [name to prefix each line of output]
108
+# uses stdbuf (coreutils) if present so stdin is line buffered
109
+send_to_log()
110
+{
111
+ [[ $1 ]] && prog_name="[$1]: " || prog_name="[${0##*/}]: "
112
+ $std_buf tr "\015" "\n" < /dev/stdin | \
113
+ while read line; do
114
+ printf "%s %s\n" "$prog_name" "$line"
115
+ done
116
+ printf "\n"
117
+}
118
119
# ******************************************************************************
120
#
121
122
KERNEL=$(uname)
123
if test "$KERNEL" = "Linux"; then
124
# Linux should have /proc/cpuinfo
125
- CPU_MODEL=$(awk -F ":" '/model name/ {print $2}' /proc/cpuinfo | head -n 1)
126
+ CPU_MODEL=$(awk -F ":" '/model name/ {print $2}' \
127
+ /proc/cpuinfo | head -n 1 | sed 's/^ *//g')
128
CPU_SPEED=$(awk 'BEGIN { IGNORECASE = 1 } /MHz/ { print $4 }' /proc/cpuinfo | head -n 1)
129
# Test for multiple CPUs. If they are available, try to use them.
130
if test $(grep "^processor" /proc/cpuinfo | wc -l) -ge "2"; then
131
132
# tovid preferences
133
# Configures working directory for all scripts and
134
# output directory for the makempg script
135
+# also used for setting ffmpeg/avconv program
136
#WORKING_DIR=/tmp
137
#OUTPUT_DIR=/video/outfiles
138
+#TOVID_FFMPEG=ffmpeg
139
EOF`
140
printf "$PREFS_CONTENTS\n" > "$USER_PREFS"
141
fi
142
# if preferences vars are set in the environment, use those (takes precedence).
143
[[ $TOVID_WORKING_DIR ]] && WORKING_DIR="$TOVID_WORKING_DIR"
144
[[ $TOVID_OUTPUT_DIR ]] && OUTPUT_DIR="$TOVID_WORKING_DIR"
145
+[[ $TOVID_FFMPEG_CMD ]] && TOVID_FFMPEG="$TOVID_FFMPEG_CMD"
146
+# FFmpeg and FFprobe are vars used for ffmpeg by scripts needing ffmpeg/avconv
147
+# if avconv is installed, use that unless env var set
148
+hash avconv 2>/dev/null && TOVID_FFMPEG=${TOVID_FFMPEG:-avconv}
149
+hash avprobe 2>/dev/null && TOVID_FFPROBE=${TOVID_FFPROBE:=avprobe}
150
+# finally, default to ffmpeg if non of the above override it
151
+FFmpeg=${TOVID_FFMPEG:=ffmpeg}
152
+[[ $FFmpeg =~ ffmpeg ]] && TOVID_FFPROBE=ffprobe
153
+[[ $FFmpeg =~ avconv ]] && TOVID_FFPROBE=avprobe
154
+FFprobe=${TOVID_FFPROBE:=ffprobe}
155
+
156
+# stdbuf (coreutils>=7.5) is useful to todisc and makempg, use it if present
157
+hash stdbuf 2>/dev/null && std_buf="stdbuf -oL" || std_buf=""
158
159
# ******************************************************************************
160
# Check for run-time dependencies
161
162
# *************************************************************************
163
# Required Dependencies
164
# *************************************************************************
165
- core="grep sed md5sum mplayer mencoder mplex mpeg2enc yuvfps yuvdenoise ppmtoy4m mp2enc jpeg2yuv ffmpeg"
166
+ core="grep sed md5sum mplayer mplex mpeg2enc yuvfps yuvdenoise ppmtoy4m mp2enc jpeg2yuv"
167
168
# *************************************************************************
169
# Optional Dependencies
170
171
172
# -------------------------------------------------------------------------
173
# todisc dependencies
174
- todisc_deps="$magick mogrify spumux dvdauthor transcode sox"
175
+ todisc_deps="$magick mogrify spumux dvdauthor sox"
176
177
# Quit and complain if ANY core dependency is missing.
178
assert_dep "$core" "You are missing CORE tovid dependencies!"
179
+ # ffmpeg is also a part of core deps, but is taken care of here
180
+ ffmpeg_alts="Use either ffmpeg (ffmpeg.org) or avconv (libav.org)."
181
+ ffmpeg_pref="Set choice in ${USER_PREFS}. As in: TOVID_FFMPEG=ffmpeg"
182
+ assert_dep $FFmpeg "You are missing $FFmpeg ! $ffmpeg_alts ${ffmpeg_pref}."
183
184
# End tovid-init
185
tovid-0.34.tar.bz2/src/tovid-init.in -> tovid-0.35.tar.gz/src/tovid-init.in
Changed
176
1
2
#
3
# Project homepage: http://tovid.wikia.com
4
#
5
-# Copyright (C) 2005-2010
6
+# Copyright (C) 2005-2014
7
#
8
# This program is free software; you can redistribute it and/or
9
# modify it under the terms of the GNU General Public License
10
11
TOVID_HOME="$HOME/.tovid"
12
TOVID_HOME_PAGE="http://tovid.wikia.com"
13
TOVID_FORUMS="http://groups.google.com/group/tovid-users"
14
-
15
+TOVID_ISSUES="http://code.google.com/p/tovid/issues/list"
16
17
# ******************************************************************************
18
# ******************************************************************************
19
20
# ******************************************************************************
21
# Take a string containing a time (like "02:15:25.3") and
22
# format it as an integer number of seconds. Fractional seconds
23
-# are truncated. Result is echoed to stdout, so to use the output
24
-# as a "return value", call the function like this:
25
-# RETURN_VALUE=$(unformat_time $TIME_STRING)
26
+# are truncated. Result is echoed to stdout, so to use the output you can
27
+# call the function like this: var=$(unformat_time $TIME_STRING)
28
# ******************************************************************************
29
function unformat_time()
30
{
31
32
else
33
TOT_SECONDS=$1
34
fi
35
- echo $TOT_SECONDS
36
+ if [[ -n $2 && $2 = "int" ]]; then
37
+ echo ${TOT_SECONDS%%.*}
38
+ else
39
+ echo $TOT_SECONDS
40
+ fi
41
}
42
43
# *****************************************************************************
44
45
# Wait for input file to appear
46
# After a 30-second timeout, exit gracefully
47
CUR_TIME=30
48
- while test $CUR_TIME -gt 0; do
49
+ while test $CUR_TIME -gt 0; do
50
+ sleep 3
51
# If file exists, wait a few more seconds, then break out
52
if test -e "$FOP_OUTFILE"; then
53
- printf "Processing started. Please wait... "
54
- sleep 3s
55
+ $QUIET || printf "Processing started. Please wait... "
56
+ sleep 1
57
+ CUR_TIME=1
58
break
59
fi
60
printf "Waiting $CUR_TIME seconds for output file \"$FOP_BASENAME_NAME\" to appear...\r"
61
- sleep 1s
62
+ sleep 1
63
CUR_TIME=$(expr $CUR_TIME - 1)
64
done
65
66
67
68
# Doze a bit to let the file size increase
69
# (SLEEP_TIME defaults to 1s if unset)
70
- sleep ${SLEEP_TIME-"1s"}
71
+ sleep ${SLEEP_TIME-"1"}
72
73
FOP_LAST_SIZE=$FOP_CUR_SIZE
74
FOP_CUR_SIZE=$(du -b "$FOP_OUTFILE" | awk '{print $1}')
75
done
76
- printf "\n\n"
77
+ $QUIET && printf "\n" || printf "\n\n"
78
}
79
80
# ******************************************************************************
81
82
count=$(seq 1 $LAST)
83
for _CNTR in $(sort -nr <<< "$count")
84
do
85
- echo -n -e " in $_CNTR seconds...\r";
86
- sleep 1s;
87
+ echo -n -e " in $_CNTR seconds...or press <ENTER>\r";
88
+ read -t 1 && break;
89
done
90
}
91
92
93
done
94
return 0
95
}
96
-
97
+# *****************************************************************************
98
+# takes 1 arg: [name to prefix each line of output]
99
+# uses stdbuf (coreutils) if present so stdin is line buffered
100
+send_to_log()
101
+{
102
+ [[ $1 ]] && prog_name="[$1]: " || prog_name="[${0##*/}]: "
103
+ $std_buf tr "\015" "\n" < /dev/stdin | \
104
+ while read line; do
105
+ printf "%s %s\n" "$prog_name" "$line"
106
+ done
107
+ printf "\n"
108
+}
109
110
# ******************************************************************************
111
#
112
113
KERNEL=$(uname)
114
if test "$KERNEL" = "Linux"; then
115
# Linux should have /proc/cpuinfo
116
- CPU_MODEL=$(awk -F ":" '/model name/ {print $2}' /proc/cpuinfo | head -n 1)
117
+ CPU_MODEL=$(awk -F ":" '/model name/ {print $2}' \
118
+ /proc/cpuinfo | head -n 1 | sed 's/^ *//g')
119
CPU_SPEED=$(awk 'BEGIN { IGNORECASE = 1 } /MHz/ { print $4 }' /proc/cpuinfo | head -n 1)
120
# Test for multiple CPUs. If they are available, try to use them.
121
if test $(grep "^processor" /proc/cpuinfo | wc -l) -ge "2"; then
122
123
# tovid preferences
124
# Configures working directory for all scripts and
125
# output directory for the makempg script
126
+# also used for setting ffmpeg/avconv program
127
#WORKING_DIR=/tmp
128
#OUTPUT_DIR=/video/outfiles
129
+#TOVID_FFMPEG=ffmpeg
130
EOF`
131
printf "$PREFS_CONTENTS\n" > "$USER_PREFS"
132
fi
133
# if preferences vars are set in the environment, use those (takes precedence).
134
[[ $TOVID_WORKING_DIR ]] && WORKING_DIR="$TOVID_WORKING_DIR"
135
[[ $TOVID_OUTPUT_DIR ]] && OUTPUT_DIR="$TOVID_WORKING_DIR"
136
+[[ $TOVID_FFMPEG_CMD ]] && TOVID_FFMPEG="$TOVID_FFMPEG_CMD"
137
+# FFmpeg and FFprobe are vars used for ffmpeg by scripts needing ffmpeg/avconv
138
+# if avconv is installed, use that unless env var set
139
+hash avconv 2>/dev/null && TOVID_FFMPEG=${TOVID_FFMPEG:-avconv}
140
+hash avprobe 2>/dev/null && TOVID_FFPROBE=${TOVID_FFPROBE:=avprobe}
141
+# finally, default to ffmpeg if non of the above override it
142
+FFmpeg=${TOVID_FFMPEG:=ffmpeg}
143
+[[ $FFmpeg =~ ffmpeg ]] && TOVID_FFPROBE=ffprobe
144
+[[ $FFmpeg =~ avconv ]] && TOVID_FFPROBE=avprobe
145
+FFprobe=${TOVID_FFPROBE:=ffprobe}
146
+
147
+# stdbuf (coreutils>=7.5) is useful to todisc and makempg, use it if present
148
+hash stdbuf 2>/dev/null && std_buf="stdbuf -oL" || std_buf=""
149
150
# ******************************************************************************
151
# Check for run-time dependencies
152
153
# *************************************************************************
154
# Required Dependencies
155
# *************************************************************************
156
- core="grep sed md5sum mplayer mencoder mplex mpeg2enc yuvfps yuvdenoise ppmtoy4m mp2enc jpeg2yuv ffmpeg"
157
+ core="grep sed md5sum mplayer mplex mpeg2enc yuvfps yuvdenoise ppmtoy4m mp2enc jpeg2yuv"
158
159
# *************************************************************************
160
# Optional Dependencies
161
162
163
# -------------------------------------------------------------------------
164
# todisc dependencies
165
- todisc_deps="$magick mogrify spumux dvdauthor transcode sox"
166
+ todisc_deps="$magick mogrify spumux dvdauthor sox"
167
168
# Quit and complain if ANY core dependency is missing.
169
assert_dep "$core" "You are missing CORE tovid dependencies!"
170
+ # ffmpeg is also a part of core deps, but is taken care of here
171
+ ffmpeg_alts="Use either ffmpeg (ffmpeg.org) or avconv (libav.org)."
172
+ ffmpeg_pref="Set choice in ${USER_PREFS}. As in: TOVID_FFMPEG=ffmpeg"
173
+ assert_dep $FFmpeg "You are missing $FFmpeg ! $ffmpeg_alts ${ffmpeg_pref}."
174
175
# End tovid-init
176
tovid-0.34.tar.bz2/src/tovid.ini -> tovid-0.35.tar.gz/src/tovid.ini
Changed
54
1
2
; command, you can specify one or more "default" options that will always be
3
; passed to the 'tovid' script when used with that command.
4
;
5
+; Note that in the [gui] section you should use only boolean options as others
6
+; may have trouble loading, particularly options that 'optionally' take args or
7
+; optionally take one or many args
8
+;
9
; You can include all your desired default options on a single line, like this:
10
;
11
; [mpg]
12
13
; -device /dev/hdb
14
; -speed 8
15
16
-[menu]
17
-options =
18
-; -dvd
19
-; -align center
20
-; -textcolor #FF0000
21
-; -overwrite
22
-
23
-[vcd]
24
-options =
25
-; -device /dev/hdb
26
-; -speed 24
27
-; -quiet
28
-
29
-[xml]
30
-options =
31
-; -overwrite
32
-; -quiet
33
-; -nochapters
34
-
35
-[postproc]
36
-options =
37
-; -parallel
38
-; -normalize
39
-
40
[disc]
41
options =
42
; -thumb-shape plectrum
43
44
45
[gui]
46
options =
47
-
48
+; -no-ask
49
+; -no-warn
50
+; -no-confirm-backup
51
+; -ffmpeg
52
+; -static
53
54
tovid-0.34.tar.bz2/tovidgui.desktop -> tovid-0.35.tar.gz/tovidgui.desktop
Changed
16
1
2
Exec=tovid gui
3
Icon=tovid
4
Terminal=false
5
-GenericName=DVD creation with menus
6
-GenericName[en_US]=DVD creation with menus
7
-Comment=Author videos to DVD with menus
8
-Comment[en_US]=Author videos to DVD with menus
9
+GenericName=DVD creation with optional menus
10
+GenericName[en_US]=DVD creation with optional menus
11
+Comment=Author videos to DVD with optional menus
12
+Comment[en_US]=Author videos to DVD with optional menus
13
Categories=AudioVideo;Video;
14
StartupNotify=true
15
X-KDE-SubstituteUID=false
16