[FFmpeg-devel] [ffmpeg-devel] H264 encoding with libavcodec/libavformat

Quy Pham Sy phamsyquybk
Tue Mar 15 09:46:12 CET 2011


>
> Sorry, I meant
>
> ffpresets/libx264-medium.ffpreset
>
> you will have to translate these options to C code, possibly using one of
> these
> av option functions.
>
> Best regards,
>
> Rudolf Polzer
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>


Here is the setting according to medium preset.

----------------------------------
    /* put sample parameters */
    encoderContext->bit_rate = 400000;

    /* resolution must be a multiple of two */
    encoderContext->width = 352;
    encoderContext->height = 288;

    /* frames per second: 25 frames per second */
    encoderContext->time_base.num = 1;
    encoderContext->time_base.den = 25;

    encoderContext->me_range = 16;
    encoderContext->max_qdiff = 4;
    encoderContext->qmin = 10;
    encoderContext->qmax = 51;
    encoderContext->qcompress = 0.6;

   // encoderContext->gop_size = 10; /* emit one intra frame every ten
frames */
    encoderContext->max_b_frames= 3;
    encoderContext->pix_fmt = PIX_FMT_YUV420P;

    encoderContext->me_cmp |= FF_CMP_CHROMA;
    encoderContext->partitions |= X264_PART_I8X8 | X264_PART_I4X4 |
X264_PART_P8X8 | X264_PART_B8X8;
    encoderContext->me_method = ME_HEX;

    encoderContext->gop_size = 250;
    encoderContext->keyint_min = 10;

    encoderContext->scenechange_threshold = 40;
    encoderContext->i_quant_factor = 0.71;
    encoderContext->b_frame_strategy = 1;
    encoderContext->directpred = 1;
    encoderContext->trellis = 1;
    encoderContext->flags2 = CODEC_FLAG2_BPYRAMID | CODEC_FLAG2_MIXED_REFS |
CODEC_FLAG2_WPRED | CODEC_FLAG2_8X8DCT | CODEC_FLAG2_FASTPSKIP;
    encoderContext->weighted_p_pred = 2;

----------------------------

The result is no better than before.

btw, can anyone point me some examples of using libavcode/libavformat with
H264?

Thanks



More information about the ffmpeg-devel mailing list