ofxOMXPlayer buffering before starting a video

Hello everybody.

I’m trying to use ofxOMXPlayer to play a list of FullHD videos and I’m experiencing stutter only during the first seconds of each video. I’ve already seen some topics about this in the forum, but all of them end with some tips for converting the videos to an “ofxOMXPlayer compatible format” so that this doesn’t happen.

I’ve done some tests and I’ve seen that if the videos are set with “enableLooping = true”, then when the video loops the stutter at the beginning of the video is not happening, so this makes me think that the problem is not related to the video format but to the system not able to fill the buffer quickly enough when starting to play the video.

Is there anyone that knows if there’s the possibility to “preload” the video before starting to play it, or to tell the ofxOMXPlayer to make sure to fill the buffer before beginning to play the video, or to tell the ofxOMXPlayer to start the video in pause mode so that we can wait for some time before starting to play it to make sure the buffer is full enough to play smoothly?

Thank you very much in advance!

Hi jordiblanchcarles!

As you have seen (ofxOmxPlayer Stutter on video open/start and Video stutters when loop starts (Raspberry PI, ofxOMXPlayer)), I did quite some testing some time ago. I tried things like loading all videos in setup. Did not help. Also I tried pausing the video and playing after only after some seconds - did not help either. I am afraid that the only thing that worked for me was to change the codec. I know it’s unsatisfying - especially as this problem did not exist in earlier verions and also does not exist in omxplayer. But after all you can not expect to work a player with each and every codec. If you can change your videos you will be happy with ofxOmxPlayer.

What I did not try was to start the video hidden (off-screen maybe as a possibility, so draw it at (-2500,0)?), let it run for some time and then move the video on-screen and re-start it. So if you like to try this, please share your experience, so that I can update the posts that already exist.

have a good day!
oe

Hello dasoe,

thank you for answering this question…

I’ve also done my tests with ofxOMXPlayer, and I’ve seen that (at least in my case) if you start a FullHD video in non textured mode, and keep it looping, then after a few seconds the video plays perfectly, and stuttering is gone (I’ve tested it with 10 seconds and 60 seconds videos). So this makes me think that the problem is not about how the video was coded but something else, and as the first thing one has to do is to buffer the video to memory, I was thinking that maybe this was the problem, that when starting the video the buffer is not full enough to play smoothly or that initial buffering needs so much cpu time that the video is not able to play smoothly.

I’ve been looking at the ofxOMXPlayer code, but it is too much difficult for me to follow to try to discover where’s the buffering of the video and how to wait for the buffer to be full before starting to play it (some kind of loadAsync() method already available with the ofVideoPlayer).

So, I don’t know if the creator of the ofxOMXPlayer will read this and give us some “light” to this issue… Maybe I’ll try harder to understand the code and try to check whether it is a buffering problem or not…

Best regards.

this is probably just an effect of the OS cache, when you read the file originally you are reading from disk but later on it’s cached and you are reading from memory so it’s faster. that could happen if the drive you are reading the videos from is not fast enough

I’m using the “official” NOOBS SD card, that is an 8Gb SanDisk Class 10 SD card… Do you think it is too slow?

IMHO the problem is not related to any cache or disk. I tracked down the problem and can produce it with any video, any card, any pi. Changing the codec (or finding the right settings, including no use of CABAC, correct GOP and so on) it vanishes. Also it does never occur using omxplayer from command line but (with the appropriate video) every time with ofxOmxPlayer. Also it does not occur with the same videos on old systems.
I described the problem in more detail the posts mentioned above. I think it only is not better known because some apps (like After Effects) produce videos that do work out of the box.

I look at this problem from another point of view: if the video plays perfectly with command line omxplayer, then the problem must be ofxOMXPlayer’s implementation/design and not the codec or any other thing related to the video, because it is demonstrated that a RPi can play it without problems using another software. Also, if a video is set to loop forever, then after some “warmup” time the video also plays without any problem from the beginning to the end.

The problem for me is that it is very difficult for me to follow the code and track down the issue.

I’ve seen there isn’t any activity on this addon since almost 1 year ago, what make me think that is an “abandoned” addon, but which could be it’s sbstitute?