[gst-devel] how to encode to jpeg plz help
sfaizanh
sfaizanh at yahoo.com
Tue Dec 21 23:57:59 CET 2010
hi i have just found out a bug in my program, when i was coding on my pc i
got different camera, now when i switched my application to laptop it dosent
run because of camera
here is my code and gst command line:
Command Line:
gst-launch v4l2src !
image/jpeg,width=320,height=240,framerate=\(fraction\)20/1 !
ffmpegcolorspace ! tee name=t ! udpsink host=127.0.0.1 port=5000 t. ! queue
! jpegdec ! xvimagesink
C code
GstCaps *caps;
// Outgoing Pipelines
videoPipeline = gst_pipeline_new("videoPipeline");
audioPipeline = gst_pipeline_new("audioPipeline");
/* create video elements */
src = gst_element_factory_make("v4l2src", "video-src");
splitter = gst_element_factory_make("tee", "video-splitter");
sink = gst_element_factory_make("xvimagesink", "video-localsink");
videoStream = gst_element_factory_make("udpsink", "video-transmitter");
queue1 = gst_element_factory_make("queue","queue1");
queue2 = gst_element_factory_make("queue","queue2");
videoDec = gst_element_factory_make("jpegdec", "decoder");
videoFilter = gst_element_factory_make ("ffmpegcolorspace", "filter");
if (!videoPipeline)
{
printf("GStreamer Error: Could not create pipeline\n");
}
if(!src || !videoStream || !sink || !videoDec || !videoFilter)
{
printf("GStreamer Error: Video Elements: Could not create element\n");
}
if (!splitter)
{
printf("GStreamer Error: Splitter Element: Could not create video
splitter\n");
}
if (!videoStream)
{
printf("Stream Creation failure.\n");
}
g_object_set(G_OBJECT(src),"device","/dev/video0",NULL);
caps = gst_caps_new_simple ("image/jpeg",
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240,
"framerate",GST_TYPE_FRACTION,100,1,
NULL);
// UDP Connection
g_object_set(G_OBJECT(videoStream),"host",ipaddr, "port", outputPort,
NULL);
gst_bin_add_many(GST_BIN(videoPipeline),src, splitter, sink, videoDec,
videoFilter, videoStream, queue1, queue2, NULL);
if(!gst_element_link_many(src, splitter, NULL))
{
printf("Source -> Splitter Link failure\n");
}
pad1 = gst_element_get_request_pad(splitter, "src%d");
pad2 = gst_element_get_request_pad(splitter, "src%d");
gst_element_link(splitter, queue1);
gst_element_link(splitter, queue2);
if(!gst_element_link_filtered (queue1, videoStream, caps)) {
printf("Link between queue and stream failed.\n");
}
if (!gst_element_link_many(queue2, videoDec, videoFilter, sink, NULL))
{
printf("queue -> Local Src link failed\n");
}
now i want to encode it to jpep because my camera dosent support image/jpeg
but it supports video/x-raw-yuv, so i figured out the command line
gst-launch v4l2src !
video/x-raw-yuv,width=320,height=240,framerate=\(fraction\)5/1 !
ffmpegcolorspace ! jpegenc ! tee name=t ! udpsink host=127.0.0.1 port=5000
t. ! queue ! jpegdec ! xvimagesink
now can any body explain me how to enccode it :S
im stuck in code :S
-queue -> updsink
Source -> encode.to.jpeg -> filter -> tee
-queue ->
decode.jpeg > xvimagesink
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/how-to-encode-to-jpeg-plz-help-tp3159848p3159848.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list