分类: C/C++
2011-02-23 21:51:43
Back in August 2010 I ran a brief experiment . You may have noticed that it was using Theora encoder while most of my used H.264 encoder in MPEG-TS container. The reason for this was that I could not make x264enc work in the pipeline used for the video switcher.
To summarize the problem, this pipeline works:
gst-launch -e videotestsrc ! tee name="splitter" ! \while this one will freeze right after start:
gst-launch -e videotestsrc ! tee name="splitter" ! \I was quite sure it was due to x264enc because I could use any compatible muxer including no muxer at all, even try to save raw H.264 directly to file. It would freeze in all cases when running on Ubuntu 10.04 or 10.10, but not on Ubuntu 9.10. Since I am using GStreamer from PPA, the only difference between the 9.10 and the 10.x machines are libx264 version.
Today I learned how to fix it and make x264enc work in this pipeline, thanks to an email on the GStreamer-devel mailing list . In his email Senthil writes that "The queue will block the supplier when there is no more space in it. ... Since x264enc may take more time to consume, setting leaky property (as suggested in the doc) on the queue before xvimagesink might help" – and indeed it does!
gst-launch -e videotestsrc ! tee name="splitter" ! \works like a charm. I tried both the leaky=1 (upstream) and leaky=2 (downstream) options and both work. The default is leaky=0 (not leaky).
You can now expect an update of the script as well as better integration with the rest of the package.
原文链接: