[FFmpeg-user] h264 screenshot from multicast

Ståle Kristoffersen staalebk at ifi.uio.no
Mon Jul 1 12:06:04 CEST 2013


Hi guys, I'm trying to generate a thumbnail from a multicast stream and I'm
running into problems with h264 streams. I have written a small program to
subscribe to a multicast stream, and write out the video-pid to disk and
then run ffmpeg on it. Sometimes (1 out of 20 times perhaps) the output
will be mostly gray (as in, they are missing some or most of their
reference frames). One possible solution is to have it capture more data
and generate thumbnail for a point in time a couple of seconds into the
stream. While this works, it slows down the process a lot, and I want it to
be as fast as possible. 

Is there a way to detect that the thumbnail generated is missing some
reference data?

Here is an example file that does not work:
http://kolbu.ws/~chiller/h264fail.ts

When I run it like this:
# ffmpeg -i h264fail.ts -vframes 1 badframe.jpg
this is the output:
http://pastebin.com/KsVDqwPz
and this is the file generated:
http://kolbu.ws/~chiller/badframe.jpg

If I ask for it to decode one second first, like this:
# ffmpeg -i h264fail.ts -vframes 1 -ss 1 goodframe.jpg
this is the output:
http://pastebin.com/kwijcivf
(The exact same output from ffmpeg, but with twice the run time)
and this is the frame generated:
http://kolbu.ws/~chiller/goodframe.jpg

I can live with a couple of frames getting bad, as long as I could find a
way to detect if it was happening, but the preferred way would be to have
it decode until the frame was good, and then stop.

Anyone have any input on what I could do?

-- 
Ståle Kristoffersen
staalebk at ifi.uio.no


More information about the ffmpeg-user mailing list