ltdrum
Posts: 4
Joined: Thu Jul 12, 2018 11:21 pm

Automatic Video Player with logging

Fri Jul 13, 2018 1:16 am

I made this project for work, to replace a user initiated action that tended to be forgotten.

Requirement: Play videos in an order via a closed circuit tv system that needs to be activated by a dry contact closure. All actions need to be logged to prove that the task was done daily and at what time.

Goal: To automate the process so that the user does not have to remember to either play the videos via DVD or play it and fail to log it. Also to have a system that would be able to have videos changed or videos added and removed with out having to make a lot of modifications to the system.

Hardware:

1 - RPi 3B
1 - DS3231 RTC (Optional for projects that dont have regular internet access)
1 - 5v dual relay
2 - small buttons
1 - LED
1 - Project Box (7.8" x 4.7" x 3"(L*W*H))
Assorted wires for connections

The RPi is running Raspbain (Current Version), I removed the task bar and made the background black so that there is no visible image when the videos are not playing.

There are 2 scripts used to run this project, PlayVideo.sh, ManualButtonInput.py and Launcher.sh
PlayVideo.sh: This script is used to play the videos.
1. Triggers Relay 1 to close (Logged with time and date)
2. Triggers LED to turn on (Pin Output) (Not Logged)
2. Using omxplayer, plays all videos in chosen folder (Each video start time is logged with time and date)
3. Releases relay 1 (Logged with time and date) and turns off LED
4. Ends program

ManualButtonInput.py
This scripts only job is to watch for input on the chosen pin. When it sees the input, it executes PlayVideo.sh

Launcher.sh
This is used to start ManualButtonInput.py at start up using crontab

crontab -e entries
# m h dom mon dow command
30 11 * * * /home/pi/PlayVideo.sh
@reboot sh /home/pi/Launcher.sh >/home/pi/CronLogs/cronlog 2>&1

Scripts and a 5 second test video I used for testing.
Scripts and Test Video File.zip
Scripts and Test Video
(193.82 KiB) Downloaded 25 times
The Code is pretty well commented, if you have questions or suggestions, let me know.

Return to “Graphics, sound and multimedia”