OpenMediaLib User and Development Guide

Really, Really Advanced Stack Usage

The stack can also be used for multiple playback and encode cycles. For example:

./rpn.py video1.avi play video2.avi op:output.mpg store

Following on from the description in the previous section regarding 'active' words, it should be clear that the 'play' word will be executed immediately. After it's completed (or interrupted), video2.avi is pushed followed by 'op:output.mpg' – note that 'output.mpg' is not treated as an input, hence the 'op:' prefix is used here – the 'store' word picks up the name (and any properties assigned) and uses this to construct an OML store.

Note that any OML store can be constructed – for example:

./rpn.py video.avi openal: store

would play out audio only via the openal store.

Or the simply bizarre:

: convert-to-pal-4:3
colour: width=720 height=576 fps_num=25 fps_den=1
swap
filter:frame_rate fps_num=25 fps_den=1
filter:composite slot=1
;

: encode-pal-dv-4:3
output !
convert-to-pal-43
filter:resampler frequency=48000
output
aspect_ratio=1.3333333
store
;

Which can be used to convert any input to a PAL DV output as follows:

video.avi op:output.dv encode-pal-dv-43

And as an even more esoteric example, consider the contents of quad.oml:

: quad
a !  b !  c !  d !
colour: out=200
a filter:deinterlace filter:composite rx=0.0 ry=0.0 rw=0.5 rh=0.5
b filter:deinterlace filter:composite rx=0.5 ry=0.0 rw=0.5 rh=0.5
c filter:deinterlace filter:composite rx=0.0 ry=0.5 rw=0.5 rh=0.5
d filter:deinterlace filter:composite rx=0.5 ry=0.5 rw=0.5 rh=0.5
;

Which should be familiar to you from the previous section.

Assuming you have a collection of 10 videos the following is perfectly valid:

./rpn.py quad.oml *.avi quad quad quad

For 16, this might provide a more logical result:

./rpn.py quad.oml *.avi quad a ! quad b ! quad c ! quad d ! a b c d quad

The OML function definition is primarily provided to allow the simplification of common stack manipulations. It's very useful for test case generation at the very least, though it should extend to more general purpose specialisation.