[Libav-user] generating blank video frame?

David Henry dhenry at movenetworks.com
Sat Jan 28 00:52:49 CET 2012


I'm working on an application where if a UDP transport stream is lost/dropped for some time, I want to insert blank frames of video and silence for 
audio.

My calling sequence looks like this (inside a loop):

av_read_frame(m_formatInfo, &packet);
...
avcodec_get_frame_defaults(&frame);
avcodec_decode_video2(videoCodecInfo, &frame, &frameFinished, &packet);
...
converter = sws_getContext(...
sws_scale(converter,...

My question is: in this sequence, how do I generate a blank (black) frame instead of doing
the above sequence?  If the stream is lost, av_read_frame() just hangs out & I would like to create
blank frames in a separate thread.  I tried just creating an output buffer, same
size I get back from sws_scale() and doing a memset() 0 on it, but then my player plays a green frame for
that video.  I looked through the libavfilter/vf_blackframe.c code, but that is different from what I want
to do.


More information about the Libav-user mailing list