Libx264 coding error Input image width (40) greater than step (0)

I used libx264 in ffmpeg to encode the video, I used the configuration below.

enCodecContext->bit_rate = 300000;
enCodecContext->width = 80;
enCodecContext->height = 60;
enCodecContext->time_base = (AVRational) {1, 25};
enCodecContext->gop_size = 10;
enCodecContext->max_b_frames = 1;
enCodecContext->pix_fmt = PIX_FMT_YUV420P;
enCodecContext->qcompress = 0.6;
av_opt_set(enCodecContext->priv_data, "preset", "slow", 0);

But when I called avcodec_encode_video2with enCodecContext, I got an error Input picture width (40) is greater than stride (0).

avcodec_encode_video2(enCodecContext, &filteredAVPacket, pFilteredAVFrame, &got_packet_ptr);

pFilteredAVFrame->widthand pFilteredAVFrame->heightcorrespond 80and 60respectively.

I missed something when configured libx264, How can I get a workable configuration libx264for encoding my video?

+4
source share
1 answer
+1

Source: https://habr.com/ru/post/1621832/


All Articles