[Libav-user] bitrate and delay of h264
hz nan
nhongzhen at gmail.com
Sun Apr 3 19:43:49 CEST 2011
Hi all.
I'm using ffmpeg to encode screen image and send to other computer .
But I found the bitrate is very large. It is nearly 300KB/s which need
to be below 100KB/s. And if i decrease the bitrate,the quality of
image become very bad.
And I encode 5image in 1s, because if I only encode 1image in 1s, the
delay of the image will become about 6s which is very large.
Anyone has advice to decrease the bitrate and the delay of the image?
Thanks
Hongzhen Nan
pCodec = avcodec_find_encoder(CODEC_ID_H264);
pCodecCtx= avcodec_alloc_context();
pCodecCtx->width = 800;
pCodecCtx->height = 600;
pCodecCtx->pix_fmt = PIX_FMT_YUV420P;
pCodecCtx->time_base.den = 1;
pCodecCtx->time_base.num = 5;
pCodecCtx->coder_type=1;
pCodecCtx->flags|=(CODEC_FLAG_LOOP_FILTER);
pCodecCtx->me_cmp|=FF_CMP_CHROMA;
pCodecCtx->partitions|=(X264_PART_I8X8|X264_PART_I4X4|X264_PART_P8X8|X264_PART_B8X8);
pCodecCtx->me_method=ME_HEX;
pCodecCtx->me_subpel_quality=4;
pCodecCtx->me_range=16;
pCodecCtx->gop_size=2;
pCodecCtx->keyint_min=25;
pCodecCtx->scenechange_threshold=40;
pCodecCtx->i_quant_factor=(float)1/0.71;
pCodecCtx->b_frame_strategy=1;
pCodecCtx->qcompress=0.6;
pCodecCtx->qmin=10;
pCodecCtx->qmax=51;
pCodecCtx->max_qdiff=4;
pCodecCtx->max_b_frames=3;
pCodecCtx->refs=2;
pCodecCtx->directpred=1;
pCodecCtx->trellis=1;
pCodecCtx->flags2
|=(CODEC_FLAG2_BPYRAMID|CODEC_FLAG2_WPRED|CODEC_FLAG2_8X8DCT|CODEC_FLAG2_FASTPSKIP);
pCodecCtx->flags2 &=~(CODEC_FLAG2_MIXED_REFS|CODEC_FLAG2_MBTREE);
pCodecCtx->weighted_p_pred=1;
pCodecCtx->rc_lookahead=0;
pCodecCtx->bit_rate=300000;
pCodecCtx->bit_rate_tolerance = 800;
More information about the Libav-user
mailing list