I have already connected and opened camera successfully. But I can not transfor 
frame data from AV_PIX_FMT_YUVJ422P to AV_PIX_FMT_BGR24 after decoding. As I 
call method sws_scale, 'bad dst iamge pointers' shows up. Any help will be 
appreciate, my code:


     AVFrame* pFrame, * pFrameYUV;
     pFrame = av_frame_alloc();
     pFrameYUV = av_frame_alloc();

     int ret, got_picture;
     AVPacket* packet = (AVPacket*)av_malloc(sizeof(AVPacket));

     struct SwsContext* img_convert_ctx;
     img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, 
pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, AV_PIX_FMT_BGR24, 
SWS_BICUBIC, NULL, NULL, NULL);

     if (av_read_frame(pFormatCtx, packet) >= 0) {
          if (packet->stream_index == videoindex) {
               ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, 
packet);
               if (ret < 0) {
                    return NULL;
               }
               if (got_picture) {
                    sws_scale(img_convert_ctx, (const unsigned char* 
const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameYUV->data, 
pFrameYUV->linesize);
               }
          }
          av_free_packet(packet);
     }

| |
李罗
|
|
邮箱bruce_lee0...@163.com
|

签名由 网易邮箱大师 定制
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to