Many things for the input.

I removed the codepar stuff and the extra sets on the av_encode_codec_ctx
Also removed avcodec_parameters_to_context

Now I end up where I started, that the output ctx fails...
Stream #0:0: Unknown: none (h264_nvenc)
[mp4 @ 0x1277d60] Using AVStream.codec to pass codec parameters to muxers is 
deprecated, use AVStream.codecpar instead.
[mp4 @ 0x1277d60] dimensions not set

How do I get from avformat_new_stream to avformat_write_header?

avcodec_find_encoder
avformat_alloc_output_context2
  avformat_new_stream /// Tried at multiple locations
av_dict_set
avcodec_alloc_context3
   /// tried new stream here
set codec ctx
avcodec_open2
   /// tried new stream here
avio_open
avformat_write_header

It seems like my output context does not use the encoder ctx for information???

Thanks
cco


On 08/23/2016 09:47 AM, Nicolas George wrote:
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,



_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to