ofVideoPlayer crashes/freezes on RPi2 (news from Ecuador)

hello @arturo, @jmcleave @theo and all in the forum

we are working with this application, based on ofVideoPlayer, running on RPi2 in the context of an interactive installation in a museum:

We have been using 720p videos with h264 compression at 24fps (we have also used 15fps) in an mp4 container. the movies are controlled (load, play, stop) via commands sent from PureData via OSC in function of the data received from some floor sensors and an overhead camera (their state is polled every 5 seconds). 256 MB of RAM are assigned to GPU.

the application is run simultaneously on 4 RPis via ssh from a seperate machine that also runs the patch in Pure Data that controls them all.

the application works well but often randomly crashes or freezes - with no consistent error message - is it that the RPi simply cannot cope with constantly changing media compressed in H264? or is it a problem in OF or our code ? reliability seems to be greatly improved with Photo-JPEG codec at 15fps 75% quality and GPU at 192MB.

pedro

here is the selection of error messages that we have seen in the terminal window:


(trmxClient:2818): GStreamer-WARNING **: failed to create thread: Error creating thread: Resource temporarily unavailable
(trmxClient:2818): GStreamer-WARNING **: adding flushing pad ‘src_0’ to running element ‘multiqueue63’, you need to use gst_pad_set_active(pad,TRUE) before adding it.
[warning] ofGstUtils: getDurationNanos(): couldn’t query time duration
[ error ] ofGstVideoPlayer: allocate(): cannot get pipeline caps


(trmxClient:2877): GLib-GObject-CRITICAL **: g_object_ref: assertion ‘object->ref_count > 0’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_get_base_time: assertion ‘GST_IS_ELEMENT (element)’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_get_start_time: assertion ‘GST_IS_ELEMENT (element)’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_change_state_func: assertion ‘GST_IS_ELEMENT (element)’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_object_unref: assertion ‘((GObject *) object)->ref_count > 0’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_abort_state: assertion ‘GST_IS_ELEMENT (element)’ failed
*** glibc detected *** ./trmxClient: corrupted double-linked list: 0x6c14dcf8 ***


[notice ] *********+ EL Media Index ES 1
[notice ] stop
Killed
/home/pi/of_v0.8.4_linuxarmv7l/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:168: recipe for target ‘run’ failed
make: *** [run] Error 137


(trmxClient:2877): GLib-GObject-CRITICAL **: g_object_ref: assertion ‘object->ref_count > 0’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_get_base_time: assertion ‘GST_IS_ELEMENT (element)’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_get_start_time: assertion ‘GST_IS_ELEMENT (element)’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_change_state_func: assertion ‘GST_IS_ELEMENT (element)’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_object_unref: assertion ‘((GObject *) object)->ref_count > 0’ failed
(trmxClient:2877): GStreamer-CRITICAL **: gst_element_abort_state: assertion ‘GST_IS_ELEMENT (element)’ failed
*** glibc detected *** ./trmxClient: corrupted double-linked list: 0x6c14dcf8 ***


[notice ] mp4
[notice ] is video
Killed
/home/pi/of_v0.8.4_linuxarmv7l/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:168: recipe for target ‘run’ failed
make: *** [run] Error 137


you seem to be using OF 0.8.4 there’s several fixes in 0.9.3 for the gstreamer video player. i would try using that or if you can’t switch versions for some reason, perhaps using ofxOMXVideoPlayer which should also be slightly faster in the PI.

also from a quick look in the code it seems you are using RGBA pixel format, unless you are playing back videos with alpha, in which case you would need RGBA, setting the pixel format to OF_PIXELS_NATIVE will make the playback way faster

1 Like

thanks @arturo. we need the alpha because we are fading between layers of video. good to know about 0.9.3, will update when we can.

that should be fine, you can fade between layers with any pixel format. you should only need RGBA if the video itself has alpha otherwise it’ll slow things down a lot unnecesarilly

great, thanks arturo, will try that change

Hmm they didnt seem to like it ! Various freezes and error messages. Unfortunately I am not personally present with the machines at the moment so I cant do a thorough debug - I will get back onto this in mid-august when i return to Ecuador … will keep you all updated ! thank you !

Hi, you’re probably on top of this already, but one super common reason for RPI crashes is the power supply. Are you getting the same crashes with just one RPI sitting on your desk?

thanks hahakid, yes on top of that but it never hurts to recall the basics.

i’ll be posting updates of debug process when i get back to ecuador late august …

nobody seems to doubt that stability is achievable with this code so that’s encouraging :slight_smile:

