If the original video is bgr24, do you need to make a call to avcodec_decode_video? Isn't the video already decoded and you just need to do a color space transformation?
BTW, I can't get any of the RGB or BGR formats to succeed with sws_scale, I've had to revert to img_convert and then only some of them will succeed. The functions don't fail, they simply put out black frames. SVN Revision 12279, Windows Vista ----- Original Message ----- From: "DONGIEUX Christophe" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, March 13, 2008 1:34 PM Subject: [libav-user] Problems with rawvideo and BGR24 format videos :pFrame->linesize is negative > Hello, > > I have a problem when trying to decode a rawvideo BGR24 format video : my > frame->linesize is always negative, so I can't scale my frame using > sws_scale because it crashes. > > Here is the dump_format output : > > Duration: 00:00:40.0, start: 0.000000, bitrate: 66360 kb/s > Stream #0.0: Video: rawvideo, bgr24, 384x288 [PAR 0:1 DAR 0:1], 25.00 > tb(r) > > > Here is a bit of code : > > void init() > { > ... > p_codecCtx = p_formatCtx->streams[ m_videoStream ]->codec; > p_SWSCtx = sws_getContext( p_codecCtx->width, p_codecCtx->height, > p_codecCtx->pix_fmt, p_codecCtx->width, > p_codecCtx->height, PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL ); > ... > p_frame = avcodec_alloc_frame(); > p_frameRGB = avcodec_alloc_frame(); > m_frameSize = avpicture_get_size( PIX_FMT_RGB32, p_codecCtx->width, > p_codecCtx->height ); > ... > } > > int decodePacket( AVPacket& packet ) > { > int frameFinished; > > // returns p_frame->linesize < 0 > int ret = avcodec_decode_video( p_codecCtx, p_frame, &frameFinished, > packet.data, packet.size ); > > if ( !frameFinished ) > { > // ... > return 0; > } > > return ret; > } > > void scale() > { > // crashes because p_frame->lineseize < 0 > > sws_scale( p_SWSCtx, p_frame->data, p_frame->linesize, 0, > p_codecCtx->height, > p_frameRGB->data, p_frameRGB->linesize); > } > > > > I can play videos with others formats with this code without any problem. > > Do you have an idea ? What do I do wrong ? > Thanks in advance. > > ps : I'm using SVN version, revision 11213. > > > _______________________________________________ > 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
