I have live stream source, and I want to start recording the stream from arbitrary time. My setup is like this:
videotestsrc ! tee name=rawVideoSplitter ! queue ! ximagesink
And I start the recording by linking encoder bin to the "tee":
recorderBranch = gst_parse_bin_from_description("queue name=recorderQueue flush-on-eos=1 leaky=1 ! "
"timeoverlay shading-value=255 shaded-background=true font-desc="Sans, 10" time-mode=0 ! "
"videorate ! video/x-raw,framerate=30/1 ! videoconvert ! "
"x264enc tune=zerolatency ! mp4mux ! filesink name=fileSink location=test.mp4", true, &error);
if (error) {
recorderBranch = NULL;
return;
}
gst_bin_add(GST_BIN(pipeline), recorderBranch);
gst_element_link(rawVideoSplitter, recorderBranch);
gst_element_set_state(GST_ELEMENT(recorderBranch), GST_STATE_PLAYING);
Everything works fine, except the recorded file length is longer the actual recording time. First frame in the file has length of "encoder start time - pipeline start time". For example if I start to record at 10th second to 20th seconds, in playback I get first frame fixed for 10 seconds and then file starts to playback normally.
How I can fix this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…