[Libav-user] Encoding FLV gives green screen output
Alex Cohn
alexcohn at netvision.net.il
Mon May 6 20:51:28 CEST 2013
On Sun, May 5, 2013 at 2:59 PM, yy-zed <samhalligan15 at gmail.com> wrote:
I've written a piece of C++ code that can capture webcam video frame, decode
> them, convert them to YUV420P, encode them and then write them to a file.
> If
> I use the mpeg2 codec and write to a .mpg file, everything works perfectly.
> But, if I use flv, then the output produced is just a green screen. I'm not
> sure if there are different encoder settings I need to set for encoding flv
> video?Or maybe I'm doing something wrong in sws_scale? Here's my code(the
> relevant parts):
>
> //Read a video frame in
> av_read_frame(pFormatCtx,&packet);
>
> //Decode the contents of packet into pFrame
> avcodec_decode_video2(pCodecCtx,pFrame,&frameFinished,&packet);
>
>From your snippet, it is not clear what pCodecCtx is, but anyways it's good
practice to check the return code from avcodec_decode_video2() and
frameFinished, before you pass pFrame to sws_scale().
BR,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130506/62422848/attachment.html>
More information about the Libav-user
mailing list