Inconsistent x264enc in 1.1.4

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Inconsistent x264enc in 1.1.4

Peter Maersk-Moller-2
Hi

I have discovered some "features" of h.264 pipelines in Gstreamer 1.1.4, which I didn't see in earlier versions. I'll try to describe it below.

In the following we set the following environment variable

RAWVIDEO='video/x-raw, bpp=(int)32, depth=(int)32, endianness=(int)4321, format=(string)BGRA, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)1280, height=(int)720, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false'

Now we run the following pipeline to see all works fine.

gst-launch-1.0 -v videotestsrc is-live=true !\
    $RAWVIDEO !\
    videoconvert !\
    x264enc tune=zerolatency !\
    fakesink

All though it works, the similar pipeline for gstreamer-0.10 would encode main profile level 3.1 H.264 stream based on I420 input. Now with 1.1.4 the pipeline will by default for this setup encode the profile high-4:4:4, which is quite different. This is quite unexpected, but technically it may not be considered an error, but rather an annoyance. However it is a complexity that for sure will generate some problems for many because high-4:4:4 will not be supported on many players. High-4:4:4 is a rather advanced and complex little used (in the past) format. Furthermore, it is a bit unclear which high-4:4:4 profile this actually is, but more on that later.

Anyway if we tell the pipeline that we want a main profile, we can do it like this:

gst-launch-1.0 -v videotestsrc is-live=true !\
    $RAWVIDEO !\
    videoconvert !\
    x264enc tune=zerolatency !\
    'video/x-h264, profile=(string)main' !\
    fakesink

However that result in the following error messages

x264 [error]: main profile doesn't support 4:4:4
Redistribute latency...
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264, codec_data=(buffer)01f4001fffe1001a67f4001f91964014016ec044000003000400000300ca3c60c92001000668ebcc448440, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high-4:4:4, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)25/1
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2857): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
streaming task paused, reason not-negotiated (-4)

Funny. In the previous example it used 4:4:4 successfully. But I assume it insist on 4:4:4 and want to combine this with main profile. Main-4:4:4 is not a profile. Ok, I suspect that the encoder fails to tell videoconvert properly what it can use for input, so lets help it a bit by asking for a I420 input. It OUGHT not be necessary, but lets help it anyway.

gst-launch-1.0 -v videotestsrc is-live=true !\
    $RAWVIDEO !\
    videoconvert !\
    'video/x-raw, format=(string)I420' !\
    x264enc tune=zerolatency !\
    'video/x-h264, profile=(string)main' !\
    fakesink

Now that actually works, and we get a nice H.264 main profile stream generated from input converted to I420 but I believe the x264enc should have reached that conclusion by it self. If GStreamer gets too many plugins, that can't figure out to request the right input, I fear it will over time grow too complex to use for most.

Furthermore, it appear that x264enc uses the word high profile at little bit to carelessly. High Profile and 4:4:4 is many things and for the future we need to be very precise in using these terms. To me at least, it was very unclear which high-4:4:4 profile it claimed it was using successfully and which high-4:4:4 it said it did not support. As such I think letting 'profile=high-4:4:4' cover both Hi444PP and Hi444IP and possibly more (if that is what it is doing) is asking for troubles.

Kind regards
Peter Maersk-Moller

For your convenience, I here reprint an extract from wikipedia:
High Profile (HiP)
The primary profile for broadcast and disc storage applications, particularly for high-definition television applications (for example, this is the profile adopted by the Blu-ray Disc storage format and the DVB HDTV broadcast service).
Progressive High Profile (PHiP)
Similar to the High profile, but without support of field coding features.
Constrained High Profile
Similar to the Progressive High profile, but without support of B (bi-predictive) slices.
High 10 Profile (Hi10P)
Going beyond typical mainstream consumer product capabilities, this profile builds on top of the High Profile, adding support for up to 10 bits per sample of decoded picture precision.
High 4:2:2 Profile (Hi422P)
Primarily targeting professional applications that use interlaced video, this profile builds on top of the High 10 Profile, adding support for the 4:2:2 chroma subsampling format while using up to 10 bits per sample of decoded picture precision.
High 4:4:4 Predictive Profile (Hi444PP)
This profile builds on top of the High 4:2:2 Profile, supporting up to 4:4:4 chroma sampling, up to 14 bits per sample, and additionally supporting efficient lossless region coding and the coding of each picture as three separate color planes.

For camcorders, editing, and professional applications, the standard contains four additional Intra-frame-only profiles, which are defined as simple subsets of other corresponding profiles. These are mostly for professional (e.g., camera and editing system) applications:

High 10 Intra Profile
The High 10 Profile constrained to all-Intra use.
High 4:2:2 Intra Profile
The High 4:2:2 Profile constrained to all-Intra use.
High 4:4:4 Intra Profile
The High 4:4:4 Profile constrained to all-Intra use.
CAVLC 4:4:4 Intra Profile

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inconsistent x264enc in 1.1.4

Olivier Crête-3
Hi,

On Wed, 2013-09-18 at 11:54 +0200, Peter Maersk-Moller wrote:

> RAWVIDEO='video/x-raw, bpp=(int)32, depth=(int)32,
> endianness=(int)4321, format=(string)BGRA, red_mask=(int)65280,
> green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)1280,
> height=(int)720, framerate=(fraction)25/1,
> pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false'

Just a side-note, the *_mask, bpp and depth don't exist anymore in 1.0,
this info is all contained in the format.


> All though it works, the similar pipeline for gstreamer-0.10 would
> encode main profile level 3.1 H.264 stream based on I420 input. Now
> with 1.1.4 the pipeline will by default for this setup encode the
> profile high-4:4:4, which is quite different. This is quite
> unexpected, but technically it may not be considered an error, but
> rather an annoyance. However it is a complexity that for sure will
> generate some problems for many because high-4:4:4 will not be
> supported on many players. High-4:4:4 is a rather advanced and complex
> little used (in the past) format. Furthermore, it is a bit unclear
> which high-4:4:4 profile this actually is, but more on that later.

Doing high-4:4:4 is voluntary, it tries to do the best profile it can
(see bug #708036 for discussion).

> gst-launch-1.0 -v videotestsrc is-live=true !\
>     $RAWVIDEO !\
>     videoconvert !\
>     x264enc tune=zerolatency !\
>     'video/x-h264, profile=(string)main' !\
>     fakesink

This failing is definitely a bug and a regression, I filed a blocker bug
for it.

https://bugzilla.gnome.org/show_bug.cgi?id=708326


--
Olivier Crête
[hidden email]

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel