Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

fbi slide show script has gaps between images

Thu Jan 16, 2014 4:54 pm

Hi,

Have a quick question. When I run an FBI slideshow from terminal the transition between the images is instant but when I run it in the below script there is about 1 second black gap between the images.
Would anyone have an idea why this is?

Many thanks

Code: Select all

#!/usr/bin/python
import subprocess
import os
import glob
import time
path ='/home/pi/media/'

while(1):
    for infile in glob.glob(os.path.join(path, '*.*')):
        if ".jpg" in infile:
            myProc = subprocess.Popen(["fbi", "--autoup", "--once",  "-noverbose", infile])
            time.sleep(8)
            myProc.kill()
            myProc.wait()

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: fbi slide show script has gaps between images

Fri Jan 17, 2014 8:25 am

I don't fully understand your code (glob etc.), but if you want to see where the delay is occurring, why not print out a time stamp after each section and you'll be able to see where your delay is?
Alex Eames RasPi.TV, RasP.iO

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: fbi slide show script has gaps between images

Fri Jan 17, 2014 8:28 am

I suspect the blank screen is caused by the delay in killing fbi and waiting for it to die. You may be better feeding all the found jpg files into fbi and letting it handle the transitions.

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

Re: fbi slide show script has gaps between images

Fri Jan 17, 2014 8:34 am

only a guess

when you run a slideshow from a terminal you run fbi once and that runs the slideshow. fbi might be doing some pre-loading of the images

your python runs fbi once for each slide. The 1 sec is probably the start up time of fbi.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

Re: fbi slide show script has gaps between images

Fri Jan 17, 2014 9:48 am

Hi,

Thanks for the replies. Shutting down and restarting fbi would make sense for the gap.
This is part of a larger program where a folder contents is read and if the file is a

jpg it starts fbi
avi it start omxplayer
html it starts mlbrowser

I originally tried to leave fbi open and load images into it but it kept on opening new instances of fbi causing a memory leak.

Would anyone have any ideas how to keep one instance of fbi open a load the files into it based around my current script?

Thanks again..

steveb4pi
Posts: 62
Joined: Sun Aug 11, 2013 6:12 pm

Re: fbi slide show script has gaps between images

Wed Nov 19, 2014 10:45 am

I had a similar problem with fbi (not functioning in the background and 'eating' memory if you use it to show 1 image at a time)
My requirement was to 'pause' a slideshow = I expect my 'cunning trick' with soft links (alias) will help you ..

I set fbi to 'loop for ever' showing 3 'static' image names, d.jpg, a1.jpg, a2.jpg (see note at end)
Make a1.jpg and a2.jpg both 'alias' of d.jpg (ln -s -f d.jpg a1.jpg, ln -s -f d.jpg a1.jpg)

When you want to 'display a new image', make d.img an alias of the new image (ln -s -f new.jpg d.jpg)
(so my slide show will 'pause' as the 'display a new image' (background task) checks for a button push before changing the alias to a new image)

NOTE. fbi has to be started with (at least) 3 images, since even with -chachemem 0, fbi will 'cache' 2 images (and thus never load the 'change') eg. fbi -d /dec/fb0 -a -noverbose -t 3 -cahcemem 0 d.jpg a1.jpg a2.jpg
(with -t I set it to run 'for ever' on a 3 second cycle over the 3 images - so changing d.jpg should result in the new iamge appearing within 1s)

NB don't be tempted to COPY new.jpg to d.jpg (fbi will show 'corrupted' data on screen as the file it's in the process of loading is overwritten by the cp)

Update:
Further details can be found on the Maidenhead Astro website (for whome I built the photoframe):-
http://www.maidenhead-astro.net/public/ ... ow-th#5000
(in case the link doesn't work, the info is at the bottom of the FAQ page, reached via the 'Beginners and FAQ' page (click link to the 'FAQ' page, near the top of the Beginners page & scroll down to last in list (#5000) & click the '+' to expand it)
Last edited by steveb4pi on Fri Sep 25, 2015 9:25 am, edited 1 time in total.

User avatar
paddyg
Posts: 2541
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: fbi slide show script has gaps between images

Wed Nov 19, 2014 4:22 pm

also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

steveb4pi
Posts: 62
Joined: Sun Aug 11, 2013 6:12 pm

Re: fbi slide show script has gaps between images

Fri Sep 25, 2015 9:41 am

paddyg wrote:can you pipeinput and output to fbi?
Nope = however there is an 'improved' version of fbi, (fim) that can be 'piped' ... but has (multiple) other problems, not least of which is the need for user (keyboard) input before 'moving' from one photo to the next

There is also a 'background' version (feh) that also has other problems (for one it insists on drawing a 'cursor' over the photo it's showing !)

Both fim and feh 'show promise', however I've not spent much time with either. As with most Pi 'solutions', once I've invested the (excessive) time and energy required to get various apps and tools to 'talk' to one another, I'm reluctant to 'try somethiong new' = since I know I'll be 'back to step one' with a non-working system. Sticking to fbi (despite the problems) really is a case of "it's better the devil you know" :-)

Return to “Python”