ffmpeg scaling example.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ffmpeg scaling example.

Hi All,
Scaling_video.c example file modified to convert 1080p_YUV420 file to
240pYUV420. After conversion  Luma content is fine, but chroma(color)
contents are mismatching with original file.
I attached modified code, please direct me to get correct chroma contents
 long int resol = (src_w * src_h *3)>>1;
        int noframes = opusFileSize/resol;
        printf("No of frames%d\n", noframes);
        unsigned char* pYUV = NULL;
        pYUV = (unsigned char *) malloc( resol);
        if (pYUV == NULL)

        src_data[0] = pYUV;
        src_data[1] =  pYUV + (src_w *src_h);
        src_data[2] =  pYUV + (resol>>2);
        src_linesize[0]= src_w;
        src_linesize[1]= src_linesize[2]= src_w >>1;
        for (i = 0; i < noframes; i++) {
                /* generate synthetic video */
                //fill_yuv_image(src_data, src_linesize, src_w, src_h, i);
                memset( pYUV, 0, resol );
                fread(pYUV, 1, resol, fp);
                /* convert to destination format */
                sws_scale(sws_ctx, (const uint8_t * const*)src_data,
                                src_linesize, 0, src_h, dst_data,
                /* write scaled image to file */
                fwrite(dst_data[0], 1, dst_bufsize, dst_file);

Thanks & Regards
Vittal Prasad B R
ffmpeg-user mailing list
[hidden email]

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".