After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 737516 - gst-launch-1.0 videotestsrc ! x264enc ! decodebin ! autovideosink doesn't want to preroll
gst-launch-1.0 videotestsrc ! x264enc ! decodebin ! autovideosink doesn't wan...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
1.4.3
Other Linux
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-28 10:16 UTC by Vivia Nikolaidou
Modified: 2015-02-02 14:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix missing option in bytestream mode (1006 bytes, patch)
2015-02-02 14:15 UTC, Vincent Penquerc'h
committed Details | Review

Description Vivia Nikolaidou 2014-09-28 10:16:19 UTC
$ gst-launch-1.0 videotestsrc ! x264enc ! decodebin ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Comment 1 Vincent Penquerc'h 2015-02-02 11:57:21 UTC
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.
Comment 2 Nicolas Dufresne (ndufresne) 2015-02-02 14:02:38 UTC
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
Comment 3 Vincent Penquerc'h 2015-02-02 14:05:09 UTC
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.
Comment 4 Jan Schmidt 2015-02-02 14:08:36 UTC
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.
Comment 5 Jan Schmidt 2015-02-02 14:11:49 UTC
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.
Comment 6 Vincent Penquerc'h 2015-02-02 14:15:14 UTC
Created attachment 295946 [details] [review]
fix missing option in bytestream mode
Comment 7 Vincent Penquerc'h 2015-02-02 14:16:28 UTC
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.
Comment 8 Nicolas Dufresne (ndufresne) 2015-02-02 14:18:38 UTC
> 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.
Comment 9 Jan Schmidt 2015-02-02 14:21:50 UTC
Review of attachment 295946 [details] [review]:

Looks good to me/
Comment 10 Vincent Penquerc'h 2015-02-02 14:30:11 UTC
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.