Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing a video once, then loop all other videos. #231

Open
spzilyk opened this issue Sep 10, 2024 · 2 comments
Open

Playing a video once, then loop all other videos. #231

spzilyk opened this issue Sep 10, 2024 · 2 comments

Comments

@spzilyk
Copy link

spzilyk commented Sep 10, 2024

Hey, is it possible to play a video once and then loop all the other videos?

For example: I want to use this at an exhibition. After startup, i want the rpi to show a logo (video) of my company just a single time and then it should loop the videos of my client.

i tried naming the video myvideo_repeat_1x.mp4 but of course that does not work. :)

Also big thanks for all of that.

@tofuSCHNITZEL
Copy link
Collaborator

tofuSCHNITZEL commented Sep 10, 2024

Hi,
The way the playback logic currently works it's not possible.
1x would only play it one time (no loop) - you could enter a very high number there which would essentially "loop" it forever.
but it will not be a seamless loop, there will be "black" in between because the videoplayback of the file is essentially "restarted".
but I will see if it's possible to implement some sort of "startup" video logic that would play a file once and then ignore it for the rest of the loopers operation (which would make it so it loops the one remaining file seamlessly)

So for now my suggested "workaround" would be to name your first video so that it's alphabetical the first (like aaaa_start.mp4) and your other video xxx_loop_repeat999999x.mp4
Cheers

@spzilyk
Copy link
Author

spzilyk commented Sep 10, 2024

Hey so i made it work using a script with omx player.

i installed the latest raspberry OS lite that you recommend and turned on the wifi in the pi image writer (before installing)

then i installed video looper via this tutorial:

https://learn.adafruit.com/raspberry-pi-video-looper/installation

after that i installed omxplayer with

sudo apt install omxplayer

my video file that will only played once is located in ~/home/pi/logo/yourvideo.mp4

script is located in ~/home/pi and named "play_video.sh"

#!/bin/bash

#Path to the video file

VIDEO_PATH="/home/pi/logo/yourvideo.mp4"

#check if the video file exists
if [ ! -f "$VIDEO_PATH" ]; then
echo "Error: Video file not found: $VIDEO_PATH"
exit 1
fi

#start omxplayer to play the video
omxplayer "$VIDEO_PATH"

made it executable:

chmod +x /home/pi/play_video.sh

then i made a .service file named playvideo.service in /etc/systemd/system that contains:

[Unit]
Description=Play Video on Boot
After=network.target

[Service]
ExecStart=/home/pi/play_video.sh
Type=oneshot
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

after that i configured the video_looper.ini to show no countdown to start a video.

so what this does is playing the video i placed in /home/pi/logo just once after boot and then the videos from the USB stick gets looped instantly after (nearly seemless).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants