Le septidi 7 fructidor, an CCXXIV, Charles a écrit : > 4) parameters = video_st->codecpar; > parameters->codec_tag = tag; > parameters->format = AV_PIX_FMT_YUV420P; > parameters->bit_rate = 5e6; > parameters->width = 1024; > parameters->height = 768; > parameters->bit_rate = 5e6;
You are not supposed to fill the stream's parameters with random values, you
are supposed to fill them with the values used by the encoder. These values
will be very similar to the settings you chose for the encoder, but the
encoder is allowed to tweak them.
> 5) av_encode_codec_ctx = avcodec_alloc_context3( av_encode_codec )
> av_encode_codec_ctx->bit_rate = 5e6;
> av_encode_codec_ctx->width = 1024; /// \note multiple of 2
> av_encode_codec_ctx->height = 768; /// \note multiple of 2
> av_encode_codec_ctx->time_base = (AVRational) { 1, 60 }; //* 2;
> av_encode_codec_ctx->gop_size = 15; // Intra frames per x P frames
> av_encode_codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P; // MUST DO NOT
> CHANGE nvenc required
> // This appears to make h264_nvenc happy
> 6) avcodec_parameters_to_context( av_encode_codec_ctx, parameters )
You are still overwriting the parameters of the encoder. It can not work.
The parameters are used for communication from demuxers to decoders and from
encoders to muxers. They are output from the decoders and you are using them
as input.
Regards,
--
Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
