Running an endless Gstreamer pipeline from a video source file

Usually while running a Gstreamer pipeline from a video source file the pipeline will end as we reach the end of the file.
In order to run such a pipeline endlessly (mostly used for debugging or demos) follow these steps.
The example shown below is based on our Tappas detection app taken from github:

  1. convert your video source file to a bytestream file:
gst-launch-1.0 filesrc location=apps/h8/gstreamer/general/detection/resources/detection.mp4 name=src_0 ! \
decodebin ! queue ! videoconvert ! x264enc ! \
h264parse config-interval=-1 ! video/x-h264,alignment=nal,stream-format=byte-stream ! \
filesink location=apps/h8/gstreamer/general/detection/resources/detectionBytestream.mp4

in this example our original source file is detection.mp4 and the output bytestream file is detectionBytestream.mp4.
2. Replace the pipeline source element from ‘filesrc’ to ‘multifilesrc’ and add the ‘loop=true’ flag.
Don’t forget to set the location to the bytestream file.

gst-launch-1.0 multifilesrc location=apps/h8/gstreamer/general/detection/resources/detectionBytestream.mp4  loop=true name=src_0 !

Please note that this is only the first part of the detection pipeline, as mentioned above the full pipeline can be found under Detection