Created
May 12, 2015 20:19
-
-
Save LongHairedHacker/93ee78d524b0b4f8cf5d to your computer and use it in GitHub Desktop.
More fun with gstreamer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python2 | |
import pygst | |
pygst.require('0.10') | |
import gst | |
pipeline = gst.Pipeline('pipeline') | |
file_src = gst.element_factory_make('filesrc', 'source'); | |
file_src.set_property('location', '../videos/tears_of_steel_720p.mkv') | |
matroskademux = gst.element_factory_make('matroskademux') | |
h264parse = gst.element_factory_make('h264parse') | |
ffdec_h264 = gst.element_factory_make('ffdec_h264') | |
colorspace1 = gst.element_factory_make('ffmpegcolorspace') | |
videoscale = gst.element_factory_make('videoscale') | |
colorspace2 = gst.element_factory_make('ffmpegcolorspace') | |
caps = gst.Caps('video/x-raw-rgb, bpp=(int)32, endianness=(int)4321, format=(fourcc)BGRA, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)1280, height=(int)720, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false') | |
caps_filter = gst.element_factory_make('capsfilter') | |
caps_filter.set_property('caps', caps); | |
ximagesink = gst.element_factory_make('ximagesink') | |
pipeline.add(file_src, matroskademux, h264parse, ffdec_h264, colorspace1, videoscale, colorspace2, caps_filter, ximagesink) | |
gst.element_link_many(file_src, matroskademux) | |
gst.element_link_many(h264parse, ffdec_h264, colorspace1, videoscale, colorspace2, caps_filter, ximagesink) | |
def on_new_demux_pad(element): | |
matroskademux.link(h264parse) | |
pipeline.set_state(gst.STATE_PLAYING) | |
matroskademux.connect('no-more-pads', on_new_demux_pad) | |
pipeline.set_state(gst.STATE_PAUSED) | |
bus = pipeline.get_bus() | |
msg = bus.timed_pop_filtered(gst.CLOCK_TIME_NONE, | |
gst.MESSAGE_ERROR | gst.MESSAGE_EOS) | |
print msg | |
pipeline.set_state(gst.STATE_NULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MIXERFORMAT='video/x-raw-rgb, bpp=(int)32, endianness=(int)4321, format=(fourcc)BGRA, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)1280, height=(int)720, framerate=(fraction)24/1, pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false' | |
SRC="filesrc location=../videos/tears_of_steel_720p.mkv ! matroskademux ! h264parse ! ffdec_h264" | |
SCALE='ffmpegcolorspace ! videoscale ! ffmpegcolorspace' | |
gst-launch-0.10 -v \ | |
$SRC !\ | |
$SCALE !\ | |
$MIXERFORMAT !\ | |
ximagesink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment