I’m trying to get the ofVideoPlayer to play a mp4 video encoded with h264, but am getting:
[error] ofGstUtils: gstHandleMessage(): embedded video playback halted for plugin, module omxh264-omxh2640 reported: GStreamer encountered a general supporting library error.
[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded
- installed the good/ugly/bad gstreamer codecs
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad
- installed totem (which isn’t playing the video - or doing anything, for that matter)
- installed vlc (which plays the video with a LOT of stuttering and artefacts - which is probably normal since it’s a 720p video)
- opened with omxplayer: perfect playback
The OF videoPlayerExample works fine, and video playback is actually smooth, so I’m guessing it’s something to do with the H264 codec, but have no idea where to go next on this…
I can’t use ofxOMXplayer, since I need jump-to-frame (or jump-to-time) functionality, like moviePlayer.setFrame(frameNumber).
Any help is greatly appreciated
you should be using gstreamer 1.0 and the omx plugin not 0.10 and th ugly or bad plugins. in any case the install_dependencies script should be doing the right thing. indeed the plugin error message you are getting seems to be reporting from omx so that should be working but perhaps the videos you are trying to load have some strange format that is not supported?
I did run the install_dependencies and install_codec scripts before starting to do any compilation test.
I installed gstreamer 0.10 and totem as a desperate move to try and get codec support for the video.
The video is actually some HD video downloaded from youtube so it might have some weird codec.
What are the go-to video settings? I’ll re-encode it and see if it starts working.
i would try to compress it with ffmpeg or vlc but anything using h264 and quicktime should work too. also if you need jump to frame / time h264 is not the best format. h264 uses keyframes nd every frame in between has to be “interpolated” since th last frame so jumping to an specific frame is really expensive in terms of cpu/gpu usage and would be really slow. anything where all the frames are encoded as key frames like a jpeg sequence (which can be on an mp4 or mov container) would work better
With h264 it runs ok on my laptop, but didn’t really think of the impact it would have once running on the RasPI, good point.
I was thinking of using something like keyframe every frame, but I’ll give some different encodings a run to see which performs better for frame jumping.
Well, I re-encoded with normal H.264 and managed to get the RasPI to play it back. Playback is kinda “klunky”, both for a 640x480 and a 720p video, but it plays the video and audio. When the playback position jumping starts, all hell breaks lose (as predicted), with playback getting worse and worse with the number of consecutive jumps.
Tried encoding the video with mJpegA and B, but playback is even worse… Image freezes frequently and audio shuts off after 1 second or so of noisy playback. jpeg2000 doesn’t even start playback… Quicktime movie with Photo jpeg loads the movie but freezes the app on playback.
What would be good settings to allow for decent jump-playback?
And this question now goes away from programming, I know, but everything else seems to be working, only video playback isn’t that great.
something else to take into account is the colorspace conversion, since 0.9 there’s facilities in linux to do this in the GPU. by default formats like h264 or jpeg will come in yuv color space but OF by default asks for RGB so there’s a conversion that happens in the CPU which might be what is making things so slow.
before loading the video file, call:
and that will set the video to load pixels to the gpu directly in the format they are encoded and then do the conversion there through a shader.
you’ll need to use GLES 2 for this to work othereise you’ll see a b&w texture. in you main.cpp change the default main function with:
also the problem reading jpeg might be that the decoding is happening in the cpu instead of through the omx module or that the drive your are using is too slow in which case you could try using a faster sd card
I actually am using those settings already, I saw an older reply from you on another post and got that from there =)
So I’ll just keep testing with other encodings and eventually with a faster SD card to see if anything improves.
I know this is an old post but I’m having similar issues and was wondering if there’s any new insight…
I’m trying to load and play h264 video at 1080p on a Raspberry Pi 3 B+. I’m using the latest
master OF and Raspbian Stretch on the rPi. I keep getting a black screen when trying any video, except for the sample
fingers.mov video, that’s the only one I can get working. I tried re-exporting the video using ffmpeg or Quicktime but it still won’t load.
install_codecs.sh as suggested by @arturo above. I also tried setting the format to
OF_PIXELS_NATIVE with no luck.
Thanks in advance!
Often if you get a black screen it’s because you ran out of texture memory. might be worth a shot to give the GPU 256MB or higher