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