I succely save the video streaming in .mkv with matroskamux but when I open it with vlc, I can not advance the video with the timebar. Do you have any idea? I add offset-to-zero but nothing change.
GError* error = NULL;
GstElement* source;
GstElement* filesink;
GstElement* matrox;
GstCaps* caps = gst_caps_new_simple("application/x-rtp",
"media", G_TYPE_STRING, "video",
"payload", G_TYPE_INT, 96,
"encoding-name", G_TYPE_STRING, "H264",
NULL);
pipeline = gst_parse_launch("udpsrc name=source ! rtpjitterbuffer !rtph264depay !h264parse !avdec_h264 ! tee name = t !queue !autovideoconvert !matroskamux name=matrox !filesink name=myFile t. ! queue ! videoconvert !d3dvideosink name=mysink", &error);
filesink = gst_bin_get_by_name(GST_BIN(pipeline), "myFile");
g_object_set(filesink, "location", strPathVideo.c_str(), NULL);
matrox = gst_bin_get_by_name(GST_BIN(pipeline), "matrox");
g_object_set(G_OBJECT(matrox), "offset-to-zero", true, NULL);
source = gst_bin_get_by_name(GST_BIN(pipeline), "source");
g_object_set(G_OBJECT(source), "caps", caps, NULL);
g_object_set(G_OBJECT(source), "port", m_port, NULL);
I tried to emulate recording branch of your pipe as realistic as I can.
I cannot use timebar of vlc with this video.
When I add EOS parameter (
-e
) at the end the video becomes scrollable with time bar.This is because video headers that contain time information are written at the end of stream.
For this reason you need to add an eos handler to your pipe. I found this page in the documentation that gives an example.
Summary from example: you add a signal handler to your pipe
And the signal handler will look like: