Playback recorded video from gstreamer does not start at 0s but between 5 and 10s
Arnaud Tullio
tullio.arnaud at gmail.com
Thu Sep 9 13:53:00 UTC 2021
I stream and record my video like in the code below. For information, when
I start the process, I have to wait between 5 and 10 seconds before having
the first frame to appears. The problem is that when I playback the video
with VLC for example the video start a 5 or 10s it depends on the time I
have waited before having the first frame. It is the same at the end of the
video, the video continue during 5 and 10 seconds after the timebar on vlc
have reached the end.
Does someone have and idea ? How can I be sure that the video start and
finish at the right time?
void MainWindow::OnStop(wxCommandEvent&) is to Stop the record and void
MainWindow::OnSave(wxCommandEvent&) is to start saving the stream
void MainWindow::OnStop(wxCommandEvent&)
gst_element_send_event((*ptrstats).pipeline, gst_event_new_eos());
gst_bus_timed_pop_filtered((*ptrstats).bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_EOS); GstStateChangeReturn ret =
gst_element_set_state((*ptrstats).pipeline, GST_STATE_NULL);} void
MainWindow::OnSave(wxCommandEvent&) { std::string
strPathVideo = m_VideoPath + CreateFileName("mkv");
GError* error = NULL; GstElement* source;
GstElement* filesink; GstElement* matrox;
GstElement* clocktime; GstElement* textoverlay;
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); (*ptrstats).pipeline =
gst_parse_launch("udpsrc name=source !rtph264depay !h264parse
!avdec_h264 ! tee name = t !queue !videoconvert !matroskamux
name=matrox !filesink name=myFile t. ! queue ! videoconvert
!d3dvideosink name=mysink sync=false", &error); if
(!(*ptrstats).pipeline) { outfile << "Save : ",
error->message ,"\n"; exit(1); }
filesink = gst_bin_get_by_name(GST_BIN((*ptrstats).pipeline),
"myFile"); g_object_set(filesink, "location",
strPathVideo.c_str(), NULL); matrox =
gst_bin_get_by_name(GST_BIN((*ptrstats).pipeline), "matrox");
g_object_set(G_OBJECT(matrox), "offset-to-zero", true, NULL);
source = gst_bin_get_by_name(GST_BIN((*ptrstats).pipeline),
"source"); g_object_set(G_OBJECT(source), "caps", caps,
NULL); g_object_set(G_OBJECT(source), "port", m_port,
NULL); (*ptrstats).bus =
gst_element_get_bus(GST_ELEMENT((*ptrstats).pipeline));
GstStateChangeReturn ret = gst_element_set_state((*ptrstats).pipeline,
GST_STATE_PLAYING); }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210909/44e89e26/attachment.htm>
More information about the gstreamer-devel
mailing list