projects:raspi_video_loop
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
projects:raspi_video_loop [2013/05/27 13:42] – [Future?] Julien Deswaef | projects:raspi_video_loop [2015/03/10 22:42] – [GStreamer] Julien Deswaef | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Raspberry Pi Video Loop ====== | ====== Raspberry Pi Video Loop ====== | ||
- | For a video installation by [[http:// | + | For a video installation by [[http:// |
- | ===== XBMC ===== | + | But after a year, there has been a lot of development going on everywhere. And now there is multiple solutions available. Although the one and only that would make everyone happy is not working (yet). |
- | XBMC, a media center | + | **First question: does your video needs sound or not?**\\ |
+ | If it does not have sound, jump immediatly to the [[# | ||
+ | |||
+ | If you need sound, then there is multiple ways with different results | ||
===== OMXplayer ===== | ===== OMXplayer ===== | ||
- | Omxplayer is the default video player for the RasPi, but it doesn' | + | Omxplayer is the default video player for the RasPi. |
The advantage of the OMXplayer is that you don't need to start an X server to play a video. It fully uses the GPU capabilites of the Raspi, which makes it a fast and reliable player for full HD video. It also plays sound with the video. | The advantage of the OMXplayer is that you don't need to start an X server to play a video. It fully uses the GPU capabilites of the Raspi, which makes it a fast and reliable player for full HD video. It also plays sound with the video. | ||
- | The "no loop" feature | + | OMXPlayer |
- | ==== Future? ==== | + | omxplayer --loop |
+ | |||
+ | But (still not | or yes | or partly see issue [[https:// | ||
+ | |||
+ | Build date: Sat, 22 Mar 2014 20:58:15 +0000 | ||
+ | Version | ||
+ | |||
+ | Developpment happens here: https:// | ||
- | I hope that in the near future, omxplayer will have that loop feature added to it. Which will solve many of these crude hacks. | + | Bendenoz has been working on a [[https:// |
- | There seems to be a custom build of Benedoz solution + other features at http:// | + | Until this " |
+ | |||
+ | ==== Bash scripting ==== | ||
+ | |||
+ | This script will start an instance of omxplayer and will watch it. When omxplayer | ||
- | ===== Hiding the terminal ===== | ||
- | A prettier solution to hide the terminal has been suggested to me by Jakob Wierzba: | ||
< | < | ||
- | setterm | + | #!/bin/sh |
+ | |||
+ | SERVICE=' | ||
+ | while true; do | ||
+ | if ps ax | grep -v grep | grep $SERVICE > /dev/null | ||
+ | then | ||
+ | echo " | ||
+ | else | ||
+ | omxplayer -o hdmi / | ||
+ | |||
+ | fi | ||
+ | done | ||
</ | </ | ||
- | This command tells the terminal to hide itself after 1 minute of inactivity. This means the terminal will be again visible when needed by just pressing a key. Way more usefull and convenient that settings fonts to black. | ||
- | Insert this in your bash startup script. | ||
- | ===== hello_video | + | But this raises 2 problems. First, you have about a one second delay between each loop. Second, the terminal is visible during that delay, which is quite visually disturbing. That second problem is often " |
+ | |||
+ | |||
+ | ==== Python scripting ==== | ||
+ | Ellen has come with a pythonic solution. She describes it here: http:// | ||
+ | |||
+ | I have not taken the time to try it out. It uses pyomxplayer to control multiple instances of OMXPlayer started at once. The idea is that you would start one instance while maintaining another one on pause. Then watch the first instance and right before it reaches the end of the video, start the second one. And so on. | ||
+ | |||
+ | ===== openFrameworks + ofxOMXPlayer ===== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | And [[https:// | ||
+ | |||
+ | You will need to [[http:// | ||
+ | |||
+ | The advantage of using openFrameworks is that you can do more than just loop videos and have overlay text, logos, etc... But, though openFrameworks prepares a lot for its users, this requires some knowledge of C++. | ||
+ | |||
+ | ===== hello_video ===== | ||
In the default installation of the Raspbian OS, you'll find many code examples written in C to start coding with the RasPi. Those examples are located at / | In the default installation of the Raspbian OS, you'll find many code examples written in C to start coding with the RasPi. Those examples are located at / | ||
Line 52: | Line 91: | ||
With the hello_video.bin file that is generated, you'll only be able to play videos encoded in h264 with no sound. But you'll have a perfect loop, with no gap. | With the hello_video.bin file that is generated, you'll only be able to play videos encoded in h264 with no sound. But you'll have a perfect loop, with no gap. | ||
+ | |||
+ | ===== GStreamer ===== | ||
+ | I've heard of a [[https:// | ||
+ | |||
+ | |||
+ | ===== Useful tricks ===== | ||
+ | |||
+ | ==== Hiding the terminal ==== | ||
+ | A prettier solution to hide the terminal has been suggested to me by Jakob Wierzba: | ||
+ | < | ||
+ | setterm -blank 1 | ||
+ | </ | ||
+ | This command tells the terminal to hide itself after 1 minute of inactivity. This means the terminal will be again visible when needed by just pressing a key. Way more usefull and convenient that settings fonts to black. | ||
+ | Insert this in your bash startup script. | ||
+ | |||
+ | You'll need to write this command in your / | ||
+ | |||
==== Transcoding a video to h264 ==== | ==== Transcoding a video to h264 ==== | ||
- | This hello_video example is quite strict on what type of video file can be played. If your video file is in a mp4 container, it won't play. The easiest solution to get a working file for me was to start with a list of jpeg files with a 1920 x 1080 resolution and to process it with ffmpeg. Here's the code that worked for me: | + | This [[#hello_video|hello_video]] |
<code bash> | <code bash> | ||
Line 82: | Line 138: | ||
sudo reboot | sudo reboot | ||
</ | </ | ||
- | |||
- | You're done ;) | ||
projects/raspi_video_loop.txt · Last modified: 2015/03/25 04:06 by Julien Deswaef