video from one video stream into multiple files
gagankumarnigam
gagankumarnigam at bel.co.in
Thu Aug 20 01:14:49 PDT 2015
Hi,
I'm trying to store video from one video stream into multiple files with
given duration.
(If I am using simple filesink for storing avi video to one file i am
getting good result-> video will be stored in avi format the same can be
dispalyed).
If i am using same code with multifilesink to store one video into multipile
files:
g_object_set (G_OBJECT(multifilesink),
"location","output%d.avi","next-file", 3, "post-messages", TRUE,
"max-files",9,"max-file-size",1024,NULL);
it stared creating numbers of file of 8 bit each in uncontrolled manner and
with out video data. no created file is dispalying video.
My requirement is to store video upto 40mb after that it will start store
automatically in next file till it reached 40mb size and then again start
for next 40mb.
something like video1.avi(size 40mb)...video2.avi(size40mb).....
Code is given below. Can some body tells me what is the problem in the code.
code Something which could look like this:
int main(int argc, char* argv[])
{
GMainLoop *loop;
gst_init(&argc,&argv);
loop = g_main_loop_new (NULL, FALSE);
GstElement *pipeline, *source, *tee, *queue, *tover, *xvsink, *equeue,
*vencoder, *muxer, *multifilesink;
GstBin *recording;
GstBus *bus;
GstPad *srcpad,*sinkpad;
// Create gstreamer elements
pipeline = gst_pipeline_new ("Live Recording");
source = gst_element_factory_make ("v4l2src",
"viewing-file-source");
tee = gst_element_factory_make ("tee", "viewing-tee");
queue = gst_element_factory_make ("queue2","viewing-queue");
xvsink = gst_element_factory_make ("xvimagesink","viewing-xvsink");
recording = GST_BIN(gst_bin_new("recording-bin"));
equeue = gst_element_factory_make ("queue2", "encoding-queue");
vencoder = gst_element_factory_make ("ffenc_mpeg4",
"encoding-encoder");
muxer = gst_element_factory_make ("avimux", "encoding-muxer");
//mp4mux
multifilesink = gst_element_factory_make
("multifilesink","encoding-filesink");
if(!pipeline || !source || !xvsink )
{
g_print("Unable to create all necessary elements\n");
return -1;
}
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
g_object_set (G_OBJECT(multifilesink),
"location","output%d.avi","next-file", 3, "post-messages", TRUE,
"max-files",9,"max-file-size",1024,NULL);
gst_bin_add_many (recording, equeue, vencoder, muxer, multifilesink,
NULL);
sinkpad = gst_element_get_static_pad(equeue,"sink");
GstPad *ghost = gst_ghost_pad_new("vsink",sinkpad);
if(ghost == NULL)
{
g_error("Unable to create ghostpad!\n");
}
gst_element_add_pad(GST_ELEMENT(recording),ghost);
gst_object_unref(GST_OBJECT(sinkpad));
gst_element_link_many(equeue,vencoder,muxer,multifilesink,NULL);
gst_bin_add_many (GST_BIN (pipeline), source, tee, queue, xvsink,
recording, NULL);
/* link video elements */
gst_element_link_many(source,tee,NULL);
srcpad = gst_element_get_request_pad(tee,"src0");
sinkpad = gst_element_get_pad(queue,"sink");
gst_pad_link(srcpad,sinkpad);
gst_element_link(queue,xvsink);
/* link the viewing pipeline into the bin */
srcpad = gst_element_get_request_pad(tee,"src1");
sinkpad = gst_element_get_pad(GST_ELEMENT(recording),"vsink");
gst_pad_link(srcpad,sinkpad);
g_print ("Running...\n");
gst_element_set_state(pipeline,GST_STATE_PLAYING);
g_main_loop_run (loop);
/* Out of the main loop, clean up nicely */
g_print ("Returned, stopping playback\n");
gst_element_set_state (pipeline, GST_STATE_NULL);
g_print ("Deleting pipeline\n");
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}
thanks in advance
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gst-app-sink-pull-buffer-takes-a-long-time-to-get-data-from-a-pipeline-about-130ms-tp4435405p4673276.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list