Skip to content

Instantly share code, notes, and snippets.

@cpmpercussion
Created July 15, 2016 08:31
Show Gist options
  • Save cpmpercussion/607e7fd5ad1f5b1cf4fc76950e6bcd13 to your computer and use it in GitHub Desktop.
Save cpmpercussion/607e7fd5ad1f5b1cf4fc76950e6bcd13 to your computer and use it in GitHub Desktop.
omxplayer command to loop a video forever for use in video art exhibitions
#!/bin/bash
# This one-liner script plays a video in an infinite loop on a raspberry pi
# for a video-art exhibition.
# It was written for a video in portrait orientation so the video is rotated 270
# to use up the whole screen (which was also rotated).
# Charles Martin, July 2016
omxplayer -o local --loop /home/pi/video.mp4 --orientation 270
@spolischook
Copy link

Oh I don't believe! You are save my day.
I'm also using python script and distance sensor for show video from start if someone start looking it

@AdolfoR
Copy link

AdolfoR commented Nov 23, 2017

what about looping multiple files? XD

@stuudmuffin
Copy link

thank you for this. A simple thing to add, but very helpful.
I used this for a digital menu signage. play a video in the background with --layer #, and the menu image on top in another layer. works fantastically

@humbertoregobarros
Copy link

could someone help me ?? mine is not working, it says that local is a invalid syntax

@jeffdn2
Copy link

jeffdn2 commented Jul 22, 2018

Is there a way to stop the loop inside python. <omxplayer -i> doesn't seem to interrupt it?

@netAction
Copy link

@jeffdn2: killall omxplayer.bin

@edmunddantes7
Copy link

In my case, it finishes playing, seeks 00:00:00 and exits

@goatface
Copy link

Great one-liner!

Anyone looking for something that auto-builds playlists, etc, https://github.com/goatface/mplall

@orjanv
Copy link

orjanv commented Jul 21, 2020

Oh I don't believe! You are save my day.
I'm also using python script and distance sensor for show video from start if someone start looking it

@spolischook Any chance you could share your script?

@spolischook
Copy link

Oh I don't believe! You are save my day.
I'm also using python script and distance sensor for show video from start if someone start looking it

@spolischook Any chance you could share your script?

It was a long time ago. I have no this script anymore, but it was so simple, I believe that you can do the same in a half an hour ;)

@spolischook
Copy link

@orjanv it read the distance sensor, and if it was changed (the viewer got the headphones) it start a video from start

@orjanv
Copy link

orjanv commented Jul 21, 2020

the viewer got the headphones

@spolischook I see, thanks. I was looking for how to switch between a looping video and to a single video (once triggered) and go back to looped video once the single video was finished. Just curious how you solved that. :-)

@spolischook
Copy link

@orjanv I think I start a separate process, and I've kill it once I don't need it, and start the new one.

@tigosc
Copy link

tigosc commented Nov 12, 2020

Thanks!!!

@Sekaiology
Copy link

Thank you so much! I was looking for this one liner all over the digital realms. Was trying to get my video to work as a screensaver first but this is so much easier and les complicated then it has to be :) 💯

@theeggoplant
Copy link

too bad that this isn't a seamless loop.... :/

I don't understand why its so hard to seamlessly loop a video on a pi

@cpmpercussion
Copy link
Author

too bad that this isn't a seamless loop.... :/

I don't understand why its so hard to seamlessly loop a video on a pi

yeah man.

@theeggoplant
Copy link

I've been trying to get a seamless loop to work for like a year but I think I'm getting close maybe? So if I figure it out I'll let you know.

@theeggoplant
Copy link

theeggoplant commented Jul 28, 2023

Okay I finally figured out how to loop a video seamlessly with no break, cut, terminal, anything. There is no delay between loops. This was a long process for me but isn't too difficult if someone wants to know how to do it let me know! (no sound just video)

@orjanv
Copy link

orjanv commented Jul 29, 2023

Okay I finally figured out how to loop a video seamlessly with no break, cut, terminal, anything. There is no delay between loops. This was a long process for me but isn't too difficult if someone wants to know how to do it let me know!

I would like to know.

@somaholiday
Copy link

Okay I finally figured out how to loop a video seamlessly with no break, cut, terminal, anything. There is no delay between loops. This was a long process for me but isn't too difficult if someone wants to know how to do it let me know! (no sound just video)

I would also like to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment