akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

GO Media & Image library for RaspberryPi

Sat May 20, 2017 2:33 pm

I'm working on a Go project that requires playing of video & displaying images on Raspberry Pi 3... Please recommend which Media library / API's, I can use in go-lang for video playing & image display. Please note that I don't want to call OMXPlayer& FBI image buffer like below cmnd, err := exec.Command("omxplayer", moviePath+movieName).CombinedOutput()

Development Machine: Ubuntu 64 Target : Raspberry Pi3 Programming Language : Go

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Sun May 21, 2017 3:02 pm

No one knows about this

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Sun May 21, 2017 11:36 pm

As Go is a fairly new language and is not much used for GUI applications I would be surprised to find multimedia libraries for it. In fact I would expect that Go has very few libraries all around compared to the huge ocean of code available in C/C++.

However one can use libraries written in C/C++ from Go.

For example there is the C++ Qt GUI Toolkit for which bindings for Go exist. https://github.com/therecipe/qt (Including raspbian support) and https://github.com/visualfc/goqt. I have never used either of these and cannot vouch for their effectiveness.

Or what about using GTk from Go: https://github.com/gotk3/gotk3 ?

Or perhaps SDL: https://github.com/veandco/go-sdl2 ?

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Mon May 22, 2017 6:29 am

I am looking for something that is purely written in go. I found few experimental project for Image Viewer but I never came across anything for Media Player to play video.

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Mon May 22, 2017 7:37 am

akhter.ahmed,
I am looking for something that is purely written in go.
Why?

I presume that what you actually want is to display images, video and other GUI stuff from your program written in Go. If there are libraries available to do that then why care what language they are written in?

At the bottom of the software stack you are using Linux, written in C, and most probably X Windows, again written in C. Why worry about what language the GUI library is written in?

One way to tackle this problem is to write your application in Go as a web server. Then the images and videos would be displayed by a web browser. Or perhaps a GUI application written in Javascript using Electron.

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Mon May 22, 2017 7:59 am

Because recently, I faced few issues regarding cross compilation of few libraries for Raspberry Pi, finally vendor told us that they do not support Raspberrypi, checkout below links because these issues prefer to have something purely written in go..
https://github.com/go-gl/glfw/issues/197

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Mon May 22, 2017 8:53 am

Now you are confusing me. GLFW is an OpenGL library written in C. So now you are talking about 3D rendering rather than image or video display.

Personally I would forget about cross-compilation and just build whatever you need on the Pi itself. I'm pretty sure that you can meet all of GLFW's dependencies that way.

If hardware accelerated OpenGL is what you want then that can be done using Qt. I have done that on the Pi. However it only worked by rendering directly into the frame buffer, full screen. That was some time ago though, when there was no hardware acceleration of GL in X Windows. Perhaps it can now work in X Windows as well, I have not kept up with developments there.

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Mon May 22, 2017 9:02 am

I am not confusing you, I am just telling you my experience regarding cross compilation. But that was another project.
Anyways back to our topic, I will try to use qt for Video & image rendering with Go on Raspberrypi.
In addition, if you want to advise me something regarding Video & image rendering, it will be great.
Thanks

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Mon May 22, 2017 9:22 am

akhter.ahmed,

Sure you are confusing me. It may not seem confusing at your end but it sure is here. You opening post says:
I'm working on a Go project that requires playing of video & displaying images on Raspberry Pi 3.'
Subsequently you talk of problems with GLFW which is not a video or image library.

And now it's "But that was another project".

Anyway, I am no Go guru but I feel sure that with persistence you can get images and video displayed from Go on the Pi. Just keep it simple by forgetting about cross compilation and using perfectly good existing libraries written in C/C++ or whatever other language.

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Tue May 23, 2017 3:18 pm

As per our earlier conversation, I used QT wrapper for go... During cross-compilation I am getting below issue, kindly help me to fix it....

I am using QT Binding/Wrapper for Go in my project. Project is compiling fine for amd64 but when I try to compile project for arm devices, it gives me below error

