[gst-devel] Changing video size at runtime using videoscale

Romit Chatterjee romit.chatterjee at gmail.com
Thu Nov 9 05:43:41 CET 2006


I've written an test application to play .mp4 video files. The pipeline is :
filesrc -> qtdemux -> ffdec_mpeg4 -> sdlvideosink. The pipeline is working
fine. Now I want to have runtime video scaling. So I included videoscale in
between ffdec_mpeg4 and sdlvideoscale. When I set the caps of videoscale src
pad while creating the pipeline, I can set different video sizes. However I
want to know how I can reset the video size to a different heightXwidth when
the pipeline in already playing (say, after 3 seconds of playback, the video
size should become half of original size). I have a callback registered,
which gets called after 3 seconds. Inside the callback, I'm trying to set
the caps of the videoscale src pad, but its not working. The video is
playing for first 3 seconds and then getting EOS. Can someone please let me
know the correct method to achive my goal?

Given below is my callback code...

Callback function (input : height, width of the original video)
pad = gst_element_get_pad(videoscale, "src");

newpadcaps = gst_caps_new_simple("video/x-raw-yuv",
                                    "format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC('I', '4', '2', '0'),
                                    "width", G_TYPE_INT, (width/2),
                                    "height", G_TYPE_INT, (height/2),
                                    "framerate", GST_TYPE_FRACTION, 15,1,

gst_pad_set_caps (pad, newpadcaps);
return FALSE;

......Do I need to do something additional (like pausing the pipeline before
changing caps, or unlinking-relinking the videoscale element)? Couldn't find
much documentation on the topic.

Thanks in advance for your time :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20061109/b7e94bf8/attachment.htm>

More information about the gstreamer-devel mailing list