collect scripts in oxtools
This commit is contained in:
commit
4f9c3da160
22 changed files with 1297 additions and 0 deletions
56
bin/oxframe
Executable file
56
bin/oxframe
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
#!/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', '--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 milliseconds')
|
||||
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)
|
||||
|
||||
15
bin/oxicon
Executable file
15
bin/oxicon
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
import os
|
||||
import sys
|
||||
|
||||
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 oxposter import icon
|
||||
|
||||
if __name__ == "__main__":
|
||||
icon.main()
|
||||
|
||||
48
bin/oxinfo
Executable file
48
bin/oxinfo
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/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()
|
||||
|
||||
inputFile = args[0]
|
||||
i = Info(inputFile)
|
||||
info = i.metadata
|
||||
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])
|
||||
|
||||
15
bin/oxposter
Executable file
15
bin/oxposter
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
import os
|
||||
import sys
|
||||
|
||||
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 oxposter import poster
|
||||
|
||||
if __name__ == "__main__":
|
||||
poster.main()
|
||||
|
||||
38
bin/oxtimeline
Executable file
38
bin/oxtimeline
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/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 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)
|
||||
|
||||
|
||||
import oxgst
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser()
|
||||
parser.add_option('-x', '--width', dest='width', help='pixels per tile, defaults to 1500px', default=1500)
|
||||
parser.add_option('-y', '--height', dest='height', help='timeline height, defaults to 64px', default=64)
|
||||
parser.add_option('-o', '--prefix', dest='prefix', help='prefix for timeline tiles')
|
||||
parser.add_option('-i', '--input', dest='input', help='video input')
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
if None in (opts.prefix, opts.input):
|
||||
parser.print_help()
|
||||
sys.exit()
|
||||
|
||||
timeline = oxgst.Timeline(opts.input)
|
||||
timeline.extract(opts.prefix, opts.width, opts.height)
|
||||
oxgst.timeline.createTimelineMultiline(opts.prefix)
|
||||
oxgst.timeline.makeTiles(opts.prefix, 16)
|
||||
oxgst.timeline.makeTimelineOverview(opts.prefix, 300)
|
||||
oxgst.timeline.makeTimelineOverview(opts.prefix, 600)
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue