|
|
@@ -91,9 +91,9 @@ pipi_sequence_t *pipi_open_sequence(char const *file, |
|
|
|
file); |
|
|
|
ff->fmt_ctx->filename[sizeof(ff->fmt_ctx->filename) - 1] = '\0'; |
|
|
|
|
|
|
|
ff->fmt_ctx->oformat = guess_format(NULL, file, NULL); |
|
|
|
ff->fmt_ctx->oformat = av_guess_format(NULL, file, NULL); |
|
|
|
if (!ff->fmt_ctx->oformat) |
|
|
|
ff->fmt_ctx->oformat = guess_format("mpeg", NULL, NULL); |
|
|
|
ff->fmt_ctx->oformat = av_guess_format("mpeg", NULL, NULL); |
|
|
|
if (!ff->fmt_ctx->oformat) |
|
|
|
goto error; |
|
|
|
|
|
|
@@ -115,12 +115,42 @@ pipi_sequence_t *pipi_open_sequence(char const *file, |
|
|
|
ff->cod_ctx->bit_rate = bitrate; |
|
|
|
ff->cod_ctx->time_base.num = 1; |
|
|
|
ff->cod_ctx->time_base.den = fps; |
|
|
|
ff->cod_ctx->gop_size = fps * 3 / 4; /* empirical */ |
|
|
|
|
|
|
|
ff->cod_ctx->pix_fmt = PIX_FMT_YUV420P; /* send YUV 420 */ |
|
|
|
if (ff->cod_ctx->codec_id == CODEC_ID_MPEG2VIDEO) |
|
|
|
ff->cod_ctx->max_b_frames = 2; |
|
|
|
if (ff->cod_ctx->codec_id == CODEC_ID_MPEG1VIDEO) |
|
|
|
ff->cod_ctx->mb_decision = 2; |
|
|
|
if (ff->cod_ctx->codec_id == CODEC_ID_H264) |
|
|
|
{ |
|
|
|
/* Import x264 slow presets */ |
|
|
|
ff->cod_ctx->coder_type = 1; |
|
|
|
ff->cod_ctx->flags |= CODEC_FLAG_LOOP_FILTER; |
|
|
|
ff->cod_ctx->me_cmp |= FF_CMP_CHROMA; |
|
|
|
ff->cod_ctx->partitions |= X264_PART_I4X4 | X264_PART_I8X8 |
|
|
|
| X264_PART_P4X4 | X264_PART_P8X8; |
|
|
|
ff->cod_ctx->me_method = ME_UMH; |
|
|
|
ff->cod_ctx->me_subpel_quality = 8; |
|
|
|
ff->cod_ctx->me_range = 16; |
|
|
|
ff->cod_ctx->gop_size = 250; |
|
|
|
ff->cod_ctx->keyint_min = 25; |
|
|
|
ff->cod_ctx->scenechange_threshold = 40; |
|
|
|
ff->cod_ctx->i_quant_factor = 0.71f; |
|
|
|
ff->cod_ctx->b_frame_strategy = 2; |
|
|
|
ff->cod_ctx->qcompress = 0.6f; |
|
|
|
ff->cod_ctx->qmin = 10; |
|
|
|
ff->cod_ctx->qmax = 51; |
|
|
|
ff->cod_ctx->max_qdiff = 4; |
|
|
|
ff->cod_ctx->max_b_frames = 3; |
|
|
|
ff->cod_ctx->refs = 5; |
|
|
|
ff->cod_ctx->directpred = 3; |
|
|
|
ff->cod_ctx->trellis = 1; |
|
|
|
ff->cod_ctx->flags2 |= CODEC_FLAG2_BPYRAMID | CODEC_FLAG2_MIXED_REFS |
|
|
|
| CODEC_FLAG2_WPRED | CODEC_FLAG2_8X8DCT |
|
|
|
| CODEC_FLAG2_FASTPSKIP; |
|
|
|
ff->cod_ctx->weighted_p_pred = 2; |
|
|
|
ff->cod_ctx->rc_lookahead = 50; |
|
|
|
} |
|
|
|
if (ff->fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER) |
|
|
|
ff->cod_ctx->flags |= CODEC_FLAG_GLOBAL_HEADER; |
|
|
|
|
|
|
|