Cant take an immediate screenshot image of static video from h264 rtp stream

anno domini genericgroupmail at gmail.com
Thu Sep 18 06:34:01 PDT 2014


HI All,

Would really appreciate any suggestions for an issue i am experiencing.
I had been happily taking screenshots from a regular v4l2src linux device
using gstreamer using the following pipeline (i am using pythons gstreamer
packages for this):

v4l2src device=/dev/video1 norm=PAL ! ffmpegcolorspace ! valve
name=video_capture_valve drop=true ! videoscale ! video/x-raw-rgb, bpp=24,
width=720, height=576, pixel-aspect-ratio=1/1 ! pngenc snapshot=true
compression-level=1 ! filesink location=/tmp/blah.png

The valve is just so i can control exactly when to take the snapshot. When
it is opened (i.e. drop=false) the png is generated almost immediately.

However, when I changed the src to be udpsrc receiving h264 RTP video it
sometimes takes up to 40 seconds after opening the valve before the png is
created.
A bit of investigation shows that this only happens when the video content
is static (e.g. a video of pure black or just motionless content). I'm
guessing this is because with h264 compression, static video produces very
little bits and hence it takes longer before the buffers build up enough to
empty down through the pipeline:

udpsrc port=8555 ! application/x-rtp, payload=96 ! rtph264depay !
ffdec_h264 ! ffmpegcolorspace ! valve name=video_capture_valve drop=true !
videoscale ! video/x-raw-rgb, bpp=24, width=720, height=576,
pixel-aspect-ratio=1/1 ! pngenc snapshot=true compression-level=1 !
filesink location=/tmp/blah.png

So my question is does anyone have any suggestions as to how i could change
things to ensure an immediate screenshot/image is taken?

Just for completion, here is the command line pipeline i use to generate
the RTP source in the first place:

gst-launch -v -e v4l2src device=/dev/video1 norm=PAL ! videoscale !
video/x-raw-rgb, width=720, height=576, pixel-aspect-ratio=1/1 !
ffmpegcolorspace ! tee name=videoTee \
videoTee. ! queue ! x264enc tune="zerolatency" threads=1 intra-refresh=true
! rtph264pay config-interval=2 ! udpsink port=8554

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140918/97855e0a/attachment.html>


More information about the gstreamer-devel mailing list