capenalo / xuggle

Automatically exported from code.google.com/p/xuggle
3 stars 1 forks source link

Add Codec-Specific Option Support to FFmpeg (x264) #269

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
x264 has some new options:

-tune
-level
-profile
-preset

It would be great to able to specify the values for these through 
IStreamCoder.setProperty();

This probably is generalized under what the issue summary indicates: "Codec 
specific options".

Right now, with the latest ffmpeg and Xuggler, this ain't working.

---

Before a official patch has been made, are there any ways to patch my ffmpeg 
and xuggler code to support these options now?

Original issue reported on code.google.com by haakon.r...@gmail.com on 12 Jun 2011 at 2:10

GoogleCodeExporter commented 8 years ago
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h
+++ libavcodec/avcodec.h
@@ -1315,6 +1315,12 @@
      */
     int qmin;

+    
+    char *x_preset;
+    char *x_tune;
+    char *x_level;
+    char *x_profile;
+    
     /**
      * maximum quantizer
      * - encoding: Set by user.

Index: libavcodec/libx264.c
===================================================================
--- libavcodec/libx264.c
+++ libavcodec/libx264.c
@@ -296,11 +296,11 @@
     x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
     x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;

-    if (!x4->preset)
+    if (!avctx->x_preset)
         check_default_settings(avctx);

-    if (x4->preset || x4->tune) {
-        if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0)
+    if (avctx->x_preset || avctx->x_tune) {
+        if (x264_param_default_preset(&x4->params, avctx->x_preset, 
avctx->x_tune) < 0)
             return -1;
     }

@@ -341,7 +341,7 @@
             (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
     }

-    OPT_STR("level", x4->level);
+    OPT_STR("level", avctx->x_level);

     if(x4->x264opts){
         const char *p= x4->x264opts;
@@ -357,8 +357,8 @@
     if (x4->fastfirstpass)
         x264_param_apply_fastfirstpass(&x4->params);

-    if (x4->profile)
-        if (x264_param_apply_profile(&x4->params, x4->profile) < 0)
+    if (avctx->x_profile)
+        if (x264_param_apply_profile(&x4->params, avctx->x_profile) < 0)
             return -1;

     x4->params.i_width          = avctx->width;

Index: libavcodec\options.c
===================================================================
--- libavcodec\options.c
+++ libavcodec\options.c
@@ -49,6 +49,10 @@
 #define AV_CODEC_DEFAULT_BITRATE 200*1000

 static const AVOption options[]={
+{"x_profile", NULL, OFFSET(x_profile), FF_OPT_TYPE_STRING, {.str = NULL}, 
CHAR_MIN, CHAR_MAX},
+{"x_tune", NULL, OFFSET(x_tune), FF_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, 
CHAR_MAX},
+{"x_level", NULL, OFFSET(x_level), FF_OPT_TYPE_STRING, {.str = NULL}, 
CHAR_MIN, CHAR_MAX},
+{"x_preset", NULL, OFFSET(x_preset), FF_OPT_TYPE_STRING, {.str = NULL}, 
CHAR_MIN, CHAR_MAX},
 {"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, V|E},
 {"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = 64*1000 }, INT_MIN, INT_MAX, A|E},
 {"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E},

Original comment by haakon.r...@gmail.com on 17 Jun 2011 at 5:15

GoogleCodeExporter commented 8 years ago
5.x xuggler allows codec specific options via new ffmoeg option setting 
framework

Original comment by art.cla...@gmail.com on 7 Apr 2012 at 5:42