2011/2/17 Gilles Maire <[email protected]> > 2011/2/17 Jérémie Klein <[email protected]> > > > 2011/2/17 Gilles Maire <[email protected]> > > > > > 2011/2/16 Jérémie Klein <[email protected]> > > > > > > > Hi all, > > > > > > > > To start making my hand dirty with ffmpeg, i tried to adapt the > sample > > > > available on the site to the git version of ffmpeg > > > > (using avcodec_decode_video2, sws_alloc_context, sws_init_context and > > > > sws_scale), but the only thing i obtain at the end is a serie of > really > > > > nice > > > > black pictures. > > > > > > > > When viewing the file in hex format, i obtain the good values for the > > > > header > > > > (P6.512 512.255) butthen, the the image is filled with 0x00 until the > > end > > > > (which explains the black). > > > > I must be missing something. > > > > > > > > I have tested the examples one month ago and it worked with a mpeg2 > > file. > > > Don't you have 5 black images ate the begin of the video ? > > > > > > > Hello, thank you for your prompt answer. > > > > I first thought of it, so i checked with frames beetwen the 10000th and > > 15000th but i got the same issue. > > I thought that maybe the video i was using had something wrong, so i made > > my > > own video (using ffmpeg) with flat images but the result is still the > same > > (black images). > > > > > In your code I don't recognize a sequence and you don't put null value > > > > Try to replace > > img_convert_ctx = sws_alloc_context(); > > av_set_int(img_convert_ctx, "srcw", pCodecCtx->width); > av_set_int(img_convert_ctx, "srch", pCodecCtx->height); > av_set_int(img_convert_ctx, "dstw", pCodecCtx->width); > av_set_int(img_convert_ctx, "dsth", pCodecCtx->height); > av_set_int(img_convert_ctx, "src_format", pCodecCtx->pix_fmt); > av_set_int(img_convert_ctx, "dst_format", PIX_FMT_RGB24); > av_set_int(img_convert_ctx, "sws_flags", SWS_BICUBIC); > > av_set_int(img_convert_ctx, "src_range", 1); > av_set_int(img_convert_ctx, "dst_range", 1); > > by > > img_convert_ctx = sws_getContext(pCodecCtx->width, > pCodecCtx->height, > pCodecCtx->pix_fmt, > pCodecCtxt->width, > pCodecCtx->height, > PIX_FMT_RGB24, > SWS_BICUBIC,(int)NULL,NULL,NULL); > > To see ..
You spotted the problem. Using sws_getContext() works like a charm, i obtain the image in the end. But as sws_getContext() is marked as deprecated , is it not better using sws_alloc_context() ? Do you know what i am doing wrong ? Jérémie Klein _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
