1

I use omxplayer for videos and fbi for images. My problems is that when command fbi run the nex command will run at the same time. How can I serialize the fbi commands so that images and videos are showed one after the other without big gaps.

fbi -noverbose -nocomments -T 1 -1 -t 10 ${IMGS[$PLAYING]}
let PLAYING+=1
omxplayer -r -o hdmi ${VIDS[$PLAYING2]}
let PLAYING2+=1
fbi -noverbose -nocomments -T 1 -1 -t 10 ${IMGS[$PLAYING]}
let PLAYING+=1

4 Answers 4

1

I found this kind of solution. While loop waits until omxplayer and fbi process has ended and then next image or video can be shown.

while ps ax | grep -v grep | grep -E "omxplayer|fbi" > /dev/null; do 
    sleep 0.1
done
0

You can introduce a short fixed delay of maybe 3 seconds by calling:

sleep 3

or you can prompt for a keypress before continuing, so something like:

read -sn 1

which will only continue with the script when a key is pressed.

Is that the kind of thing you mean?

0

You can count total image display time by list all image files in a file and count total number of files say n. If time for one image on screen ex. 3 sec. then total sleep after fbi statement is n x 3 sec

omxplayer process running in foreground hence no problem for omxplayer it cannot let next statement run before it complete.

Above setup is working for me but sometimes screen is blank for image while debugging I found that fbi is running and omxplayer is not running, i.e. processes on system are running as required but I am not getting why screen is blank. Once this happen video is working fine while image always bank. On next reboot it may correct but again after sometime it start happening.

Most chance to happen this when video file size is 18mb or above it. Very rare in case of small video files.

0

To avoid having to exclude grep from the results you can use the following while loop

while pgrep -f /usr/bin/fbi || pgrep -f /usr/bin/omxplayer;do
    sleep 0.1
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.