Linking two elements in a gstreamer application

William Metcalf wmetcalf at niftytv.com
Mon Jun 6 12:51:30 PDT 2011


I have the following gstreamer terminal pipeline which converts ogg 
video to mp4 video file, and it adjusts the resolution to 640X480:

gst-launch filesrc location="c:\\video.ogg" ! oggdemux ! theoradec ! 
ffmpegcolorspace ! videorate ! videoscale ! video/x-raw-yuv, width=640, \
height=480 ! ffenc_mpeg4 ! qtmux ! filesink 
location="c:\\video(convert).mp4"

I am attempting to convert it to a c application.  I have successfully 
converted almost the entire thing, except that I cannot get the video to 
scale to 640X480.  The resulting video file is encoded correctly and 
plays, but the resolution stays at the 720X400 resolution of the 
original file.  In my c application I am trying to connect the src pad 
of videoscale with the sink pad of ffenc_mpeg4 over a cap of 
video/x-raw-yuv width=640 height=480.

Here is the snippet of my code:

caps = gst_caps_new_simple("video/x-raw-yuv", "width", G_TYPE_INT, 640, 
"height", G_TYPE_INT, 480, NULL);
gst_element_link_filtered(video_scale, video_encoder, caps);

As I understand it, this should force the video output of video_scale 
(videoscale) to be of resolution 640X480, and this video should flow 
into the video_encoder (ffenc_mpeg4) and on into the muxer and into my 
video file.

I guess my question is: Is this the correct way to link videoscale and 
ffenc_mpeg4 in an application to force the resolution, or am I doing 
this wrong?

Thank you for your help,
William


More information about the gstreamer-devel mailing list