KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: seamless looping

Fri Mar 28, 2014 8:36 am

omxplayer now has seamless looping. I think the latest version is available via the sudo apt-get upgrade route.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

nolman
Posts: 32
Joined: Sat Mar 30, 2013 9:33 am

Re: seamless looping

Fri Mar 28, 2014 9:21 am

KenT : Could you point to some info on this? There was fork that had looping but it stopped working.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: seamless looping

Fri Mar 28, 2014 1:03 pm

nolman wrote:KenT : Could you point to some info on this? There was fork that had looping but it stopped working.
It's now been pulled into mail branch:
https://github.com/popcornmix/omxplayer/pull/150

Should be in latest apt-get version.

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: seamless looping

Fri Mar 28, 2014 9:51 pm

It is in apt-get upgrade, just downloaded it tonight and gave it a quick try. As it says on github best used with -b and does not work with short videos but still very useful.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

nolman
Posts: 32
Joined: Sat Mar 30, 2013 9:33 am

Re: seamless looping

Thu Apr 03, 2014 10:14 am

mmm...

i tried it with this file : http://www.dvdloc8.com/clip.php?movieid=27312&clipid=1
should be long enough?

at the end omxplayer says seek: 00:00:00
but then it doesn't play the video again.

omxplayer version = 39e6342 [master]
command: omxplayer -b --loop -local /mnt/media/usbdrive/*

is the file not seekable ? if so why?

edit: the file is seekable when i use the -l option with time given.

Piminiuser
Posts: 73
Joined: Wed May 30, 2012 1:15 pm

Re: seamless looping

Sun Apr 06, 2014 10:20 am

nolman wrote:mmm...

i tried it with this file : http://www.dvdloc8.com/clip.php?movieid=27312&clipid=1
should be long enough?

at the end omxplayer says seek: 00:00:00
but then it doesn't play the video again.

omxplayer version = 39e6342 [master]
command: omxplayer -b --loop -local /mnt/media/usbdrive/*

is the file not seekable ? if so why?

edit: the file is seekable when i use the -l option with time given.
Fixed yet? I've got the same problem.

nolman
Posts: 32
Joined: Sat Mar 30, 2013 9:33 am

Re: seamless looping

Sun Apr 06, 2014 10:29 am

No,unfortunatly not.
I have to use looping by script again.

Piminiuser
Posts: 73
Joined: Wed May 30, 2012 1:15 pm

Re: seamless looping

Mon Apr 07, 2014 6:56 am

nolman wrote:No,unfortunatly not.
I have to use looping by script again.
Bollox :( Maybe it will be fixed in the future.

cocodidou
Posts: 1
Joined: Sun Apr 13, 2014 7:18 pm

Re: seamless looping

Sun Apr 13, 2014 7:41 pm

Hi everyone,
I've found another solution than relying on omxplayer to get a "seamless" loop: I managed to install fbi, then in my /etc/rc.local, put a line to run:

Code: Select all

fbi  --noverbose -T 2 /home/pi/black.png &
where black.png is a black picture or a picture I'd like to be displayed as the background when there's nothing being run.
The Pi waits silently until I tell him to run a script in my home folder, which has an infinite loop, calling omxplayer several times with different files (I loop through the mp4 files in a particular directory, listing them again each time the while loop is called). I may have added it to the /etc/rc.local script, but I wanted to start it by hand. Although this does not create a true seamless loop (unless the clip begins and ends by a black screen, with a fade effect or whatever), as a second separates clips, it allows me to update the files while one of them is being played (that was one of my requirements; if a file is missing then omxplayer just says "Have a good day" and skips to the next one). It may suit one of yours.

You've also asked on how to display PDF files. I've made a short script that allows to do it without X, and automates such a task, as I couldn't get fbgs to display them properly from SSH.

Code: Select all

#!/bin/bash

mkdir temp-pdf
gs -dNOPAUSE -dBATCH -sDEVICE=tiffgray -r300 -dBandBufferSpace=75000000 -sBandListStorage=memory -sOutputFile='temp-pdf/%03d.tiff' $1
cd temp-pdf
fim ./*.tiff
rm -f ./*.tiff
sudo killall -s SIGKILL fbi
sudo fbi --noverbose -T 2 /home/pi/black.png
cd .. && rm -r ./temp-pdf
With an Android phone, connected via SSH, I run this script to display a PDF file, scrolling with the arrows, zooming with "+" (and unzomming with "-"), scrolling between pages with "PageUp" and "PageDown" (all of these commands are FIM's). The pages are rendered as grayscale files to gain rendering time (1 second a page vs. 10 in color PNG, with equivalent resolutions).
When I've finished, I delete the files and the temporary folder then switch back to my black screen with fbi (as fim leaves two thirds of its image displayed when exiting).

OrangeCR
Posts: 1
Joined: Mon Jun 02, 2014 12:23 am

Re: seamless looping

Mon Jun 02, 2014 12:30 am

Hi all,
I will appreciate any help on this,
I looked for the file:
/opt/vc/src/hello_pi/hello_video/
video.c
Made the change to line:
if(!data_len)
break;
to
if(!data_len)
fseek(in, 0, SEEK_SET);
Saved the file ran, Make and re-generated the .bin file, however the video files won't loop, at the end it just closes the player.
Can someone point me in the right direction.
Thanks all.

OrangeCR

ohthedave
Posts: 5
Joined: Thu Mar 27, 2014 3:14 pm

Re: seamless looping

Fri Jun 13, 2014 5:18 pm

Hi all. I've updated a method I posted earlier to make it a little easier to set up and use. RPiLooper v2 is now available as an image that pulls a video file from an auto-mounted USB drive. Instructions are here:

http://curioustechnologist.com/post/886 ... ideo-kiosk

Note: this method does not support audio, but has no gap in between loops. If you need to seamlessly loop video for a simulation environment or something similar, you may find this image useful. Enjoy!

-Dave

bmuseumtech
Posts: 1
Joined: Wed Jun 18, 2014 8:44 am

Re: seamless looping

Wed Jun 18, 2014 9:17 am

denjell wrote:i just checked and it seems that somehow a corruption appeared in line 70.

let me know if this works:

Code: Select all

#!bin/sh
# autoloop-patch.sh

# autoloop patch for raspbian
# v.0.1
# Raspberry Pi Forum User denjell
# http://www.raspberrypi.org/phpBB3/memberlist.php?mode=viewprofile&u=56730

# copyleft 2013 / no guarantees of fitness for any purpose

# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


# READ THIS FIRST BEFORE RUNNING THE FILE!
# ----------------------------------------

# this script creates 2 files on your system and modifies /etc/inittab.
# 1) /etc/init.d/startup
# 2) /home/{user}/autoloop.sh
# 3) /etc/inittab

# it assumes general knowledge of stuff like debian and media files / codecs
# it should work on most raspians, however I recommend a clean image.

# Step0: follow the instructions here to make your RPi distro:
# http://elinux.org/RPi_Easy_SD_Card_Setup
# choose medium overclocking
# do not activate the window manager (ie only command line interface)

# Step1: place this script in your /home/%user folder (on the Rpi)
# type: (without the quotes)
# "nano /home/pi/autoloop-patch.sh"
# copy this script with ctl-c
# paste it in into the nano editor with shift-ctl-v
# save it with ctl-x

# Step2: place your media file in /home/pi or whatever:
# e.g. /home/pi/movie.mp4
# it must be h264 video and PCM 16bit signed little endian audio stream

# Step3: type (without the quotes and use your user name instead of pi):
# "sudo bash /home/pi/autoloop-patch.sh /home/pi/movie.mp4"
# you can run this script anytime you want a new film to loop
# it will re-run the setup and restart your RPi.

# Step4: how to exit the loop.
# http://en.wikipedia.org/wiki/Magic_SysRq_key

# This works for me. However, I cannot guarantee it will work for you.
# I do not manage a help desk, and this patch is provided "as is".
# Good luck. Have fun. Do stuff.

#find the user
user=${PWD##*/}
file=$1

