Hap video codec support on Linux or other hardware accelerated codec

I’m looking forward to deploy a video installation with a lot of high resolution video sources blended together.

My dream is to get something like Hap codec working with the native videoplayer class on linux

I use Arch, Openframeworks 0.9.8 and gst-libav-1.10.2-1

Maybe I am a little bit naive, but looking at gstreamer-libav documentation, I taught hap was supported and that would make it enable by default since the videoplayer is gstreamer based.


But when I try to read this file on the linux platform I get

checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl rtaudio gl glu glew gtk+-2.0 libmpg123 
[ error ] ofGstUtils: startPipeline(): unable to pause pipeline after 5s
[ error ] ofGstUtils: gstHandleMessage(): embedded video playback halted for plugin, module uridecodebin0  reported: Your GStreamer installation is missing a plug-in.
ofGstVideoUtils: update(): ofGstVideoUtils not loaded

Using ffmpeg, I am able to convert a video to the hap format in .mov container using ffmpeg on the linux box (compiled ffmpeg-git and added to the pkg --enable-libsnappy)
using this:

ffmpeg  -i /pathToInputFile/movie.mp4 -map 0:0 -an -c:v hap -b:v 9354.24k -maxrate 18708.48k -bufsize 18708.48k -r 30000/1001 -s 1280x720 -aspect 16:9 -pix_fmt rgba -coder ac -trellis 0 -subq 6 -me_range 16 -b_strategy 1 -refs 3 -sc_threshold 40 -keyint_min 30 -g 60 -qmin 3 -qmax 51 -metadata creation_time=now -sn -y /pathToFile/movieInHap.mov

Does anybody have a success story with HAP on Linux or a workaround to get hardware decoded texture from a video file?

Thanks a lot!

are you able to play that hap file using totem or any other gstreamer based player? if it works there it should work with OF too but from what i see, gstreamer contains some encoding/decoding plugins for hap but there’s no muxers yet. also can you post a small hap video to test?

Thanks for the reply,

Here is a short sample in hap compressed with ffmpeg

Here is the same thing using quicktime on Osx to do the conversion (it is exactly the same thing)

Playing the file with totem return this error

** Message: Missing plugin: gstreamer|1.0|totem|video/x-gst-fourcc-Hap1 decoder|decoder-video/x-gst-fourcc-Hap1 (video/x-gst-fourcc-Hap1 decoder)
** Message: Automatic missing codec installation not supported (helper script missing)

using mPlayer works and successfully decode the codec

Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.70.100 (external)
Mismatching header version 57.24.102
Selected video codec: [ffhap] vfm: ffmpeg (FFmpeg Hap)

Seem’s like a issues that is gstreamer and gst-libav related since it can be played with ffmpeg based player but not with gstreamer?

Yes that’s correct. Maybe contact the GStreamer team and see if they have anything to say about it.

Just spotted this topic - ffmpeg’s Hap playback isn’t (currently) hardware accelerated, so you would lose the benefit of Hap even if it worked that way.

I’m in the process of getting ofxHapPlayer going on Linux - it’s a work in progress, but running on Ubuntu. The remaining issues are mostly around audio playback. Check out the libavformat branch, and check the instructions in the README.

1 Like

thanks for the hint and your awesome work @bangnoise
I’ll get my head in it soon and I’ll try to make it work on archlinux.

cheers @gllmar - would be great to hear if you get it going, and to update the README with any arch-specific steps you have to take.

Hey, any news for the linux implementation? Would be mega great to get this running on linux…

I think that using the ofHapPlayer/libavformat branch on ubuntu works
Take a look

I did not had time yet to make it work on archlinux yet. Soon…!

Yeah, the libavformat branch works on Ubuntu, and I will merge it to master soon(ish). If you’re on a different distribution and need any pointers to get it running, give a shout.

Ubuntu is great. Will give it a try. Thanks!

Sorry it took me ages to test it, I am having some troubles making the libavformat branch works with archlinux.

libdispatch does not install because gnustep-libobjc2-clang-svn chokes because it does not find these package.

error: target not found: gcc-libs-multilib
error: target not found: lib32-clang

also, I had to modify libpthread_workqueue-git to make it work, but still no success.

seem’s a lot easier on ubuntu…!

I used libdispatch for convenience - it’s used to perform multi-threaded decoding when frames are split into chunks. I’m not sure how large the arch linux OpenFrameworks userbase is - if there is demand I could switch to an alternative solution and drop the dependency.

at the moment libdispatch isn’t available on Debian 9 either (and i cannot even build it, as also libkqueue-dev isn’t available on Stretch.

I’d gladly accept a pull request with a simple alternative to libdispatch for efficient multithreaded decoding on linux

1 Like