Video stutters when loop starts (Raspberry PI, ofxOMXPlayer)

I use ofxOMXPlayer for video playback on Raspberry PI. Everytime loop ends and new loops starts, at the beginning of the loop, video stutters. Here’s video:

https://vid.me/Z2jP

Anyone experienced such behavior? Any tips how to solve it?

1 Like

Does it do the same with 1280x720?

Hello, Jason,
we did try 1280x720 and it works fine (60FPS).
btw, the video file with issues is 1080x1080 H.264
we also tried these:

  1. http://download.openbricks.org/sample/H264/big_buck_bunny_1080p_H264_AAC_25fps_7200K_short.MP4 (looks fine, but FPS drop ~30)
  2. http://download.openbricks.org/sample/H264/h264_sintel_trailer-1080p.mp4 (looks fine, but FPS drop ~30)

All videos are the same codec.

Thanks for any help!

I’ve had problems with stuttering video loops and garbage frames and that type of thing as well. I heard certain codecs work better than others. Animation codec maybe? Or motion JPEG?

You could also try a sort of hack, where you have two videos playing at once and offset them to disguise the stutter when one starts over (basically, draw one while the other is resetting, and vice versa)

Hard to say - a few things

Texture mode works pretty well up to 720p The more keyframes the better. Maybe try and encode with more I-frames

If you are not overlaying anything/using the texture for shaders, etc Non Texture mode may be the way to go as it is more performant

Add an audio track (even a blank one) sometimes helps

Thanks @jvcleave and @dennyroberts for you help.
We reencoded video file with AFX and now it works just fine.

Hi all,

This post did unfortunateley not solve the problem for me. I am working in a museum and we started to build our own media players based on the raspberry Pi, openFrameworks and ofxOmxPlayer. It worked very well until at some point the stuttering appeared. In some projects it is not a problem, not even noticable (due to the start screen of the movies), so I can’t tell if it is related to raspbian Version, OF Version, ofxOmxPlayer Version or even Pi Version (B+ vs. 2).
All I can say is:

  • It worked in the first projects (Pi B+, OF 0.84, set up Beginning of 2015) without stuttering (the machines are still running fine).
  • The movies working fine in the old projects do stutter if same code is compiled on an actual machine (Pi2, tried both OF 0.9 and 0.84, actual ofxOmxplayer, tried both “master” and “looping-alt” branch).
  • All Projects are non-textured mode, different resolutions though.
  • I did not manage to use a video codec that solved the issue for me yet.

Any insight to the nature of the problem would be highly appreceated! Please help me collect.

@barelief: would be nice if you share your experience which codec settings (video/audio) work.

Thanks in advance!
oe (christian)

Hey! it was default mp4 H264. However it started working only after exporting from After Effects

Hi all,

The topic should IMHO not be marked as solved, for there seems to be a problem in ofxOMXPlayer. Find here a summary as well as a possible workaround:

For some videos the following problem occurs:

  • video is played smoothly with omxplayer
  • same video played with ofxOMXPlayer stutters wildly (jumping back some frames) on the beginning of each loop for multiple seconds (non-textured mode and textured mode)
  • this problem occurs on Pi2, Jessie and OF 084 and 09, actual Version of ofxOMXPlayer. Older systems might not have this problem (we have a working Wheezy 084 on a Pi1 for example which does no stuttering, but we did not exactly trace down which combination has the problem and which not)
  • It is not a problem related to video loading but to starting/looping the video

I traced down the problem to the profile of H.264. Baseline does work, main and high brings the stuttering problem for me - when working with ffmpeg. When using Adobe Media Encoder (or AfterEffects as mentioned above) profile main works also usually. So we still have to dig deeper in this.
At the moment I use the following ffmpeg parameters to get a good video:

-vcodec libx264 -profile:v baseline -preset:v slow -level 3.1 -refs 2 -coder 0

It also works with level 4.1, without the coder 0 (so with CABAC) and so on. What makes the difference is the baseline profile. It does not make a lot of sense because I have a FullHD clip and baseline is not meant to do FullHD, but it works.

Hope this helps!
Share your experience please…
oe

1 Like

Hi all,

my post above still is valid after further testing: profile baseline does work and is a possible workaround.

The following just for the pros, maybe someone can trace down the actual problem with more information (for it is only a workaround, the problem persists): Profile high brings problems in any case. Most of the time profile main does too. I actually do not understand why main works when exported from adobe. I found 2 possible differences: One is that adobe adds “standard: PAL” to the video (what I simply don’t understand), second is that the container settings (please note: not video codec settings, which is always the same) seem to be different. ffmpeg leads to stuff like
Format: MPEG-4, Format profile: Base Media, Codec ID: isom
When exporting from EDIUS I get
Format: MPEG-4, Format profile: JVT, Codec ID: avc1
Both stuttering wiht profile main. Adobe brings
Format MPEG-4, Codec ID: M4V
with no stuttering on profile main. I could not get ffmpeg to give me that combination for testing. Video and audio codec are the same.

One more interesting thing: I can use the following in ffmpeg:
-f m4v -vcodec libx264 -profile:v main -preset:v slow -level 4.2 -refs 2
to get a non-stuttering main-video which has no audio though. When using ffmpeg to mux audio and video afterwards I get the same result as above (stuttering and container settings identical).

Hope that helps to find the problem. Contact me any time for questions or example videos.

Have a good day!
oe

2 Likes