GNOME Bugzilla – Bug 737516
gst-launch-1.0 videotestsrc ! x264enc ! decodebin ! autovideosink doesn't want to preroll
Last modified: 2015-02-02 14:30:31 UTC
$ gst-launch-1.0 videotestsrc ! x264enc ! decodebin ! autovideosink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Redistribute latency...
It seems related to typefind, somehow: This prerolls: gst-launch-1.0 videotestsrc ! x264enc ! h264parse ! avdec_h264 ! autovideosink This does not: gst-launch-1.0 videotestsrc ! x264enc ! typefind ! h264parse ! avdec_h264 ! autovideosink In the case of typefind being used, the pipeline settles on byte-stream H264, but settles on AVC without typefind. However, playing byte-stream by forcing caps works fine if typefind isn't around.
Just did a quick test, typefind works for bytestream, but not for AVC. I'm not sure it is supposed to work though. Works: gst-launch-1.0 videotestsrc ! x264enc ! video/x-h264,format=bytestream ! typefind ! h264parse ! avdec_h264 ! autovideosink
Not sure either. AVC is detected only if there is "codec data" in caps. This'd be a separate issue if AVC was supposed to be detected anyway in the absence of that codec data.
Somehow, when running through typefind all the byte-stream sync bytes are (re-)written as 00 00 00 02 instead of 00 00 00 01 - so h264parse skips them all.
Oh, I see what's happening - they're not 00 00 00 02. That's a 4 byte AVC size. x264enc is announcing byte-stream caps, which typefind accepts, but then actually outputting AVC content and confusing h264parse. Nicolas: gst-launch-1.0 videotestsrc ! x264enc ! video/x-h264,format=bytestream ! typefind ! h264parse ! avdec_h264 ! autovideosink works because it's doing AVC caps. gst-launch-1.0 videotestsrc ! x264enc ! video/x-h264,stream-format=byte-stream ! typefind ! h264parse ! avdec_h264 ! autovideosink is the correct caps filter that will break it.
Created attachment 295946 [details] [review] fix missing option in bytestream mode
This fixes prerolling. When selecting byte stream mode, an option was set in only one of the two code paths. Not knowing the particulars of H264, I'm not 100% sure this is totally correct, however.
> Jan Oops indeed. Note that just adding caps filter video/x-h264 was fixing it ;-P (In reply to comment #7) > This fixes prerolling. When selecting byte stream mode, an option was set in > only one of the two code paths. > > Not knowing the particulars of H264, I'm not 100% sure this is totally correct, > however. Could be that, I'm also not an expert.
Review of attachment 295946 [details] [review]: Looks good to me/
Thanks, pushed. commit 5f075f336189ac72b62349716a5b826b55434d5b Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Mon Feb 2 14:13:10 2015 +0000 x264enc: set annexb=1 in byte stream mode when downstream has ANY caps This matches what is done when downstream caps are not ANY, and fixes prerolling in byte stream mode when typefind is downstream.