[vlc-devel] Green areas in the video when using vlc streaming

Jean-Paul Saman jean-paul.saman at planet.nl
Sun Aug 12 17:44:10 CEST 2007

Herman Schultz wrote:
> On 7/30/07, Jean-Paul Saman <jean-paul.saman at planet.nl> wrote:
>> Herman Schultz wrote:
>>> On 7/20/07, Jean-Paul Saman <jean-paul.saman at planet.nl> wrote:
>>>> Herman Schultz wrote:
>>>>> Hi,
>>>>> I am using VLC streaming (as a boardcaster) to Darwin.
>>>>> But when I use a video client (e.g. quicktime/vlc) to watch that
>> stream
>>>> by
>>>>> hitting Darwin, I see a lot of green rectangles in the video in the
>>>>> beginning. (see attached screen shot).
>>>>> Can you please tell me what is wrong? And how can i fix it?
>>>> I suspect this is due to a missing key frame. The decoder just fills in
>>>> the blank in that case. Which of course when missing the first keyframe
>>>> can produce strange effects.
>>> Jean-Paul,
>>> I am seeing the same 'green area' issue in the result mp4 file when  I
>> use
>>> VLC to transcode a flv file. Here is the parameter that I used for
>>> transcoding:
>>>   ./vlc -vvv -I dummy ~/Desktop/video.flv --sout
>> '#transcode{vcodec=mp4v,vb=400,acodec=mpga,ab=128,audo-sync}:standard{access=file,
>>> mux=mp4, dst=/home/herman/genvlc.mp4}'
>>> I think you are right in saying the 'green area' problem is caused by a
>>> missing key frame.  I put
>>> more debug print statement in my ffmpge+vlc code. And it did say 'first
>>> frame is no keyframe' and i notice that the first frame passed to
>>> MPV_frame_start is type 2 ( FF_P_TYPE , not 1 (FF_I_TYPE) that I
>> expected).
>> The only thing you can do is to get rid of the green area is to make
>> sure the first frame is a key-frame (I_TYPE). In your case that would
>> mean to dump all frames until the first key-frame is found.
>> You could try to force this by modifying packetizer/mpeg4video.c to take
>> an option "force-start-on-keyframe" (or something like that).
> Jean-Paul,
> After going thru the code more, I find out where in the vlc code drop the
> first key frame.
> It is dropped in this method:
> Packetize ( decoder_t *p_dec, block_t **pp_block )
> of the module/packetizer/copy.c
> the reason it gets dropped is beause 'p_block->i_dts = 0' and the code in
> Packetize() is like this:
>    if( p_block->i_dts <= 0 )
>     {
>       msg_Dbg( p_dec, "need dts > 0 %d %d\n", p_block->i_dts,
> p_block->i_buffer  );
>         block_Release( p_block );
>     msg_Dbg( p_dec, "done call packetize 2\n" );
>         return NULL;
>     }

The code looks correct to me. You need DTS/PTS for streaming data 
otherwise it is impossible to reconstruct the video at the correct 

> Can you please tell me how can i fix this, or what causes the packet
> (p_block)'s i_dts to be 0?

Wrongly encoded? Malformed frame?? I have no clue.

Jean-Paul Saman.
vlc-devel mailing list
vlc-devel at videolan.org

More information about the vlc-devel mailing list