I need to write a program on my Raspberry Pi to get a video and audio stream with Gstreamer from network and play them.(I have two stream. one for video and one for audio) and i need a custom GUI. I followed the below link :
http://www.jonobacon.org/2006/08/28/getting-started-with-gstreamer-with-python/
It used PyGtk and I want to switch to PyGObject. my question is : does PyObject support Gstreamer as well as PyGTK? or I should stuck to PyGTK? Or do you have a better solution to do that on Raspberry Pi
Considering the age of the article you linked, you might already know that there are newer versions of the libraries around. PyGtk and PyGst don't provide bindings for these.
Python GObject Introspection supports the Gkt-3.0 and Gst-1.0 versions. So you're safe using PyGObject for your program.
There's a quite good documentation on lazka.github.io/pgi-docs/ covering a lot more bindings as well.
Besides if you're going to build an audio/video player have a look at the playbin element. It's a complete pipeline supporting an audio-, a video- and a text-sink at once.
Related
I'm looking for a Python audio playback library that supports cue sheets. I found a good list of libraries here, but none of them seem to work with cue sheets (at least not from what I've seen in their documentations). Is there anywhere I can find something like this?
I would prefer if it's something that can work with PYQT5, but it's fine if there isn't anything like that!
I ended up deciding to use QMediaPlayer (part of PyQt5), along with this logic.
I had to install K-Lite codec on my computer, otherwise it would only play .wav files. Here is the download link for that.
Edit: QMediaPlayer ended up not supporting gapless playback, so I switched to pyglet which works for non-mp3 files. pyglet can also be used with PyQt5 because pyglet.app.run() without a pyglet window can play the audio in the background, which can be controlled from the GUI application running on PyQt5.
However as Denis pointed out in the comment to this, there are many other issues I hadn't considered.
I am working on Debian based embedded systems that avoids the overhead of windowing systems by running graphics directly to the screen using FBCON (similar to DirectFB). This is common with Raspberry Pi screens and there are plenty of resources to do this with pygame 1.9.1 (SDL1.2 based) and FBCON. Python 2.7 and pygames 1.9.1 running with FBCON is my currently working arrangement.
I want to move to Python 3 and the improved SDL2 library (pygames updates are very slow), but I need to retain the lower level graphics capability. I see little documentation of the level of support besides a couple mentions of DirectFB capability.
I am not using Raspberry Pi, so specific solutions to the Pi will be less helpful for me.
Before going to deep, I wanted to see if anybody else has experience with this.
Has anybody successfully run pysdl2 or just sdl2 without x11?
Was there any issues or changes besides the flag for the DirectFB driver?
Has anybody tried this with the alpha pygames 1.9.2?
Besides being helpful for myself I think this would be great for the community. I see other asking similar questions but with minimal or no useful answers.
Thanks for the time
References:
pysdl2
libsdl
I am using the Raspberry Pi 2 to load large resolution images using opencv. I have sketch running, but without apparent "OpenGL" support as the opencv library states that it is not supported:
OpenCV Error: no OpenGL support (Library was built without openGL support)
I attempted to install pyOpenGL, but this had no effect. I am pretty new to graphics programming, so I'd take any suggestions on how to render to the GPU of the Raspberry Pi.
Ive stumbled across a Python friendly module that contains a GLSL API with quite a bit of examples :
http://pi3d.github.io/html/
You shouldn't need to deal with the gpu. Try following this blog, as it seems to have OpenCV install instructions. You might want to set INSTALL_PYTHON_EXAMPLES ON, but that is the only difference I could see.
Then you should be able to use it with python. If not, you may need to add it to your PATH.
I am hoping to find a way to write generated video (non-real time) from Python and mix it with external audio file (MP3) simultaneously.
What's the current status of GStreamer Python bindings, are they up-to-date?
Would it be possible to write MPEG-4 output with GStreamer and feed raw image frames from Python
Is it possible to construct pipeline so that GStreamer would also read MP3 audio and mix it into the container, so that I do not need to reprocess the resulting video track with ffmpeg etc. external tools to have the audio track
Are there any up-to-date tutorials for using GStreamer with Python? (I couldn't find anything dated since 2006-2009)
(my old question: did not really give good pointers Writing video with OpenCV + Python + Mac )
Whether or not the binding are "up-to-date" really depends on what version of Python you're using. As for Python 2.7, I am using GStreamer without incident.
I have been fighting a major bug in developing with Python 2.7 and GStreamer on Windows 7 (WinBuilds installers), but I'm able to work with GStreamer just fine on Ubuntu.
GStreamer does have mp3 codecs, but there are some legal matters surrounding their legality in some countries. I'd do a Google search on that before using them.
As for tutorials, no luck. All the same, the existing tutorials do quite well for the modern version, especially this one and this one.
In regards to writing MPEG-4 output and feeding raw images, I do not know. That would be a good stand-alone question, in all honesty.
I've been using WxPython and I've tried Tk, but it seems that, while both are good and I'll likely use them for other projects, neither of those appear to be capable of accomplishing the things that I want for my current project (which is fine, they're good at what they do).
Basically what I'm looking for is something that will allow me to make rich graphical GUIs. My specific goal is a window that will draw bitmap buttons, resize the parent window automatically to fit them, and possibly animate the resize with a slide effect and have the buttons fade in. Also being able to have my own window border style instead of the inbuilt one is important to me.
This particular project will be Windows only, so non-portable libraries are fine in this case, though portable ones would be great too.
If I missed how this can be done in either WxPython or Tk, I'm all ears.
PySide: http://www.pyside.org/
The PySide project provides
LGPL-licensed Python bindings for the
Qt cross-platform application and UI
framework. PySide Qt bindings allow
both free open source and proprietary
software development and ultimately
aim to support all of the platforms as
Qt itself.
The Windows version of PySide is quite new and may be considered as a beta version. PySide is API compatible with PyQt.
How about PyQt?
http://www.riverbankcomputing.co.uk/software/pyqt/intro
Just sharing my opinion: Kivy.
Innovative open-source library. Supports both 2.x and 3.x versions of Python.
Kivy - Open source Python library for rapid development of applications
that make use of innovative user interfaces, such as multi-touch apps.
Kivy is based on OpenGL ES 2 and includes native multi-touch for each platform and Android/iOS. It’s an event-driven framework based around a main loop, and is thus also suitable for game development.
Try Pyglet. Its a library for python that makes using OpenGL very easy. You can draw pretty good 2d interfaces using Quads.
I can't tell you what is best because that is subjective but I can give you another option: PyGTK
PyGTK lets you to easily create programs with a graphical user interface using the Python programming language. The underlying GTK+ library provides all kind of visual elements and utilities for it and, if needed, you can develop full featured applications for the GNOME Desktop.
PyGTK applications are truly multiplatform and they're able to run, unmodified, on Linux, Windows, MacOS X and other platforms.