hi all, back in Ecuador. While in Mexico we did tests of the code with an RPi 3 and the latest versions of the OS and OpenFrameworks and with OF_PIXELS_NATIVE. As usual it works well but then at a certain moment, after about 20 mins, it crashes (freezing the pi). This is the same problem that we are still having in the exhibition. When we run only with still images it doesnt crash. We ran htop to see the load on the processor and it doesnt seem to be stressing when playing the videos. On Tuesday we will take down the exhibition and be able to debug more thoroughly but if anybody has more suggestions about the code they would be more than welcome … p/

I’ve seen several reports similar to this one lately and my suspicion is that this is a problem in the omx module for gstreamer and not in OF itself but haven’t had time to test it. The videoplayer under linux works without problem and doesn’t have any memory leaks but in the pi where the internal code is exactly the same seems to crash after a while, probably from some leak or too many opened files.

This usually happens when closing and reloading the player so one thing that might fix it is to load all the movies you need to play from the beginning and just swap between them without ever closing them. If you need to play a lot of movies that will probably use too much memory and be too slow though.

Another posibilty would be to uninstall the gstreamer omx module i think it’s:

sudo apt-get remove gstreamer1.0-omx

and try with that, if the problem really is in that module that should fix it but playback might be too slow depending on the resolution since omx is the module that allows to use the hardware accelerated decoding in the pi

Thanks Arturo.

I filed a bug report in the gstreamer bugzilla, quoting you, i hope thats ok
https://bugzilla.gnome.org/show_bug.cgi?id=770420

we are currently loading just one movie at the beginning and then stopping and starting it, a lot, and the same thing is happening so i dont think it’s the loading. but maybe it is the multiple starting & stopping. need to do a test of never stopping it and see what happens.

we’ll be taking the exhbition down on tuesday next week so then i’ll also be able to do the test of removing the omx module - bit nervous to do that in the last few days of the expo !! When I test will let you know.

p/

Here is the crash report from the application (trmxclient) with OF O.8.4 —>

http://piratepad.net/0uPIhAVSj3

coming soon 0.9.3 !!

x

yeah use better 0.9.3 there were several bug fixes from 0.8 -> 0.9

we already know that 0.9.3 doesnt work out of the box - it gives the same
error - however it seems that this could be because it is still using the
gstreamer1.0-omx 1.0.0.1-0+rpi13rpi1 - as mentioned here in the
gstreamer bug report
https://bugzilla.gnome.org/show_bug.cgi?id=770420

for some strange reason this module is not getting updated in the standard
gstreamer release for raspian - so now trying to do that …

the release of gstreamer in the raspbian repository is 1.4 and the omx module still version 1.0 ! since then there have been a lot bug fixes but strangely it has not been updated in the raspbian respository.

there is a build here of omx 1.2
http://vontaene.de/raspbian-updates/dists/main/

but i am not sure how to upgrade the omx module in gstreamer with this build …

what is the version of gstreamer that the current openframeworks is using ? if i update to 1.9 on the pi will openframeworks still function ?

thanks

Hey,

if you would like to test with the latest GStreamer this could be of help. It will create what is called a GStreamer uninstalled environment for you so that you can use/test the latest versions of GStreamer and related modules without having to mess with your system wide gst configuration.

HTH,
Petros

That’s really nice petros.

Pedro, you can also try using archlinux, it’s usually much more up to date than raspbian (they are right now on 1.8 for gstreamer and 1.2 for omx) and compiled for armv7 so f you are using a raspberry pi 2 or 3 you’ll be able to use the arm7 distro for openFrameworks which should be slightly faster than armv6

Great, Petros, thanks, will try it out !

ok, thanks. will test with archLinux then.

I tried to compile the gst omx 1.2 for the latest version of raspbian, seemed to work but then it is still version 1.0 when i ask for info :frowning: details here http://piratepad.net/0uPIhAVSj3

hi petros, all installed well, version 1.9.2 !

now in the readme it says “if you enter the environment and work directly from there i.e executing ~/gst/gst-$BRANCH … every application that executes inside this shell will load the latest versions”

in my case it is ~/gst/gst-master (as root because it is installed in the root folder - i assume because i did it as sudo?) but i don’t understand how to “execute” the script - it doesnt respond to ./ nor sh nor bash - it doesnt complain about permissions but i chmod +x just in case with no change. Is there any further setup or other manipulations to do ?

i would like to work directly from the environment so to execute gst-master and then navigate to my application and do make run

thank you very much

pedro