def initialize_modules(): """ Initialize the modules. This has to be done in a specific order otherwise the app crashes on some systems. """ from gi.repository import Gdk Gdk.init([]) from gi.repository import GtkClutter GtkClutter.init([]) import gi if not gi.version_info >= (3, 11): from gi.repository import GObject GObject.threads_init() from gi.repository import Gst Gst.init(None) from gi.repository import GES GES.init() # This is required because of: # https://bugzilla.gnome.org/show_bug.cgi?id=656314 from gi.repository import GdkX11 GdkX11 # noop
def main(argv): parser = argparse.ArgumentParser(description='convert a BigBlueButton presentation into a GES project') parser.add_argument('--start', metavar='SECONDS', type=float, default=0, help='Seconds to skip from the start of the recording') parser.add_argument('--end', metavar='SECONDS', type=float, default=None, help='End point in the recording') parser.add_argument('--width', metavar='WIDTH', type=int, default=1920, help='Video width') parser.add_argument('--height', metavar='HEIGHT', type=int, default=1080, help='Video height') parser.add_argument('--webcam-size', metavar='PERCENT', type=int, default=25, choices=range(100), help='Amount of screen to reserve for camera') parser.add_argument('--stretch-webcam', action='store_true', help='Stretch webcam to 16:9 aspect ratio') parser.add_argument('--backdrop', metavar='FILE', type=str, default=None, help='Backdrop image for the project') parser.add_argument('--opening-credits', metavar='FILE[:DURATION]', type=str, action='append', default=[], help='File to use as opening credits (may be repeated)') parser.add_argument('--closing-credits', metavar='FILE[:DURATION]', type=str, action='append', default=[], help='File to use as closing credits (may be repeated)') parser.add_argument('basedir', metavar='PRESENTATION-DIR', type=str, help='directory containing BBB presentation assets') parser.add_argument('project', metavar='OUTPUT', type=str, help='output filename for GES project') opts = parser.parse_args(argv[1:]) Gst.init(None) GES.init() p = Presentation(opts) p.save()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() imagelayer = GES.Layer() videolayer = GES.Layer() timeline.add_layer(imagelayer) timeline.add_layer(videolayer) asset = GES.UriClipAsset.request_sync(videoFile) imageasset = GES.UriClipAsset.request_sync(imageFile) imagelayer.add_asset(imageasset, 1 * Gst.SECOND, 0, 1 * Gst.SECOND, GES.TrackType.UNKNOWN) videolayer.add_asset(asset, 0 * Gst.SECOND, 0, 10 * Gst.SECOND, GES.TrackType.UNKNOWN) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() bus.add_signal_watch() bus.connect("message", busMessageCb) GObject.timeout_add(300, duration_querier, pipeline) signal.signal(signal.SIGINT, handle_sigint) Gtk.main()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() layer = GES.Layer() timeline.add_layer(layer) asset = GES.UriClipAsset.request_sync(videoFile) imageasset = GES.UriClipAsset.request_sync(imageFile) layer.add_asset(imageasset, 0 * Gst.SECOND, 0, 1 * Gst.SECOND, GES.TrackType.UNKNOWN) layer.add_asset(asset, 0 * Gst.SECOND, 0, 10 * Gst.SECOND, GES.TrackType.UNKNOWN) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) mainLoop = GLib.MainLoop.new(None, False) GLib.timeout_add_seconds(10, quit, mainLoop) GLib.MainLoop().run()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() video_layer = GES.Layer() audio_layer = GES.Layer() timeline.add_layer(video_layer) timeline.add_layer(audio_layer) video_asset = GES.UriClipAsset.request_sync(videoFile) #video_layer.add_asset(video_asset, 0, 0, 3 * Gst.SECOND, GES.TrackType.UNKNOWN) video_layer.add_asset(video_asset, 0, 0, 3 * Gst.SECOND, video_asset.get_supported_formats()) audio_asset = GES.UriClipAsset.request_sync(audioFile) audio_layer.add_asset(audio_asset, 0, 0, timeline.get_duration(), GES.TrackType.AUDIO) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) mainLoop = GLib.MainLoop.new(None, False) GLib.timeout_add_seconds(3, quit, mainLoop) GLib.MainLoop().run()
def InitGLib(self): import gi gi.require_version('Gst', '1.0') gi.require_version('GstController', '1.0') gi.require_version('GES', '1.0') gi.require_version('Pango', '1.0') from gi.repository import Gst, GES Gst.init(None) GES.init()
def InitGStreamer(self): import gi gi.require_version('Gst', '1.0') gi.require_version('GstController', '1.0') gi.require_version('GES', '1.0') gi.require_version('Gtk', '3.0') from gi.repository import Gst, GES Gst.init(None) GES.init()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() layer = GES.Layer() timeline.add_layer(layer) asset = GES.UriClipAsset.request_sync(videoFile1) asset2 = GES.UriClipAsset.request_sync(videoFile2) layer.add_asset(asset, 0 * Gst.SECOND, 0, 3 * Gst.SECOND, GES.TrackType.UNKNOWN) layer.add_asset(asset2, 3 * Gst.SECOND, 0, 3 * Gst.SECOND, GES.TrackType.UNKNOWN) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) #encoding container_profile = GstPbutils.EncodingContainerProfile.new( "pitivi-profile", "Pitivi encoding profile", Gst.Caps.new_empty_simple("video/x-matroska"), None) video_profile = GstPbutils.EncodingVideoProfile.new( Gst.Caps.new_empty_simple("video/x-h264"), None, Gst.Caps.new_empty_simple("video/x-raw"), 0) container_profile.add_profile(video_profile) audio_profile = GstPbutils.EncodingAudioProfile.new( Gst.Caps.new_empty_simple("audio/x-vorbis"), None, Gst.Caps.new_empty_simple("audio/x-raw"), 0) container_profile.add_profile(audio_profile) pipeline.set_render_settings(outputFile, container_profile) pipeline.set_mode(GES.PipelineFlags.RENDER) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() bus.add_signal_watch() bus.connect("message", busMessageCb) GObject.timeout_add(1000, duration_querier, pipeline) signal.signal(signal.SIGINT, handle_sigint) Gtk.main()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() layer = GES.Layer() timeline.add_layer(layer) #asset = GES.UriClipAsset.request_sync(videoFile1) asset = GES.Asset.request(GES.TestClip, None) #src = GES.TestClip() #asset.set_property("pattern", GES.VideoTestPattern.SMPTE75) #src.set_property("duration", 5 * Gst.SECOND) #src.set_property("in-point", 5 * Gst.SECOND) #src.set_property("supported-formats", GES.TrackType.VIDEO) #effect = GES.Effect.new("videobalance") # this works #effect = GES.Effect.new("videobalance hue=0.5") #effect = GES.Effect.new("agingtv") #effect = GES.Effect.new("videobalance saturation=1.5 hue=+0.5") effect = GES.Effect.new("frei0r-filter-scale0tilt") #embed() clip = layer.add_asset(asset, 0 * Gst.SECOND, 0 * Gst.SECOND, 2 * Gst.SECOND, GES.TrackType.VIDEO) clip.add(effect) clip.set_property("vpattern", GES.VideoTestPattern.SMPTE75) timeline.commit() print(effect.list_children_properties()) effect.set_child_property("tilt-x", 0.8) pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() bus.add_signal_watch() bus.connect("message", busMessageCb) GObject.timeout_add(1000, duration_querier, pipeline) signal.signal(signal.SIGINT, handle_sigint) Gtk.main()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() layer = GES.SimpleLayer.new() timeline.add_layer(layer) """ GES.VideoTestPattern.BLACK GES.VideoTestPattern.BLINK GES.VideoTestPattern.BLUE GES.VideoTestPattern.CHECKERS_1 GES.VideoTestPattern.CHECKERS_2 GES.VideoTestPattern.CHECKERS_4 GES.VideoTestPattern.CHECKERS_8 GES.VideoTestPattern.CHROMA_ZONE_PLATE GES.VideoTestPattern.CIRCULAR GES.VideoTestPattern.GAMUT GES.VideoTestPattern.GREEN GES.VideoTestPattern.RED GES.VideoTestPattern.SMPTE GES.VideoTestPattern.SMPTE75 GES.VideoTestPattern.SNOW GES.VideoTestPattern.SOLID_COLOR GES.VideoTestPattern.WHITE GES.VideoTestPattern.ZONE_PLATE """ for i in range(0, 18): src = GES.TestClip() src.set_property("vpattern", i) src.set_property("duration", 1 * Gst.SECOND) layer.add_clip(src) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() bus.add_signal_watch() bus.connect("message", busMessageCb) GObject.timeout_add(1000, duration_querier, pipeline) signal.signal(signal.SIGINT, handle_sigint) Gtk.main()
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() #timeline = GES.Timeline() #videotrack = GES.VideoTrack.new() #timeline.add_track(videotrack) imagelayer = GES.Layer() videolayer = GES.Layer() #imagelayer.set_property("priority", 1) #videolayer.set_property("priority", 0) #g_object_set (layer2, "priority", 1, NULL); timeline.add_layer(imagelayer) timeline.add_layer(videolayer) asset = GES.UriClipAsset.request_sync(videoFile) imageasset1 = GES.UriClipAsset.request_sync(imageFile1) imageasset2 = GES.UriClipAsset.request_sync(imageFile2) imageasset3 = GES.UriClipAsset.request_sync(imageFile3) imagelayer.add_asset(imageasset1, 0 * Gst.SECOND, 0, 1 * Gst.SECOND, GES.TrackType.VIDEO) #imagelayer.add_asset(imageasset2, 6 * Gst.SECOND, 0, 2 * Gst.SECOND, GES.TrackType.VIDEO) #imagelayer.add_asset(imageasset3, 8 * Gst.SECOND, 0, 2 * Gst.SECOND, GES.TrackType.VIDEO) #videolayer.add_asset(asset, 1 * Gst.SECOND, 0, 10 * Gst.SECOND, GES.TrackType.VIDEO) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() bus.add_signal_watch() bus.connect("message", busMessageCb) GObject.timeout_add(300, duration_querier, pipeline) signal.signal(signal.SIGINT, handle_sigint) Gtk.main()
def __init__(self): '''Initialize the Python class''' GES.init() # we need to init GES for it to work self.timeline = GES.Timeline() # create the central object of the Timeline self.pipeline = GES.TimelinePipeline() # convenience class to render the Timeline # handles the clock, bus and other things for us self.bus = self.pipeline.get_bus() self.pipeline.add_timeline(self.timeline) # we need to add the Timeline into the Pipeline GES.Timeline.__init__(self.timeline) # initialize the Timeline self.audio = GES.Track.audio_raw_new() # we will have one raw Audio Track self.video = GES.Track.video_raw_new() # and one raw Video Track self.timeline.add_track(self.audio) # we add the Tracks to the Timeline self.timeline.add_track(self.video) Gst.init(None) # we need to initialize Gst for it to work
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() asset = GES.UriClipAsset.request_sync(videoFile) layer = GES.Layer() timeline.add_layer(layer) layer.add_asset(asset, 0, 0 * Gst.SECOND, 10 * Gst.SECOND, asset.get_supported_formats()) #timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) pipeline.set_state(Gst.State.PLAYING) mainLoop = GLib.MainLoop.new(None, False) GLib.timeout_add_seconds(10, quit, mainLoop) GLib.MainLoop().run()
def main(argv): Gst.init(None) GES.init() opts = parser.parse_args(argv[1:]) source = opts.basedir width, height = tuple(map(int, opts.size.split("x", 2))) p = Presentation(source=source, size=(width, height)) if opts.start or opts.end: p.cut(opts.start, opts.end) for fname in opts.opening_credits or []: p.add_opening_credits(fname) if opts.backdrop: p.add_backdrop(opts.backdrop) for fname in opts.closing_credits or []: p.add_closing_credits(fname) margin = opts.margin cam_width = opts.webcam_width if 0 < cam_width < 1: cam_width = int(cam_width * width) max_height = int(height - 2 * margin) slides_width = int(width - 2 * margin) if cam_width > 0: slides_width -= int(cam_width + margin) p.add_webcams(fit=(slides_width + 2 * margin, margin, cam_width, max_height), align="lt") p.add_slides(fit=(margin, margin, slides_width, max_height), align="ct") p.add_deskshare(fit=(margin, margin, slides_width, max_height), align="ct") p.save(opts.target)
def testTimeline(self, timeline): timeline.set_easing_duration(600) Gst.init([]) GES.init() self.project = GES.Project(uri=None, extractable_type=GES.Timeline) bTimeline = GES.Timeline() bTimeline.add_track(GES.Track.audio_raw_new()) bTimeline.add_track(GES.Track.video_raw_new()) self.bTimeline = bTimeline timeline.setTimeline(bTimeline) layer = GES.Layer() bTimeline.add_layer(layer) self.bTimeline = bTimeline self.project.connect("asset-added", self._doAssetAddedCb, layer) self.project.create_asset("file://" + sys.argv[2], GES.UriClip)
def initialize_modules(): """ Initialize the modules. This has to be done in a specific order otherwise the app crashes on some systems. """ from gi.repository import Gdk Gdk.init([]) from gi.repository import GtkClutter GtkClutter.init([]) import gi if not gi.version_info >= (3, 11): from gi.repository import GObject GObject.threads_init() from gi.repository import Gst Gst.init(None) from gi.repository import GES GES.init() from pitivi.utils import validate validate.init()
def check_hard_dependencies(): missing_hard_deps = {} satisfied, req, inst = _check_dependency("Gst", True) if not satisfied: missing_hard_deps["GStreamer"] = (req, inst) satisfied, req, inst = _check_dependency("Clutter", True) if not satisfied: missing_hard_deps["Clutter"] = (req, inst) satisfied, req, inst = _check_dependency("GES", True) if not satisfied: missing_hard_deps["GES"] = (req, inst) satisfied, req, inst = _check_dependency("cairo", False) if not satisfied: missing_hard_deps["Cairo"] = (req, inst) satisfied, req, inst = _check_dependency("xdg", False) if not satisfied: missing_hard_deps["PyXDG"] = (req, inst) satisfied, req, inst = _check_dependency("Gtk", True) if not satisfied: missing_hard_deps["GTK+"] = (req, inst) satisfied, req, inst = _check_dependency("xdg", False) if not satisfied: missing_hard_deps["PyXDG"] = (req, inst) satisfied, req, inst = _check_dependency("numpy", False) if not satisfied: missing_hard_deps["NumPy"] = (req, inst) # Since we had to check Gst beforehand, we only do the import now: from gi.repository import Gst Gst.init(None) reg = Gst.Registry.get() # Special case: gnonlin is a plugin, not a python module to be imported, # we can't use check_dependency to determine the version: inst = Gst.Registry.get().find_plugin("gnonlin") if not inst: missing_hard_deps["GNonLin"] = (HARD_DEPS["gnonlin"], inst) else: inst = inst.get_version() if _string_to_list(inst) < _string_to_list(HARD_DEPS["gnonlin"]): missing_hard_deps["GNonLin"] = (HARD_DEPS["gnonlin"], inst) # GES is checked, import and intialize it from gi.repository import GES GES.init() # Prepare the list of hard deps errors to warn about later: for dependency in missing_hard_deps: req = missing_hard_deps[dependency][0] inst = missing_hard_deps[dependency][1] if req and not inst: message = "%s or newer is required, but was not found on your system." % req elif req and inst: message = "%s or newer is required, but only version %s was found." % (req, inst) else: message = "not found on your system." missing_hard_deps[dependency] = message # And finally, do a few last checks for basic sanity. # Yes, a broken/dead autoaudiosink is still possible in 2012 with PulseAudio if not _initiate_videosinks(Gst): missing_hard_deps["autovideosink"] = \ "Could not initiate video output sink. "\ "Make sure you have a valid one (xvimagesink or ximagesink)." if not _initiate_audiosinks(Gst): missing_hard_deps["autoaudiosink"] = \ "Could not initiate audio output sink. "\ "Make sure you have a valid one (pulsesink, alsasink or osssink)." return missing_hard_deps
def initial_checks(): Gst.init(None) reg = Gst.Registry.get() if PiTiVi: return ( _("%s is already running") % APPNAME, _("An instance of %s is already running in this script.") % APPNAME, ) if not reg.find_plugin("gnonlin"): return ( _("Could not find the GNonLin plugins"), _("Make sure the plugins were installed and are available in the GStreamer plugins path."), ) if not reg.find_plugin("autodetect"): return ( _("Could not find the autodetect plugins"), _("Make sure you have installed gst-plugins-good and that it's available in the GStreamer plugin path."), ) if not hasattr(Gdk.Window, "cairo_create"): return ( _("PyGTK doesn't have cairo support"), _("Please use a version of the GTK+ Python bindings built with cairo support."), ) if not initiate_videosinks(): return ( _("Could not initiate the video output plugins"), _("Make sure you have at least one valid video output sink available (xvimagesink or ximagesink)."), ) if not initiate_audiosinks(): return ( _("Could not initiate the audio output plugins"), _("Make sure you have at least one valid audio output sink available (alsasink or osssink)."), ) if not __try_import_from_gi__("cairo"): return ( _("Could not import the cairo Python bindings"), _("Make sure you have the cairo Python bindings installed."), ) if not __try_import_from_gi__("GooCanvas"): return ( _("Could not import the goocanvas Python bindings"), _("Make sure you have the goocanvas Python bindings installed."), ) if not __try_import__("xdg"): return (_("Could not import the xdg Python library"), _("Make sure you have the xdg Python library installed.")) req, inst = check_required_version("gtk") if req: return ( _("You do not have a recent enough version of GTK+ (your version %s)") % inst, _("Install a version of GTK+ greater than or equal to %s.") % req, ) req, inst = check_required_version("pygst") if req: return ( _("You do not have a recent enough version of GStreamer Python bindings (your version %s)") % inst, _("Install a version of the GStreamer Python bindings greater than or equal to %s.") % req, ) req, inst = check_required_version("gst") if req: return ( _("You do not have a recent enough version of GStreamer (your version %s)") % inst, _("Install a version of the GStreamer greater than or equal to %s.") % req, ) req, inst = check_required_version("cairo") if req: return ( _("You do not have a recent enough version of the cairo Python bindings (your version %s)") % inst, _("Install a version of the cairo Python bindings greater than or equal to %s.") % req, ) req, inst = check_required_version("gnonlin") if req: return ( _("You do not have a recent enough version of the GNonLin GStreamer plugin (your version %s)") % inst, _("Install a version of the GNonLin GStreamer plugin greater than or equal to %s.") % req, ) if not __try_import_from_gi__("GES"): # FIXME enable version checking in GES return ( _("Could not import GStreamer Editing Services "), _("Make sure you have GStreamer Editing Services installed."), ) if not __try_import__("pkg_resources"): return ( _("Could not import the distutils modules"), _("Make sure you have the distutils Python module installed."), ) # The following are soft dependencies # Note that instead of checking for plugins using Gst.Registry.get().find_plugin("foo"), # we could check for elements using Gst.ElementFactory.make("foo") if not __try_import__("numpy"): soft_deps["NumPy"] = _("Enables the autoalign feature") if Gst.ElementFactory.make("frei0r-filter-scale0tilt", None) is None: soft_deps["Frei0r"] = _("Additional video effects") if not Gst.Registry.get().find_plugin("libav"): soft_deps["GStreamer Libav plugin"] = _("Additional multimedia codecs through the Libav library") # Test for gst bad # This is disabled because, by definition, gst bad is a set of plugins that can # move to gst good or ugly, and we don't really have something to rely upon. # if not Gst.Registry.get().find_plugin("swfdec"): # FIXME: find a more representative plugin # soft_deps["GStreamer bad plugins"] = _('Additional GStreamer plugins whose code is not of good enough quality, or are not considered tested well enough. The licensing may or may not be LGPL') # Test for gst ugly # if not Gst.Registry.get().find_plugin("x264"): # soft_deps["GStreamer ugly plugins"] = _('Additional good quality GStreamer plugins whose license is not LGPL or with licensing issues') if not GES.init(): return ( _("Could not initialize GStreamer Editing Services"), _("Make sure you have the gst-editing-services installed."), ) return None
def simple(): Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() layer = GES.Layer() audiolayer = GES.Layer() imagelayer = GES.Layer() timeline.add_layer(layer) timeline.add_layer(audiolayer) timeline.add_layer(imagelayer) asset1 = GES.UriClipAsset.request_sync(videoFile1) asset2 = GES.UriClipAsset.request_sync(videoFile2) asset3 = GES.UriClipAsset.request_sync(videoFile3) asset4 = GES.UriClipAsset.request_sync(videoFile4) musicAsset = GES.UriClipAsset.request_sync(musicFile) imageasset1 = GES.UriClipAsset.request_sync(imageFile1) imageasset2 = GES.UriClipAsset.request_sync(imageFile2) imageasset3 = GES.UriClipAsset.request_sync(imageFile3) #layer.add_asset(imageasset1, 0 * Gst.SECOND, 0, 1 * Gst.SECOND, GES.TrackType.UNKNOWN) layer.add_asset(asset1, 0 * Gst.SECOND, 0, 10 * Gst.SECOND, GES.TrackType.UNKNOWN) imagelayer.add_asset(imageasset2, 10 * Gst.SECOND, 0, 2 * Gst.SECOND, GES.TrackType.UNKNOWN) layer.add_asset(asset2, 10 * Gst.SECOND, 0, 10 * Gst.SECOND, GES.TrackType.UNKNOWN) imagelayer.add_asset(imageasset3, 20 * Gst.SECOND, 0, 2 * Gst.SECOND, GES.TrackType.UNKNOWN) layer.add_asset(asset3, 20 * Gst.SECOND, 5 * Gst.SECOND, 10 * Gst.SECOND, GES.TrackType.UNKNOWN) layer.add_asset(asset4, 30 * Gst.SECOND, 10 * Gst.SECOND, 30 * Gst.SECOND, GES.TrackType.UNKNOWN) audiolayer.add_asset(musicAsset, 0, 0, timeline.get_duration(), GES.TrackType.AUDIO) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) # Firefox #format = ["application/ogg", "video/x-theora", "audio/x-vorbis", "ogv"] # very slow after 20 secs, bugs # Chrome #format = ["video/webm", "video/x-vp8", "audio/x-vorbis", "webm"] # first element # Safari #format = ["video/quicktime", "video/x-h264", "audio/x-aac", "mp4"] #no start # MPEG #format = ["video/mpeg", "video/mpeg", "audio/mpeg", "mpg"] #no start # Works format = ["video/x-matroska", "video/x-h264", "audio/x-vorbis", "mkv"] # mkv / mpeg #(GError('GStreamer error: negotiation problem.',), 'gstvideoencoder.c(1363): gst_video_encoder_chain (): /GESPipeline:gestimelinepipeline0/GstEncodeBin:internal-encodebin/avenc_mpeg1video:avenc_mpeg1video0:\nencoder not initialized') # works, slow after 20 secs, vorbis glitches #format = ["video/x-matroska", "video/x-theora", "audio/x-vorbis", "mkv"] # slow after 20 secs, stream kaputt, very big #format = ["video/x-matroska", "video/x-raw", "audio/x-vorbis", "mkv"] # slower after 20 secs, wrong positioning, output shaky #format = ["video/x-matroska", "video/x-dv", "audio/x-vorbis", "mkv"] container_profile = encoderProfile(format[0], format[1], format[2]) pipeline.set_render_settings(outputFile + "." + format[3], container_profile) #pipeline.set_mode(GES.PipelineFlags.RENDER) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() bus.add_signal_watch() bus.connect("message", busMessageCb) GObject.timeout_add(300, duration_querier, pipeline) signal.signal(signal.SIGINT, handle_sigint) Gtk.main()
# You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301, USA. import gi gi.require_version("Gst", "1.0") gi.require_version("GES", "1.0") from gi.repository import Gst # noqa from gi.repository import GES # noqa import unittest # noqa Gst.init(None) GES.init() class TestCopyPaste(unittest.TestCase): def setUp(self): self.timeline = GES.Timeline.new_audio_video() self.assertEqual(len(self.timeline.get_tracks()), 2) self.layer = self.timeline.append_layer() def testCopyClipRemoveAndPaste(self): clip1 = GES.TestClip.new() clip1.props.duration = 10 self.layer.add_clip(clip1) self.assertEqual(len(clip1.get_children(False)), 2)
Gst.Caps.from_string("video/x-raw"), 0) container_profile.add_profile(video_profile) audio_profile = GstPbutils.EncodingAudioProfile.new( Gst.Caps.from_string(audio), None, Gst.Caps.from_string("audio/x-raw"), 0) container_profile.add_profile(audio_profile) return container_profile if __name__ =="__main__": Gst.init(None) GES.init() timeline = GES.Timeline.new_audio_video() layer = GES.Layer() timeline.add_layer(layer) asset = GES.Asset.request(GES.TestClip, None) layer.add_asset(asset, 0 * Gst.SECOND, 0, 10 * Gst.SECOND, GES.TrackType.UNKNOWN) timeline.commit() pipeline = GES.Pipeline() pipeline.add_timeline(timeline) #dudio/mpeg mpegversion: 4 stream-format: raw
def check_hard_dependencies(): missing_hard_deps = {} satisfied, req, inst = _check_dependency("Gst", True) if not satisfied: missing_hard_deps["GStreamer"] = (req, inst) satisfied, req, inst = _check_dependency("Clutter", True) if not satisfied: missing_hard_deps["Clutter"] = (req, inst) satisfied, req, inst = _check_dependency("GES", True) if not satisfied: missing_hard_deps["GES"] = (req, inst) satisfied, req, inst = _check_dependency("cairo", False) if not satisfied: missing_hard_deps["Cairo"] = (req, inst) satisfied, req, inst = _check_dependency("GooCanvas", True) if not satisfied: missing_hard_deps["GooCanvas"] = (req, inst) satisfied, req, inst = _check_dependency("xdg", False) if not satisfied: missing_hard_deps["PyXDG"] = (req, inst) satisfied, req, inst = _check_dependency("Gtk", True) if not satisfied: missing_hard_deps["GTK+"] = (req, inst) satisfied, req, inst = _check_dependency("xdg", False) if not satisfied: missing_hard_deps["PyXDG"] = (req, inst) # Since we had to check Gst beforehand, we only do the import now: from gi.repository import Gst Gst.init(None) reg = Gst.Registry.get() # Special case: gnonlin is a plugin, not a python module to be imported, # we can't use check_dependency to determine the version: inst = Gst.Registry.get().find_plugin("gnonlin") if not inst: missing_hard_deps["GNonLin"] = (HARD_DEPS["gnonlin"], inst) else: inst = inst.get_version() if _string_to_list(inst) < _string_to_list(HARD_DEPS["gnonlin"]): missing_hard_deps["GNonLin"] = (HARD_DEPS["gnonlin"], inst) # GES is checked, import and intialize it from gi.repository import GES GES.init() # Prepare the list of hard deps errors to warn about later: for dependency in missing_hard_deps: req = missing_hard_deps[dependency][0] inst = missing_hard_deps[dependency][1] if req and not inst: message = "%s or newer is required, but was not found on your system." % req elif req and inst: message = "%s or newer is required, but only version %s was found." % (req, inst) else: message = "not found on your system." missing_hard_deps[dependency] = message # And finally, do a few last checks for basic sanity. # Yes, a broken/dead autoaudiosink is still possible in 2012 with PulseAudio if not _initiate_videosinks(Gst): missing_hard_deps["autovideosink"] = \ "Could not initiate video output sink. "\ "Make sure you have a valid one (xvimagesink or ximagesink)." if not _initiate_audiosinks(Gst): missing_hard_deps["autoaudiosink"] = \ "Could not initiate audio output sink. "\ "Make sure you have a valid one (pulsesink, alsasink or osssink)." return missing_hard_deps