Raspberry video player to play videos triggered by events. - Page 1
Forum section: electronics / general

author: luiHS
author_rank: Frequent Contributor
timestamp: August 04, 2018, 09:00:09 am
content: Hi.Some time ago I started to develop a product, which plays videos triggered by signals generated by an arcade machine.At first I tried to do the development with QT Creator, but I had many problems and I stopped using it. Then I tried the examples that Raspberry brings in their libraries, specifically with Hello_video.The problem I had with the Hello_video is that I need to be able to immediately stop a video playing, to play another one. I modified the source, in the player loop, but it only works fine, if you let it play a minimum of time of the video (I remember that at least 2 seconds), otherwise the GPU is locked and you have to restart the program.Right now the idea is not to modify the Hello_video, keep it as it is and launch it from another program, passing it as a parameter the video to play, before I thought to use the KILL Linux command to end any program Hello_video that is still playing. I still have to test it to see if this system works well.The omxplayer program does not work for me because it responds very slowly to playing a video, I need it to be instantaneous.Right now I have my main program in a loop that reads the external signals of a machine, using port expanders mcp23s17 by SPI. When the appropriate signals are given, which can be configured by the user, a video is launched by calling the hello_video program, passing as a parameter the file to be played.I also read the book "Raspberry Pi GPU Audio Video Programming 2017", to directly program the GPU, but it is quite complex, and to play a video we end up using the hello_video, which comes to contain what is exposed in the book.Summarizing:Do you know any other system to launch the reproduction of a video, at full screen, from your own application in a Raspebery Pi ?. It has to be instantaneous and cancelable immediately if you need to play another video.Best Regards

author: andersm
author_rank: Super Contributor
timestamp: August 04, 2018, 10:22:49 am
content: Making a bootleg Dragon's Lair machine?I'd look intoVLMor other VOD/streaming server. As a last resort, you could create your own player based on eg. libffmpeg. That would allow you to essentially prepare separate decode streams for each of your videos ahead of time, which should reduce the switchover latency.

author: Rasz
author_rank: Super Contributor
timestamp: August 04, 2018, 11:48:44 am
content: http://www.mplayerhq.hu/DOCS/tech/slave.txt

author: luiHS
author_rank: Frequent Contributor
timestamp: August 04, 2018, 02:13:51 pm
content: Quote from: andersm on August 04, 2018, 10:22:49 amNo, its not for that machine.QuoteThanks, I will check.

author: luiHS
author_rank: Frequent Contributor
timestamp: August 04, 2018, 02:14:48 pm
content: Quote from: Rasz on August 04, 2018, 11:48:44 amThanks, I'll check it.I also read something about the use of the FIFO file to control the hello_video program, I suppose it is a technique that can work with any program to control it in slave mode.I will check both ways of doing it, call hello_video with a KILL prior to a previous player, and the FIFO technique. What I need is that it be very fast, the video playback must be instantaneous, and if there is another video in play it must stop instantly and start playing the new one.

author: Rasz
author_rank: Super Contributor
timestamp: August 04, 2018, 08:26:34 pm
content: it will never be instantaneous unless you use uncompressed video preloaded to ram and custom player. Even on a modern 4GHz computer with hardware h.264 GPU decoder it can take 0.5-0.7 second between clicking on video and moving pictures. Starting up any program takes time (dynamic libraries), then you have to parse video file header etc.

author: luiHS
author_rank: Frequent Contributor
timestamp: August 04, 2018, 10:36:29 pm
content: Quote from: Rasz on August 04, 2018, 08:26:34 pmIn the tests I did with hello_video, the video playback was practically instantaneous, I find it useful. The video format is a h264 without audio with full HD resolution, I think this format is compressed, which is used in a DVD (only the video, there is no audio), in fact to convert any video to this format, I did with Adobe Premiere and saved in DVD format, which separates audio and video into two files, I only use video.What does not work for me, is what it takes for omxplayer to start playing a video, it's very slow.As instantaneous is a subjective term, I can not quantify it in an exact time unit, but surely hello_video does not take 1 second, nor probably half a second to start playing. With omxplayer, probably at least two seconds to start playback, it is not good for playing videos by events on an arcade machine, which should show the video instantly as soon as the event occurs in the game.What remains for me to check is the technique to control the program from another program, or the effect of the Linux KILL command on a running program, before executing the new one with another video. I suppose that all this will also depend on how the GPU reacts to a KILL command of the player, and how the system used the FIFO. It is the only thing that could introduce some delay, I hope it does not happen or I would have problems for the product to work as it should..