Search code examples
linuxvideovideo-processinggstreamergnonlin

Looping a video with gstreamer and gst-launch?


I am able to play a video on the command line with gstreamer's gst-launch like this:

gst-launch gnlfilesource location=file:///tmp/myfile.mov start=0 duration=2000000000 ! autovideosink

This plays the first 2 seconds of the file in /tmp/myfile.mov, afterwards the video playback stops. Is there anyway to get this to loop repeatidly? i.e. turn the 2 second long gnlfilesource into an infinite length video that plays those 2 seconds again and again and again?


Solution

  • Assuming bash...

    Wrap it in a while-loop?

    while true; do [your command]; done
    

    where true does nothing sucessfully, i.e.

    true: true
        Return a successful result.
    
        Exit Status:
        Always succeeds.
    

    It allows you to create infinite loops, e.g.

    $ while true; do echo "run..."; sleep 1; done
    run...
    run...
    run...
    run...
    run...
    ...