Saturday, 15 June 2013

Gstreamer Elements not linking -



Gstreamer Elements not linking -

i new gstreamer , have question why elements not link together. here code:

customdata data; data.videosource = gst_element_factory_make("uridecodebin", "source"); cout << "created source element " << data.videosource << endl; data.demuxer = gst_element_factory_make("qtdemux", "demuxer"); cout << "created demux element " << data.demuxer << endl; data.decoder = gst_element_factory_make("ffdec_h264", "video-decoder"); cout << "went video path " << data.decoder << endl; data.videoconvert = gst_element_factory_make("ffmpegcolorspace", "convert"); cout << "created convert element " << data.videoconvert << endl; data.videosink = gst_element_factory_make("autovideosink", "sink"); cout << "created sink element " << data.videosink << endl; if (!data.videosource ||!data.demuxer || !data.decoder || !data.videoconvert || !data.videosink) { g_printerr ("not elements created.\n"); system("pause"); return; } //creating pipeline data.pipeline = gst_pipeline_new("video-pipeline"); if (!data.pipeline) { g_printerr ("pipeline not created."); } //setting object g_object_set(data.videosource, "uri", videofilename[camid] , null); //videofilename[camid] char** content uri=file:///c://videofiles/...mp4 //adding elements pipeline gst_bin_add_many(gst_bin (data.pipeline), data.videosource, data.demuxer, data.decoder, data.videoconvert, data.videosink, null); //this issue occurs if(!gst_element_link(data.videosource, data.demuxer)){ g_printerr("elements not linked. \n"); system("pause"); return; }

what trying break downwards mp4 file , display video content reason when seek link source , demuxer, comes out false.

thank guys much!

let's have @ pipeline you're using (i'll utilize gst-launch here brevity, same goes gstreamer pipelines):

gst-launch uridecodebin uri=file:///path/to/movie.avi \ ! qtdemux ! ffdec_h264 ! ffmpegcolorspace \ ! autovideosink

gst-inspect uridecodebin states: autoplug , decode uri raw media

so uridecodebin takes audio/video source , decodes internally using of gstreamer's other elements. output video/x-raw-rgb or audio/x-raw-int (raw audio/video)

qtdemux on other hand takes quicktime stream (still encoded) , demuxes it.

but gets in illustration decoded raw video (which why won't link).

so, you've got 2 options:

just utilize uridecodebin

gst-launch uridecodebin uri=file:///path/to/movie.avi \ ! autovideosink

which allow pipeline decode pretty much video file

just utilize qtdemux ! ffdec_h264 ! ffmpegcolorspace elements:

gst-launch filesrc=/path/to/movie.avi \ ! qtdemux ! ffdec_h264 ! ffmpegcolorspace ! autovideosink

keep in mind pipeline doesn't play audio. 1 of following:

simply utilize playbin2

gst-launch playbin2 uri=file:///path/to/movie.avi connect decodebin sound sink gst-launch uridecodebin name=d uri=... ! autovideosink d. ! autoaudiosink

gstreamer

No comments:

Post a Comment