Hi,
I have two RTSP cameras #1 and #2 which are displayed and recorded to MP4 (using qtmux). I need to be able to switch from one RTSP camera to the other and keep on appending the h.264 stream to the MP4 and display the live video. I also need to be able to pause and resume recording. Both cameras use the same encoder, which is programmed with the exact same settings. To pause the recording, I use a pad probe on the src pad of the mux which drops buffers whilst paused. I also set the DTS and PTS to a monotonic counter so that the MP4 mux sees continuous time. To switch, from #1 to #2, I use a blocking pad probe on the sink of the mux to wait until the mux has received the full GOP, then I disconnect #1, destroy it, create #2, connect it and set its element to PLAYING. At that point, I receive a new SEGMENT event, sent from #2, with a new position (a large number) and the mux starts to clip all subsequent buffers. The end result is that the total time in the MP4 no longer increases (even though its size increases, suggesting the data carried by the buffers is appended to it). I have worked out that if I drop this new SEGMENT event, then MP4 mux no longer clips new buffers and I can play the MP4 as expected. My understanding is that when setting the RTSP source to PLAYING it sends a SEGMENT event before any BUFFER. This event carries a position value which is used by downstream elements to decide whether buffers should be clipped or not. In my case, since I set the DTS and PTS to my own monotonic counter which started at 0 and the position carried by the SEGMENT event is a much larger number, the timestamps in the buffers are always smaller than then position which causes the MP4 mux to clip the buffers as they fall outside the segment. Is my understanding correct? If so, this makes sense to me, but I'm not sure how to use this knowledge to best to structure my app so I'm asking for guidance as to how to best implement this application. Dropping the SEGMENT events seems very hacky, or is it? Should I be dropping all SEGMENT events and pushing my own once only, when I connect to the first RTSP camera. Note that the very first SEGMENT element I currently let through also carries a position set to a larger number than the timestamp I set in the buffers. This should cause subsequent buffers to be clipped, but they are not. Why is that? Are there elements already available to do what I need? I have found the concat element, but the following pipeline produces errors and the MP4 is not fully playable, so I did not investigate further: .\gst-launch-1.0.exe concat name=c ! x264enc ! queue ! qtmux ! filesink location=test.mp4 videotestsrc num-buffers=100 ! c. videotestsrc num-buffers=100 pattern=ball ! c. -e ERROR qtmux gstqtmux.c:4713:gst_qt_mux_add_buffer: decreasing DTS value 0:00:06.633333332 < 0:00:06.699999999 Thanks -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |