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 421110 - New x264enc plugin
New x264enc plugin
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 0.10.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-03-21 16:43 UTC by Michal Benes
Modified: 2007-03-28 15:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Header file for plugin (1.71 KB, text/plain)
2007-03-21 16:45 UTC, Michal Benes
Details
x264enc plugin (8.93 KB, application/octet-stream)
2007-03-21 16:49 UTC, Michal Benes
Details
X264enc plugin (8.66 KB, application/octet-stream)
2007-03-22 10:55 UTC, Michal Benes
Details

Description Michal Benes 2007-03-21 16:43:21 UTC
This is brand new x264enc from ITonis
Comment 1 Michal Benes 2007-03-21 16:45:54 UTC
Created attachment 85050 [details]
Header file for plugin
Comment 2 Michal Benes 2007-03-21 16:49:04 UTC
Created attachment 85053 [details]
x264enc plugin

Sorry, no autoconf stuff yet
Comment 3 Christian Fredrik Kalager Schaller 2007-03-21 18:45:17 UTC
I wrote the autostuff for this, but the compilation fails for me with:

gstx264enc.c:59:28: error: include/system.h: No such file or directory
gstx264enc.c: In function 'gst_x264enc_init_encoder':
gstx264enc.c:635: error: 'struct <anonymous>' has no member named 'f_vbv_ireserve'
gstx264enc.c: In function 'gst_x264enc_sink_event':
gstx264enc.c:735: error: 'false' undeclared (first use in this function)
gstx264enc.c:735: error: (Each undeclared identifier is reported only once
gstx264enc.c:735: error: for each function it appears in.)
make[3]: *** [libgstx264_la-gstx264enc.lo] Error 1

what is 'system.h' meant to come from?
Comment 4 Michal Benes 2007-03-22 10:55:43 UTC
Created attachment 85101 [details]
X264enc plugin

Hi Christian, system.h is part of our build system which I forgot to remove. v_vbv_reserve is out API addition to x264 which is not accepted by the community because they are working on a more complex solution to constant bit-rate ratecontrol. All of this stuff is removed from the new version.
Comment 5 Christian Fredrik Kalager Schaller 2007-03-22 11:53:58 UTC
Hi Michal,
Ok, it compiles now, but the built plugin fails to load. The debug log tells me:
GST_PLUGIN_LOADING gstplugin.c:414:gst_plugin_load_file:^[[00m module_open failed: /usr/lib/gstreamer-0.10/libgstx264.so: undefined symbol: x264_nal_encode

My version of x264 is -> x264-devel-0-0.8.20061028
Comment 6 Laurent Glayal 2007-03-23 15:55:31 UTC
Hi,
Works fine for me ::

gst-launch videotestsrc ! "video/x-raw-yuv, framerate=(fraction)8, width=720, height=576" ! ffmpegcolorspace ! x264enc ! ffdec_h264 ! ffmpegcolorspace ! ximagesink

using x264 daily tarball x264-snapshot-20070322-2245.tar.bz2 .

Thanks a lot for this code. 
Regards.
Comment 7 Tim-Philipp Müller 2007-03-25 13:09:19 UTC
Great stuff! Committed to CVS with a bunch of minor changes (c++ comments, nomenklatura, etc.):

 2007-03-25  Tim-Philipp Müller  <tim at centricular dot net>

        Patch by: Michal Benes <michal.benes at itonis tv>
        Patch by: Josef Zlomek <josef.zlomek at itonis tv>

        * configure.ac:
        * ext/Makefile.am:
        * ext/x264/Makefile.am:
        * ext/x264/gstx264enc.c: (gst_x264_enc_me_get_type),
        (gst_x264_enc_analyse_get_type),
        (gst_x264_enc_timestamp_queue_init),
        (gst_x264_enc_timestamp_queue_free),
        (gst_x264_enc_timestamp_queue_put),
        (gst_x264_enc_timestamp_queue_get), (gst_x264_enc_header_buf),
        (gst_x264_enc_set_src_caps), (gst_x264_enc_sink_set_caps),
        (gst_x264_enc_base_init), (gst_x264_enc_class_init),
        (gst_x264_enc_init), (gst_x264_enc_init_encoder),
        (gst_x264_enc_close_encoder), (gst_x264_enc_dispose),
        (gst_x264_enc_sink_event), (gst_x264_enc_chain),
        (gst_x264_enc_encode_frame), (gst_x264_enc_change_state),
        (gst_x264_enc_set_property), (gst_x264_enc_get_property),
        (plugin_init):
        * ext/x264/gstx264enc.h:
          Add libx264-based h264 encoder plugin (#421110). Probably doesn't
          handle 'odd' widths and heights correctly yet.

Comment 8 Michal Benes 2007-03-25 17:29:24 UTC
Hi Tim, x264 library handles widths/heights non-divisible by 16 correctly by setting appropriate cropping. This is more effective than cropping the image explicitly before passing to encoder.
Comment 9 Tim-Philipp Müller 2007-03-25 20:16:54 UTC
> x264 library handles widths/heights non-divisible by 16 correctly by
> setting appropriate cropping. This is more effective than cropping the
> image explicitly before passing to encoder

That may be so, but as far as I can tell you're still feeding it data with the wrong strides in those cases, since you need to consider the actual input stride of the input data. Also, our video caps system currently doesn't have a standardised way to pass cropping configuration with picture data, so even if libx264 can do that you can't really do this with GStreamer yet.

This doesn't look right, for example (although the decoder might be broken in this respect as well of course):

$ gst-launch-0.10 videotestsrc ! video/x-raw-yuv,format=\(fourcc\)I420,width=718,height=574 ! x264enc ! ffdec_h264 ! ffmpegcolorspace ! xvimagesink

Comment 10 Christian Fredrik Kalager Schaller 2007-03-26 10:02:34 UTC
Just thought I should mention that the plugin loads on my Fedora system too now with the fixes from Tim. Thanks everyone. Hopefully the stride issues can be sorted out also.
Comment 11 Laurent Glayal 2007-03-28 15:37:41 UTC
Hi,
submitted h264 payloader, working fine with x264enc (Bugzilla Id #423782).
Regards