I'm following the tutorial on ffmpeg's documentation.
In tutorial01.c I couldn't compile because img_convert is deprecated.

Can some one show me how to rewrite the function with sws_scale?

Code were:

int frameFinished;AVPacket
<http://www.dranger.com/ffmpeg/data.html#AVPacket> packet;

i=0;
while(av_read_frame
<http://www.dranger.com/ffmpeg/functions.html#av_read_frame>(pFormatCtx,
&packet)>=0) {
  // Is this a packet from the video stream?
  if(packet.stream_index==videoStream) {
        // Decode video frame
    avcodec_decode_video
<http://www.dranger.com/ffmpeg/functions.html#avcodec_decode_video>(pCodecCtx,
pFrame, &frameFinished,
                         packet.data, packet.size);

    // Did we get a video frame?
    if(frameFinished) {
    // Convert the image from its native format to RGB
        img_convert
<http://www.dranger.com/ffmpeg/functions.html#img_convert>((AVPicture
<http://www.dranger.com/ffmpeg/data.html#AVPicture> *)pFrameRGB,
PIX_FMT_RGB24,
            (AVPicture
<http://www.dranger.com/ffmpeg/data.html#AVPicture>*)pFrame,
pCodecCtx->pix_fmt,
                        pCodecCtx->width, pCodecCtx->height);
        
        // Save the frame to disk
        if(++i<=5)
          SaveFrame(pFrameRGB, pCodecCtx->width,
                    pCodecCtx->height, i);
    }
  }

  // Free the packet that was allocated by av_read_frame
<http://www.dranger.com/ffmpeg/functions.html#av_read_frame>
  av_free_packet
<http://www.dranger.com/ffmpeg/functions.html#av_free_packet>(&packet);
}

//This line:

img_convert 
<http://www.dranger.com/ffmpeg/functions.html#img_convert>((AVPicture
<http://www.dranger.com/ffmpeg/data.html#AVPicture> *)pFrameRGB,
PIX_FMT_RGB24,
            (AVPicture
<http://www.dranger.com/ffmpeg/data.html#AVPicture>*)pFrame,
pCodecCtx->pix_fmt,
                        pCodecCtx->width, pCodecCtx->height);
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to