VideoConcat

IamTrying iamtrying.test at gmail.com
Sat Apr 28 00:19:12 PDT 2012


If you are not doing live full duplex broadcasting. Just use `input-selector`
that works well for X sources. But that does not work well for live
broadcasting cases.

1) create a file py.py

2) copy and paste it 

#!/usr/bin/env python

import sys, os
import pygtk, gtk, gobject
import pygst
pygst.require("0.10")
import gst

class GTK_Main:

	def __init__(self):
		window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		window.set_title("Test")
		window.set_default_size(100, 100)
		window.connect("destroy", gtk.main_quit, "WM destroy")
		vbox = gtk.VBox()
		window.add(vbox)
		self.movie_window = gtk.DrawingArea()
		vbox.add(self.movie_window)
		hbox = gtk.HBox()
		vbox.pack_start(hbox, False)
		hbox.set_border_width(10)
		hbox.pack_start(gtk.Label())
		self.button = gtk.Button("Start")
		self.button.connect("clicked", self.start_stop)
		hbox.pack_start(self.button, False)
		self.button2 = gtk.Button("Switch now")
		self.button2.connect("clicked", self.exit)
		hbox.pack_start(self.button2, False)
		hbox.add(gtk.Label())
		window.show_all()

		# Default sink1
		self.mySwitch = "sink1"
		self.player = gst.parse_launch ("multifilesrc location=pipe1
caps=\"image/jpeg,framerate=100/1\" ! decodebin2 ! videoscale !
video/x-raw-yuv,width=1280,height=720 ! queue ! s.sink0 videotestsrc !
videoscale ! video/x-raw-yuv,width=1280,height=720 ! queue ! s.sink1
input-selector name=s ! tee name=t ! queue ! xvimagesink name=gl sync=false
t. ! queue ! ffmpegcolorspace ! x264enc ! rtph264pay ! udpsink
buffer-size=512000 host=12.0.0.8 port=558 name=udpuploadersink0")
		bus = self.player.get_bus()
		bus.add_signal_watch()
		bus.enable_sync_message_emission()

	# Stop/Start button
	def start_stop(self, w):
		if self.button.get_label() == "Start":
		        self.button.set_label("Stop")
		        self.player.set_state(gst.STATE_PLAYING)
		else:
		        self.player.set_state(gst.STATE_NULL)
		        self.button.set_label("Start")

	# Switch Button
	def exit(self, widget, data=None):
		print "Switching to: " + self.mySwitch
		sel                          = self.player.get_by_name("s")
		new_pad          = sel.get_static_pad(self.mySwitch)
		stop_time  =  sel.emit('block')
		start_time = new_pad.get_property('running-time')
		sel.emit('switch', new_pad, stop_time,start_time)
		if self.mySwitch.startswith("sink0"):
				    self.mySwitch = "sink1"
		else:
				    self.mySwitch = "sink0"

GTK_Main()
gtk.gdk.threads_init()
gtk.main()


3) run it by using those buttons.


Sorry but not working for broadcasting, but you can play with this for any
local use.



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/VideoConcat-tp971089p4594334.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list