GNOME Bugzilla – Bug 630303
theoraenc: Make the bitrate/quality dynamically modifiable
Last modified: 2010-09-22 15:42:21 UTC
Theora allows changing the bitrate dynamically, here is a patch that implements that in the GStreamer element. Here is a patch to do it. Also, here is a small test case, I'm too lazy to write a real unit tests.. import gst a = gst.parse_launch("videotestsrc is-live=1 ! video/x-raw-yuv, width=640, height=480, framerate=(fraction)30/1 ! theoraenc name=enc bitrate=50 ! appsink name=sink max-buffers=1") enc = a.get_by_name("enc") s = a.get_by_name("sink") a.set_state(gst.STATE_PLAYING) last = None avg = None for i in range(1, 600): if i != 0 and i % 60 == 0: enc.set_property("bitrate", i) avg = None print "SET TO ", i buf = s.emit("pull-buffer") if last and last != buf.timestamp: if avg: avg = (9*avg/10) + (100 * 1000 * 8 * buf.size / (buf.timestamp - last)) else: avg = 8 * 1000 * 1000 * buf.size / (buf.timestamp - last) print i, avg, buf.size last = buf.timestamp
Created attachment 170798 [details] [review] theoraenc: Make the bitrate/quality dynamically modifiable
Comment on attachment 170798 [details] [review] theoraenc: Make the bitrate/quality dynamically modifiable Looks good, please push
Comment on attachment 170798 [details] [review] theoraenc: Make the bitrate/quality dynamically modifiable Committed: commit 91f89f490cf9bab23f7eaab21273b4914cbf662d Author: Olivier Crête <olivier.crete@collabora.co.uk> Date: Tue Sep 21 18:57:42 2010 -0400 theoraenc: Make the bitrate/quality dynamically modifiable https://bugzilla.gnome.org/show_bug.cgi?id=630303