You need libjpeg.
On Thu, Aug 5, 2010 at 10:58 AM, Hoang Ong <[email protected]> wrote:
> Hi everybody,
>
> I can get the AVFrame and output it to a raw image file (.ppm) I try to use
> sws_scale to convert that image to variety of image type to save it as a jpg
> file but it not work. I think it not a way to do.
>
> I dont have much knowledge about image processing. So anybody know how to
> use ffmpeg's libs to convert AVFrame to jpg please help me. The code I used
> to save frame as a ppm file like this:
>
> void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame)
> {
> FILE *pFile;
> char szFilename[32];
> int y;
>
> // Open file
> sprintf(szFilename, "frame.ppm", iFrame);
> pFile=fopen(szFilename, "wb");
> if(pFile==NULL)
> return;
>
> // Write header
> fprintf(pFile, "P6\n%d %d\n255\n", width, height);
>
> // Write pixel data
> for(y=0; y<height; y++)
> fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, width*3, pFile);
>
> // Close file
> fclose(pFile);
> }
>
> Regards
> Hoang Ong
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user