Gstreamer Nvidia Encoder How To Force Encoded File Completion When Moving to Next Playlist Item

When I move to the next item in my playlist and I have Nvidia H264 encoding enabled the file’s meta data never gets completed when I decide not to play the current source video to completion before moving on to the next video clip in the playlist. How can I get the encoded file’s meta data to be completed when not playing the source video file to completion? This is the only issue I’m having with the encoding process. Viewing video on the display while encoding to a file works well in general when playing the source video file to completion. Thanks in advance.

So, you have a pipeline that outputs to display and a filesink, and when you shut down your pipeline you want to be able to have a playable file, do I have that right? My understanding is that if you shut down your pipeline by shifting it’s state to NULL as usual, it should close any open files properly and flush any data left in the pipeline.

Just make sure you check the return state before exiting your program, however, since a state change return can be GST_STATE_CHANGE_ASYNC, in which case you can use gst_element_get_state with a timeout to wait until completion.

Hi,
Maybe you can use splitmuxsink in your pipeline.
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-splitmuxsink.html

You may also try to use EOS.
With gst-launch, you would add flag -e
With python, you would catch message with Gst.MessageType.EOS.
You can also signal before closing or at any time with something like:

        self.player.send_event(Gst.Event.new_eos())

for example before setting pipeline to PAUSE and closing.