# create the startup script
echo "#! /bin/sh

case '$1' in
  start)
    sudo bash /home/"${user}"/omx-loop.sh "${file}" >/dev/null 2>&1
    ;;
esac

exit 0" > /etc/init.d/startup.sh
sudo chmod 755 /etc/init.d/startup.sh
sudo update-rc.d startup.sh defaults
echo "/etc/init.d/startup created and initialized"


echo "#!/bin/sh

SERVICE='omxplayer'
	while true; do
		setterm -blank off -powerdown off > /dev/tty0
		clear > /dev/tty0
		setterm -cursor off > /dev/tty0
		echo;echo;echo;echo;echo;echo;
		clear > /dev/tty0

		if ps ax | grep -v grep | grep \$SERVICE > /dev/null
			then
				echo; # sleep 1
			else
				echo;echo;echo;echo;echo;echo;
				omxplayer -o hdmi \$1 & > /dev/null
				clear > /dev/tty0

		fi
	done" > /home/${user}/omx-loop.sh
echo "/home/pi/omx-loop.sh created"
sudo chmod 755  /home/${user}/omx-loop.sh

# remove the old inittab
sudo rm /etc/inittab

# write a new inittab
sudo echo "
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
# modified by denjell

# The default runlevel.
id:2:initdefault: 

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
# z6:6:respawn:/sbin/sulogin

# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop

# 1:2345:respawn:/sbin/getty --noclear 38400 tty1 
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100" > '/etc/inittab'

echo "it seems we got this far."

read -p "Restart System Now? (y/n) " RESP
if [ "$RESP" = "y" ]; then

	echo "Restarting."
	sudo reboot
fi 
   echo "You must restart your system to initialize autostarting autoloop."
Hello

I've tried this method a few times. I’m not sure if doing it right, I’m doing this from the raspian desktop UI.... On step 1 i paste the code in to the Nano editor and save, but nothing happens. So i created a script file called it autoloop-patch.sh and pasted the script in to that and saved it in to /home/pi/, then i went in to the Nano editor and pasted the script in there and saved it. This seemed to do something...

On step 3 i pasted the code suds bash /home/pi/autoloop-patch.sh /home/pi/movie.mp4 and it seemed like it ran the script, at the end asking me if i would like to restart the rip, which i did. When the rip restarts it doesn’t boot in to the video, it waits for me to put a command in, i normally type "startx" to get in to the UI, so clearly I’m doing something very wrong. oh and in the /home/pi a file gets created called omx-loop.sh.

Any help on this will be much appreciated

Thanks

rober
Posts: 1
Joined: Thu Oct 23, 2014 10:13 pm

Re: seamless looping

Thu Oct 23, 2014 11:02 pm

Hi everyone. I have SSH server enabled on my PI and l have it hooked to the wi-fi. I installed htop (with this command "sudo apt-get install htop") too. The SSH server helps me manage the PI remotely, HTOP lets me see proceses running on the PI, select them and kill them, kinda like the Windows Task Manager. Remeber to remove or rename your start on boot video script before killing the process so it wont restart after you kill the process that runs it. This helps me manage my PI even from my cell phone.

Sorry for my bad english.

grimesey
Posts: 11
Joined: Mon Dec 01, 2014 12:14 pm

Re: seamless looping

Mon Dec 01, 2014 12:19 pm

Hey Guys

I am looking to do the same (seamless looping) with powerpoint files in raspbmc.

Any hints on how to do this succesfully?

Thanks
Grimes

Return to “Graphics, sound and multimedia”