user16570427
user16570427

Reputation:

Error when passing the scaled frame to the encoder `Encoder did not produce proper pts, making some up`

When I am passing the scaled frame to the encoder, I keep getting the error from the container mp4 code. The sws context is defined as:

encoder->sws_ctx = sws_getContext(1920, 1080,
                            AV_PIX_FMT_YUV420P, 
                           scaled_frame->width, scaled_frame->height, scaled_frame->format, SWS_BICUBIC, NULL, NULL, NULL );

The code for scaling the frame is as follows:

 sws_scale_frame(encoder->sws_ctx, scaled_frame, input_frame);
 if (encode_video(decoder, encoder, scaled_frame))
     return -1;

When I am passing the input_frame directly to the function encode_video I get no errors. So, I think the error is possibly from sws_scale_frame, maybe from the context or frame declarations. However, I am unable to figure out what?

The declaration of scaled_frame is as follows:

AVFrame *scaled_frame = av_frame_alloc();
scaled_frame->width = 854;
scaled_frame->height = 480;
scaled_frame->format = AV_PIX_FMT_YUV420P;

I have looked through the examples in the ffmpeg repo, but solution didn't work.

Upvotes: 1

Views: 1021

Answers (0)

Related Questions