They arnt exposed but I exposed them in a prototype, in the spirit of
good nature, heres a few patches
diff -crB xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/avcodec.h
xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/avcodec.h
*** xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/avcodec.h
2010-10-15 17:02:25.000000000 +0100
--- xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/avcodec.h
2011-01-21 12:44:28.000000000 +0000
***************
*** 2713,2718 ****
--- 2713,2730 ----
* - decoding: unused
*/
int spsid;
+ /**
+ * slicemaxsize
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int slicemaxsize;
+ /**
+ * enable_zero_latency
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int enable_zero_latency;
} AVCodecContext;
/**
diff -crB xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/libx264.c
xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/libx264.c
*** xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/libx264.c
2011-01-12 12:03:14.000000000 +0000
--- xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/libx264.c
2011-02-09 16:28:05.000000000 +0000
***************
*** 21,40 ****
#include "avcodec.h"
#include <x264.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
- typedef struct X264Context {
- x264_param_t params;
- x264_t *enc;
- x264_picture_t pic;
- uint8_t *sei;
- int sei_size;
- AVFrame out_pic;
- } X264Context;
-
static void X264_log(void *p, int level, const char *fmt, va_list
args)
{
static const int level_map[] = {
--- 21,32 ----
#include "avcodec.h"
#include <x264.h>
+ #include "libx264.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void X264_log(void *p, int level, const char *fmt, va_list
args)
{
static const int level_map[] = {
***************
*** 188,193 ****
--- 180,192 ----
if (avctx->spsid) {
x4->params.i_sps_id = avctx->spsid;
}
+
+ /**/
+ if(avctx->slicemaxsize)
+ {
+ x4->params.i_slice_max_size = avctx->slicemaxsize;
+ }
+
x4->params.i_bframe = avctx->max_b_frames;
x4->params.b_cabac = avctx->coder_type ==
FF_CODER_TYPE_AC;
x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
***************
*** 306,311 ****
--- 305,321 ----
/**/
x4->params.b_repeat_headers = 1;
+ /**/
+ if(avctx->enable_zero_latency)
+ {
+ x4->params.rc.i_lookahead = 0;
+ x4->params.i_sync_lookahead = 0;
+ x4->params.i_bframe = 0;
+ x4->params.b_sliced_threads = 1;
+ x4->params.b_vfr_input = 0;
+ x4->params.rc.b_mb_tree = 0;
+ }
+
x4->enc = x264_encoder_open(&x4->params);
if (!x4->enc)
return -1;
Only in xuggler-latest-src-good/captive/ffmpeg/csrc/
libavcodec: .libx265.c.swp
Only in xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec:
libx264.h
Only in xuggler-latest-src-good/captive/ffmpeg/csrc/
libavcodec: .libx264.h.swp
diff -crB xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/options.c
xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/options.c
*** xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/options.c
2010-10-15 16:59:26.000000000 +0100
--- xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/options.c
2011-01-21 12:44:24.000000000 +0000
***************
*** 426,431 ****
--- 426,433 ----
{"cholesky", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_CHOLESKY,
INT_MIN, INT_MAX, A|E, "lpc_type"},
{"lpc_passes", "number of passes to use for Cholesky factorization
during LPC analysis", OFFSET(lpc_passes), FF_OPT_TYPE_INT, -1,
INT_MIN, INT_MAX, A|E},
{"spsid", "spsid used for avc dcr", OFFSET(spsid), FF_OPT_TYPE_INT,
0, 0, 31, V|E},
+ {"slicemaxsize", "Max size per slice in bytes includes estimated NAL
overhead", OFFSET(slicemaxsize), FF_OPT_TYPE_INT, 0, 0, 5000, V|E}, /
**/
+ {"enable_zero_latency", "Switch on the x264 zerolatency tune flag",
OFFSET(enable_zero_latency), FF_OPT_TYPE_INT, 0, 0,1, V|E},
{NULL},
};
AND
diff -crBN xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/libx264.h
xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/libx264.h
*** xuggler-latest-src/captive/ffmpeg/csrc/libavcodec/libx264.h
1970-01-01 01:00:00.000000000 +0100
--- xuggler-latest-src-good/captive/ffmpeg/csrc/libavcodec/libx264.h
2011-02-08 14:53:54.000000000 +0000
***************
*** 0 ****
--- 1,13 ----
+ #ifndef AVCODEC_LIBX264_H
+ #define AVCODEC_LIBX264_H
+
+ typedef struct X264Context {
+ x264_param_t params;
+ x264_t *enc;
+ x264_picture_t pic;
+ uint8_t *sei;
+ int sei_size;
+ AVFrame out_pic;
+ } X264Context;
+
+ #endif
I cant remember the exact version but i know it was an early xuggler
4.0.
With the above changes pass the following to setProperty (you can
change these values) :
slicemaxsize 1500
bufsize 2000k
maxrate 2000k
threads 2
enable_zero_latency 1
+intra_refresh
For your info the output file with intra-refresh should look like
(ffplay with debug) :
Duration: 00:01:42.00, start: 0.067000, bitrate: 555 kb/s
Stream #0.0, 21, 1/1000: Video: h264, yuv420p, 640x360, 1/60, 491
kb/s, 29.97 tbr, 1k tbn, 60 tbc
Stream #0.1, 26, 1/1000: Audio: aac, 44100 Hz, stereo, s16, 64 kb/
s
[h264 @ 0x131fe90] sps:0 profile:66/30 poc:0 ref:1 40x23 FRM 8B8 crop:
0/0/0/4 VUI 420 1/60
[h264 @ 0x131fe90] pps:0 sps:0 CAVLC slice_groups:1 ref:1/1 qp:
29/26/0/0 LPAR
[h264 @ 0x131fe90] sps:0 profile:66/30 poc:0 ref:1 40x23 FRM 8B8 crop:
0/0/0/4 VUI 420 1/60
[h264 @ 0x131fe90] pps:0 sps:0 CAVLC slice_groups:1 ref:1/1 qp:
29/26/0/0 LPAR
[h264 @ 0x131fe90] slice:1 F mb:0 I fix IDR pps:0 frame:0 poc:0/0 ref:
1/1 qp:39 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:2 F mb:339 I fix IDR pps:0 frame:0 poc:0/0
ref:1/1 qp:38 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:3 F mb:480 I fix IDR pps:0 frame:0 poc:0/0
ref:1/1 qp:39 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:4 F mb:888 I fix IDR pps:0 frame:0 poc:0/0
ref:1/1 qp:37 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:1 F mb:0 P fix pps:0 frame:1 poc:2/2 ref:1/1
qp:38 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:2 F mb:480 P fix pps:0 frame:1 poc:2/2 ref:
1/1 qp:38 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:1 F mb:0 P fix pps:0 frame:2 poc:4/4 ref:1/1
qp:34 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:2 F mb:310 P fix pps:0 frame:2 poc:4/4 ref:
1/1 qp:37 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:3 F mb:480 P fix pps:0 frame:2 poc:4/4 ref:
1/1 qp:34 loop:2:0:0 weight:0
[h264 @ 0x131fe90] slice:4 F mb:883 P fix pps:0 frame:2 poc:4/4 ref:
1/1 qp:33 loop:2:0:0 weight:0
Instead of normal :
[h264 @ 0xa773e90] sps:0 profile:66/30 poc:0 ref:1 40x23 FRM 8B8 crop:
0/0/0/4 VUI 420 1/60
[h264 @ 0xa773e90] pps:0 sps:0 CAVLC slice_groups:1 ref:1/1 qp:
29/26/0/0 LPAR
[h264 @ 0xa773e90] sps:0 profile:66/30 poc:0 ref:1 40x23 FRM 8B8 crop:
0/0/0/4 VUI 420 1/60
[h264 @ 0xa773e90] pps:0 sps:0 CAVLC slice_groups:1 ref:1/1 qp:
29/26/0/0 LPAR
[h264 @ 0xa773e90] slice:1 F mb:0 I fix IDR pps:0 frame:0 poc:0/0 ref:
1/1 qp:26 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:1 poc:2/2 ref:1/1
qp:33 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:2 poc:4/4 ref:1/1
qp:33 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:3 poc:6/6 ref:1/1
qp:32 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:4 poc:8/8 ref:1/1
qp:32 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:5 poc:10/10 ref:
1/1 qp:32 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:6 poc:12/12 ref:
1/1 qp:32 loop:1:0:0 weight:0
[h264 @ 0xa773e90] slice:1 F mb:0 P fix pps:0 frame:7 poc:14/14 ref:
1/1 qp:32 loop:1:0:0 weight:0
Chris
On Jun 13, 10:44 am, asxz87 <
asxz8...@gmail.com> wrote:
> Sorry, I miss the 's' in flags2.
>
> After I try:
> encoder.setProperty("flags2", "+intra_refresh");
> which return 0, means success
>
> It start pushing video data out, but I can't see the video in
> player(FLVplayer).
>
> any help?
>
> On Friday, June 10, 2011 11:31:08 AM UTC+8, asxz87 wrote:
>
> > I take a look supported options, and can't find "tune".
> > Fortunately, intra_refresh is in flag2.
>
> > Maybe you can try:
>
> > encoder.setProperty("flag2", "+intra_refresh");
>
> > I try this just a few minutes ago, but return value <0 means error :(
> > plz let us know if you success :)
>
> > btw, you can get supported options by:
>
> > 1.
> >
http://wiki.xuggle.com/Performance_Tuning#How_Can_I_Get_What_Options_...