You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I try to record screen with gdigrab. Then put the screen recording data into the avframe, convert to yuv data via sws_scale, and try to convert yuv420p to h264 using avcodec_send_frame. But when I do:
ret = avcodec_send_frame(pH264EnCodecCtx, pFrameYUV);
I get: Assertion ((src_linesize) >= 0 ? (src_linesize) : (-(src_linesize))) >= bytewidth failed at libavutil/imgutils.c:314
Why? And how to solve this porblem!
code:
`//Read the data in the recorded screen--->packet
if (av_read_frame(pFormatCtx, packet) < 0)
break;
if (packet->stream_index == videoIndex) {
// Decode from screen recording stream, read raw data into pFrame
int ret = avcodec_send_packet(pDeCodecCtx, packet);
if (ret < 0) {
printf("Decoder: send packet failed.\n");
return -1;
}
ret = avcodec_receive_frame(pDeCodecCtx, pFrame);
if (ret < 0) {
printf("Decoder: receive frame failed.\n");
return -1;
}
// Convert video frames from screen recording data space format to YUV space format
sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0, pDeCodecCtx->height, pFrameYUV->data, pFrameYUV->linesize);
// Encode YUV data to h264
ret = avcodec_send_frame(pH264EnCodecCtx, pFrameYUV);
if (ret < 0) {
printf("Encoder: send frame failed.\n");
return -1;
}
ret = avcodec_receive_packet(pH264EnCodecCtx, packet);
if (ret < 0) {
printf("Encoder: receive packet failed.\n");
return -1;
}`
The text was updated successfully, but these errors were encountered:
Hi, I try to record screen with gdigrab. Then put the screen recording data into the avframe, convert to yuv data via sws_scale, and try to convert yuv420p to h264 using avcodec_send_frame. But when I do:
ret = avcodec_send_frame(pH264EnCodecCtx, pFrameYUV);
I get:
Assertion ((src_linesize) >= 0 ? (src_linesize) : (-(src_linesize))) >= bytewidth failed at libavutil/imgutils.c:314
Why? And how to solve this porblem!
code:
`//Read the data in the recorded screen--->packet
if (av_read_frame(pFormatCtx, packet) < 0)
break;
The text was updated successfully, but these errors were encountered: