<div dir="ltr">On Sun, May 5, 2013 at 2:59 PM, yy-zed <span dir="ltr"><<a href="mailto:samhalligan15@gmail.com" target="_blank">samhalligan15@gmail.com</a>></span> wrote:<div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I've written a piece of C++ code that can capture webcam video frame, decode<br>
them, convert them to YUV420P, encode them and then write them to a file. If<br>
I use the mpeg2 codec and write to a .mpg file, everything works perfectly.<br>
But, if I use flv, then the output produced is just a green screen. I'm not<br>
sure if there are different encoder settings I need to set for encoding flv<br>
video?Or maybe I'm doing something wrong in sws_scale? Here's my code(the<br>
relevant parts):<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">//Read a video frame in<br>
av_read_frame(pFormatCtx,&packet);<br>
<br>
//Decode the contents of packet into pFrame<br>
avcodec_decode_video2(pCodecCtx,pFrame,&frameFinished,&packet);<br></blockquote><div><br></div><div>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().</div>
<div><br></div><div>BR,</div><div>Alex</div></div></div></div>