remove oxframe, oxposterframe, own repos now, remove oxinfo, using ffmpeg2theora --info now

This commit is contained in:
j 2010-07-13 09:12:43 +02:00
parent 81e7abc443
commit 7cc9428916
4 changed files with 1 additions and 171 deletions

7
README
View file

@ -2,11 +2,9 @@ oxgt-tools
Tools Tools
oxframe oxframe
get frame from movie, image can be resized by adding --width or --height C version in its own repos at http://code.0x2620.org/oxframe/ now
oxtimeline oxtimeline
create timeline from video create timeline from video
oxinfo
output information about video, output can in xml, json or cfg format
oxposter oxposter
render 0xdb poster render 0xdb poster
oxicon oxicon
@ -22,6 +20,3 @@ Python API
timeline = oxgst.Timeline(videoFile) timeline = oxgst.Timeline(videoFile)
timeline.extract(timeline_prefix, width, height) timeline.extract(timeline_prefix, width, height)
info = oxgst.Info(videoFile)
info.metadata
{videoCodec:..}

View file

@ -1,58 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
# GPL 2008
import gobject
gobject.threads_init()
import os
import sys
from optparse import OptionParser
import pygst
pygst.require("0.10")
import gst
import Image
root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
if os.path.exists(os.path.join(root, 'oxgst')):
sys.path.insert(0, root)
from oxgst import Video
if __name__ == '__main__':
width = None
height = None
size = None
parser = OptionParser()
parser.add_option('-x', '--width', dest='width', help='scale image to given width')
parser.add_option('-y', '--height', dest='height', help='scale image to given height')
parser.add_option('-p', '--pos', dest='pos', help='frame position in seconds, float')
parser.add_option('-i', '--input', dest='input', help='video input')
parser.add_option('-o', '--output', dest='output', help='path to save frame to, jpg, png supported')
(opts, args) = parser.parse_args()
if None in (opts.input, opts.output, opts.pos):
parser.print_help()
sys.exit()
if opts.width:
width = int(opts.width)
if opts.height:
height = int(opts.height)
video = Video(opts.input)
timestamp = int(float(opts.pos) * gst.SECOND)
frame = video.frame(timestamp)
if frame:
if width:
height = int(float(frame.size[1])/frame.size[0] * width)
height = height + height%2
size = (width, height)
elif height:
width = int(float(frame.size[0])/frame.size[1] * height)
width = width + width%2
size = (width, height)
if size:
frame = frame.resize(size, Image.ANTIALIAS)
frame.save(opts.output)

View file

@ -1,48 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
# GPL 2009
import os
import sys
import Image
from optparse import OptionParser
import xml.etree.ElementTree as ET
root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
if os.path.exists(os.path.join(root, 'oxgst')):
sys.path.insert(0, root)
from oxgst import Info
if __name__ == "__main__":
parser = OptionParser()
parser.add_option('-f', '--format', dest='format', help='output format: cfg, json, xml default: cfg')
(opts, args) = parser.parse_args()
if not args:
parser.print_help()
sys.exit(1)
inputFile = args[0]
if not os.path.exists(inputFile):
sys.exit(1)
info = Info(inputFile)
if opts.format == 'xml':
xml = ET.Element("gstinfo")
el = ET.SubElement(xml, "path")
el.text = inputFile
for key in sorted(info):
el = ET.SubElement(xml, key)
el.text = unicode(info[key])
print u'<?xml version="1.0" encoding="utf-8"?>\n' + ET.tostring(xml).replace('><', '>\n <').replace(' </', '</')
elif opts.format == 'json':
import simplejson
info['path'] = inputFile
print simplejson.dumps(info).replace(', ', ',\n ')
else:
print "[%s]" % inputFile
for key in sorted(info):
print "%s = %s" % (key, info[key])

View file

@ -1,59 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
# GPL 2008
import os
import sys
from optparse import OptionParser
import pygst
pygst.require("0.10")
import gst
import Image
root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
if os.path.exists(os.path.join(root, 'oxgst')):
sys.path.insert(0, root)
from oxgst import Video
if __name__ == '__main__':
width = None
height = None
size = None
parser = OptionParser()
parser.add_option('-x', '--size', dest='size', help='scale image to size')
parser.add_option('-p', '--pos', dest='pos', help='frame position in seconds, float')
parser.add_option('-i', '--input', dest='input', help='video input')
parser.add_option('-o', '--output', dest='output', help='path to save frame to, jpg, png supported')
(opts, args) = parser.parse_args()
if None in (opts.input, opts.output, opts.pos):
parser.print_help()
sys.exit()
video = Video(opts.input)
timestamp = int(float(opts.pos) * gst.SECOND)
frame = video.frame(timestamp)
if frame:
width = frame.size[0]
height = frame.size[1]
if opts.size:
if width > height:
width = int(int(opts.size) * (float(width) / height))
height = int(opts.size)
width = width - width % 2
ox = abs(height - width) / 2
oy = 0
else:
height = int(int(opts.size) * (float(height) / width))
width = int(opts.size)
height = height - height % 2
ox = 0
oy = abs(height - width) / 2
frame = frame.resize((width, height), Image.ANTIALIAS)
frame = frame.crop((ox, oy, int(opts.size) + ox, oy + int(opts.size)))
frame.save(opts.output)