8 def __init__(self, config):
10 # set gstreamer basic options
15 def setup(self, filename, mux, vcodec, vbitrate,\
16 fps, acodec, abitrate, width, height, port):
18 self.filename = filename
21 self.vbitrate = int(vbitrate)
24 self.abitrate = int(abitrate)
25 self.width = int(width)
26 self.height = int(height)
32 #queue ! videoscale ! video/x-raw-yuv,width=240,height=144\
33 #! videorate ! ffenc_h263p bitrate=256000 me-method=2 \
34 #! rtph263ppay ! udpsink host=224.0.0.1 port=5000
37 #audio/x-raw-int ! queue ! audioconvert ! faac ! rtpmp4gpay\
38 #! udpsink name=upd_audio host=224.0.0.1 port=5002
40 self.pipe = "filesrc location=%s ! decodebin name=d ! queue ! videoscale !"\
41 "video/x-raw-yuv,width=(int)%d,height=(int)%d ! ffenc_h263p bitrate=%d"\
42 " me-method=2 ! rtph263ppay ! udpsink host=224.0.0.1 port=%d d. ! "\
43 "queue ! audioconvert ! faac ! rtpmp4gpay ! udpsink name=udp_audio "\
44 "host=224.0.0.1 port=%d" % (self.filename, self.width, self.height,\
45 self.vbitrate, self.port, self.port+2)
47 #self.pipe = "filesrc location=/tmp/mpg/cpm.mpg ! decodebin ! ffmpegcolorspace ! ximagesink"
49 self.pipeline = gst.parse_launch(self.pipe)
54 print "Trying to play pipeline: %s" % self.pipe
57 self.pipeline.set_state(gst.STATE_PLAYING)
58 except gobject.GError, e:
59 print "Error: " + str(e)
64 print "Trying to stop pipeline: %s" % self.pipe
67 self.pipeline.set_state(gst.STATE_NULL)
68 except gobject.GError, e:
69 print "Error: " + str(e)