[Ffmpeg-devel] problem decoding blank/black mpg. Gives 2 vertical strips when frame is saved
Pranav Desai
pranavdesai
Fri Jan 27 08:28:01 CET 2006
Hello All,
Hope this is the right mailing list for this questions. Let me know if it
isnt.
I am doing some testing on blank frame detection using lavc to detect
commercial. I am using some code from mythtv commflag. So I thought I will
start by testing it on a blank mpg itself.
I created a blank/black mpg using the output_example.c provided with ffmpeg.
I made all the Y values to 0 and UV values 128 in fill_yuv_image(). I am not
sure if this the right way to do it, but it does generate a blank/black mpg
(I can attach it if needed).
I then use the avcodec_example.cpp provided here (
http://www.inb.uni-luebeck.de/~boehme/libavcodec_update.html). This link is
on the ffmpeg doc pages. This program saves the first 5 frames of an mpg
video.
Below is a part of the code.
When the frame is converted to RGB, it seems to correctly give a blank
image. But if YUV is used , there are 2 vertical white stripes on the image.
I have attached a jpg version of the frame saved using the program below.
I am not sure what am I doing wrong.
I would really appreciate if someone could help me out with this.
Thanks for taking the time to read this and let me know if you need the
above mentioned code. I can send it as a separate mail.
Thanks
-Pranav
-------------------------------------------------------------------
while(av_read_frame(pFormatCtx, &packet)>=0)
{
// Is this a packet from the video stream?
if(packet.stream_index==videoStream)
{
// Decode video frame
avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,
packet.data, packet.size);
// Did we get a video frame?
if(frameFinished)
{
// Convert the image from its native format to RGB
img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24,
(AVPicture*)pFrame, pCodecCtx->pix_fmt,
pCodecCtx->width, pCodecCtx->height);
// Save the frame to disk
if(++i<=5) {
//SaveFrame(pFrameRGB, pCodecCtx->width,
pCodecCtx->height, i);
SaveFrame(pFrame, pCodecCtx->width, pCodecCtx->height,
i);
}
}
}
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
-------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: frame1.jpg
Type: image/jpeg
Size: 2076 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060126/3cc2ab2c/attachment.jpg>
More information about the ffmpeg-devel
mailing list