github.com/therecipe/qt/core
# github.com/therecipe/qt/core
g++: error: unrecognized command line option ‘-marm’

-------------------------------------------------------------------
Please find below my go environment variables setup

GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/minhaj/GoLang"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
GOARM=""
CC="arm-linux-gnueabi-gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-
map=/tmp/go-build277718108=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Tue May 23, 2017 6:03 pm

As I said above it will be far easier to build this on the Pi itself. I have setup cross compilation tools for various systems many times and it is often a painful experience. Many times I gave up trying to make it work.

For example, the error message you give indicates that your build system is trying to use the GCC for x86 on your PC rather than an ARM GCC cross compiler. Do you have an ARM GCC cross compiler installed on that machine?

It is far easier to just build what you need on the Pi itself.

Try following the instructions in the qt binding repository: https://github.com/therecipe/qt#raspberry-pi

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Wed May 24, 2017 5:20 am

Yes, I have installed ARM GCC cross compiler, please look at enviroment variables CC="arm-linux-gnueabi-gcc".
Error I am getting during cross compilation is from g++, please look at enviroment variable CXX="g++".
Building everything on Raspberry Pi is an option but I will prefer cross compilation.
Please advise how to solve below issue
github.com/therecipe/qt
github.com/therecipe/qt/core
# github.com/therecipe/qt/core
g++: error: unrecognized command line option ‘-marm’

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Wed May 24, 2017 5:47 am

akhter.ahmed,

I have no idea really.

But surely if

CC="arm-linux-gnueabi-gcc"

is correct then

CXX="g++"

is wrong. Should it not be:

CXX="arm-linux-gnueabi-g++"

Otherwise you are using your hosts g++ compiler which will be for x86 and does not understand "-marm"

I'm just clutching at straws here, having never done this particular build. Sorry I cannot help more.

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Wed May 24, 2017 5:52 am

Thanks for your help & prompt response.

If I set CXX=arm-linux-gnueabi-g++ then it gives below error

github.com/therecipe/qt
github.com/therecipe/qt/core
# github.com/therecipe/qt/core
src/github.com/therecipe/qt/core/core.cpp:9:30: fatal error: QAbstractAnimation: No such file or directory
compilation terminated.

Any idea?

Heater
Posts: 12954
Joined: Tue Jul 17, 2012 3:02 pm

Re: GO Media & Image library for RaspberryPi

Wed May 24, 2017 6:10 am

Do you have all the Qt 5 source code, on that machine? You cannot cross-compile anything without the header files being in the right place.

You may even need to have all of Qt5 cross compiled for the ARM first as well.
Which of course means you need all the libraries that Qt 5 depends on available on that machine as well. And perhaps cross-compiled already.

Like I said, cross compiling is a pain.

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: GO Media & Image library for RaspberryPi

Wed May 24, 2017 6:23 am

I have Go-QT Binding source code on my machine. I have posted queries to https://github.com/therecipe/qt/issues/329
I will wait & see their response.

Appreciate your support

User avatar
Gavinmc42
Posts: 3408
Joined: Wed Aug 28, 2013 3:31 am

Re: GO Media & Image library for RaspberryPi

Wed May 24, 2017 6:25 am

I have used omxplayer to run videos and then used Netbeans to make a JavaFX app to overlay of the videos.
That only works because OMXplayer is custom for Pi's.
At the time it was the only way I could figure it out and that's the way you don't want to go.

What language can run videos on Pi's without OMXplayer?
Would it need to use OpenMax?
Could you play videos without VC4 help?
Can QT does this?

I suspect on a Pi 3 you could decode h.264 with NEON?
Still going to need framebuffer?
Next step up is using the DRM, Direct Rendering Manager, which is working in latest/next kernel?
KMS Kernel Mode Settings, instead of DRM, or KMS/DRM?
Most of this stuff is new and still evolving.

Things look improved in 4.11/4.12 Kernel.
Take a peak in Googles labs to see if they are playing with GoPi's.
AIY is latest from them and that is Python?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Other programming languages”