rycher10
Posts: 3
Joined: Mon Aug 28, 2017 1:08 pm

Autostart and playing loop of 1 video - HELP

Mon Aug 28, 2017 2:02 pm

Hello everyone! My very first post on here - YAY! I absolutely love my Pi and am getting a bit familiar with it's amazing endless possibilities.

I have a question that I hope can be easily answered and remedied here. I have 1 single video in mp4 (or any format really) that I want to have auto start when my Pi boots up, and play continuously. I am running the latest Raspberry with Pixel image. I have the video stored on the DS card, but I could just as easily keep it on a USB memory stick if need be. I imagine that this can be done with a few commands? Problem is that I'm still learning my way around the Pi and am not too familiar with it yet. I can open the terminal and enter code if it's given to me (copy and paste - HA!) but I can't write any myself. Taking baby steps here and I want to learn as much as possible. Anyway, I've searched the forum but did not find anything that could help me with this. Can someone out there in the community help a brother out?

Thanks in advance

Rycher

rycher10
Posts: 3
Joined: Mon Aug 28, 2017 1:08 pm

Re: Autostart and playing loop of 1 video - HELP

Tue Aug 29, 2017 1:07 pm

Okay.... so I guess this is too complicated to do? Does anyone in this community know of another site that may be able to offer help on the coding to allow me to do this?

~Rycher

User avatar
karrika
Posts: 1083
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Autostart and playing loop of 1 video - HELP

Tue Aug 29, 2017 2:37 pm

Well. It is not complicated at all.

The Pi has a program called omxplayer and it has a loop option.

So you can start it with the command

Code: Select all

omxplayer --loop /home/pi/myvideo.mp4
It may be nice to let raspbian start the desktop so that the video screen size is defined etc.

So I would probably add to /etc/xdg/autostart/myvideo.desktop with the content

Code: Select all

[Desktop Entry]
Type=Application
Name=MyVideo
Comment=Automatic videoplayer
NoDisplay=false
Exec=/usr/bin/omxplayer --loop /home/pi/myvideo.mp4
NotShowIn=GNOME;KDE;XFCE;
I have not tested this but it might work.

tvjon
Posts: 733
Joined: Mon Jan 07, 2013 9:11 am

Re: Autostart and playing loop of 1 video - HELP

Tue Aug 29, 2017 4:31 pm

I've just tried the recent omxplayer release that comes with Raspbian Stretch, which seems to have improved somewhat, as there is now no perceptible delay rewinding the video.

I added a similar line to Karrika's in:

/home/pi/.config/lxsession/LXDE-pi/autostart

as you can see in the attached pic'.

You don't need root access for the autostart file.
Attachments
autostart.jpg
autostart.jpg (63.51 KiB) Viewed 8853 times

rycher10
Posts: 3
Joined: Mon Aug 28, 2017 1:08 pm

Re: Autostart and playing loop of 1 video - HELP

Tue Aug 29, 2017 7:17 pm

@karrika

I tried that command line in the terminal but the only response I got back was a line that read "have a nice day ;)".

I don't know what that means. I've also tried to run jus the omxplayer but nothing happens. I'm wondering if I even have it installed? When I click directly onto my video file to open a box appears asking me to select the program to play it. But omxplayer, or any other video player, is listed in the box. How do I check to see if I have omxplayer installed, and how do i doenload it?

Thanks brother.

Rycher

User avatar
karrika
Posts: 1083
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Autostart and playing loop of 1 video - HELP

Wed Aug 30, 2017 3:46 am

In order to install omxplayer you need to open the terminal and type:

Code: Select all

sudo apt-get install omxplayer
For playing a file the omxplayer need to find it.

Try to give it a file that does not have special characters in its name. No blanks either.

Code: Select all

omxplayer file
If it has blanks in the name you can use quotes.

Code: Select all

omxplayer 'file name'

Return to “General discussion”