How to get wxPython video player working in windows - python

I'm trying to get the wxPython video player described here to work in Windows, so that I can do some minor modifications to it and get a script running that will let a user hit the spacebar while watching a video and spit out a record of the timing of each spacebar press. So far, though, I can't even get the videoplayer working; when I try to open a video, I get the following error message:
Unable to load (filename): Unsupported format?
A little google searching turned up the possibility that I might be missing gstreamer packages, so I installed the closest thing I could find from here, but it still doesn't work. What exactly do I need to have installed to get wxPython to play videos, and how do I install it?
Thanks!

wxPython should use GStreamer on Linux, if available. See http://wxpython-users.1045709.n5.nabble.com/wxpython-gstreamer-and-overlapping-panel-staticText-td4834139.html or http://pythonide.blogspot.com/2008/03/howto-write-wxpython-video-player-with.html although I don't see why that matters when the OP was talking about Windows.
I created a simple media player using the mplayer control. You can read about it here: http://www.blog.pythonlibrary.org/2010/07/24/wxpython-creating-a-simple-media-player/ It was tested on Windows XP and Windows 7 with no issues.

Related

Auto-Py-to-Exe | Signing a Windows EXE file

For the purpose of making a small piece of software for a friend to study I created a little GUI application with pysimplegui. Because he is not really tech-savy and still has a Win7, I tried to pack it as .exe ahead and then also created an installer and gave it via USB to him.
Unfortunately his Anti-Virus pops up and he gets sort of scared and didn't know what to do.
Figured out I could resolve it by signing the code with makecert but have to somehow get the key to be installed on his PC also.
Is there a way to implement that in the installer to spare him going through the technicalities?
I used the Auto-Py-To-Exe application to convert the python file btw and InnoSetup to create the Installer --- Before handing over, I did try it on a clean Windows7 VM and it worked after using the installer (thought the Registry wanted to get it installed properly).
Remove code from your program that may be harmful
Then virus detection software should ignore.

Unable to open a .avi file that I made using OpenCV

So I decided to try making a screen recorder and I was following a tutorial.
So, the code works exactly as it should but after I finish the code and try running the .avi file I get the following error:
I searched around the web but I couldn't find the answer for my question, you guys have any idea?
OpenCV uses FFMPEG under the hood and ships release builds without the proprietary codecs you often need. I’ve been compiling OpenCV from source for 10 years and have successfully gotten good and repeatable codecs maybe once. Here are my recommendations...
Did the video play in VLC? That often is more forgiving. Use VLC first to troubleshoot the rest of your code if it plays there.
Play with many different FOURCC codes. When using only free codecs, you have to iterate through a lot of them before finding a valid match. Also, I’ve found that settings such as too low a frame rate can cause players to not work well.
Build a copy of FFMPEG from source with non-free drivers, then build OpenCV from source using those. This is a rabbit hole of doom though cause each codec is itself a separate package and install. You will spend a lot of time learning how to build software.
Use OpenCV for image processing and write video using a video writer API directly. Libav/FFMPEG, libx264, and others all have direct callable APIs so you can use them.

Using webcam as a QR code scanner in Python-3.6

I have spent weeks looking for a way to turn my webcam (built into the computer) into a QR scanner using Python but nothing has worked.
In the first instance, I tried installing this software which supposedly would allow me to turn my camera into a barcode scanner, which could then use this video to decode the codes in python. I installed the scanner along with 'pywin32' which was supposedly the library I needed to use, but I couldn't get the two to communicate as my computer kept saying that pywin32 has not been installed (although it had).
Then, I moved onto using zbar/ pyzbar. I downloaded all of the modules that were recommended (I followed the instructions set out on here) but these each came with several more error messages. It was all to do with various libraries and modules not being installed - I've tried downloading PIL/pillow, pyqrcode and a number of other things that are supposed to work, but for some reason, don't.
I don't feel that I can provide any evidence of code as I haven't got any code to fix for this particular issue -- I am simply looking for anyone who may know of a way to transform an ordinary webcam into a barcode/qr scanner using python.
Assuming none of the libraries I need are installed on my computer at the moment, could someone please explain to me exactly which libraries I will need to download, where I can find them, and how I could use them to make Python communicate with my webcam?
This is for my A Level Coursework and the scanner is absolutely fundamental to the program; if anyone can provide me with a useful, understandable solution then I would be really grateful. I apologise if this question is still a little too broad - I am a complete novice to coding and after searching endlessly for hours to find a solution, I feel that this is my final resort.
I did a project on zbar a couple of years ago, and it took 6 months to get zbar working :)
Here's how I setup zbar:
Zbar python module does require zbar.exe. Go to http://zbar.sourceforge.net/download.html and click either ZBar 0.10 Windows installer if you have windows, or Linux builds. Run zbar-0.10-setup.exe and follow installation instructions.
The Zbar python module is available on pypi. That means a simple pip install zbar will install it.
To get .py examples of Zbar running, first download the source code for zbar (top link on http://zbar.sourceforge.net/download.html ), unzip the tar.bz2 file (use 7zip). Inside the unzipped folder there should be /examples. Inside the folder, you will find several examples (proccessor.py is a good one), which can be run just as you would normally run a python program.

How do I install pygame without installing extra modules before?

I recently started learning to use Python and built in modules such as Tkinter. However in order to finish the programme I am making, I need to use pygame to open a music file in the programme. I have what I am sure is the correct pygame files (see image) but I have no clue how to actually add it to be able to use when coding in Python. (Get the error that the module cannot be found).
If there is an intergrated Python module that will allow me to open music files then I would be interested in knowing if that is an easier method.
Pygame files:
In a web browser go to http://www.pygame.org/download.shtml locate the package that matches your environment and follow the instructions, (either download and run or type the command).

What is the best way to manage multiplatform video stream using Python?

I have this question in my head for over a year now. And I guess you guys may have the answer.
In some Python GUI app, I need to display a video stream.
I need to record some part of this stream to reread it later.
Moreover, I need to make this python application multi platform (OSX, GNU, Windows)
I am open to many solutions :
Connect the camera to a stream and read the stream with the python app. (RTP + VLC could do the trick)
Use Phonon to read the camera
Create an abstract class to define differents reader and use Quicktime, Win32 or GStreamer in function of the OS.
What is your experience, what would you use to do that ?
I've looked into this periodically as well, and it seems the complexity of the underlying task is just too high to have a simple shortcut abstraction library for your topic question. I would suggest using pyopencv for the specific task you articulate, however. It has a class for webcam input/capture which works across platforms and has a reasonable user-base, in python, posting examples. The latest is 2.3.1 and quite recent. You can get a windows version of it, compiled for you, on the unbelievably helpful site (not mine, just saying):
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Since you ask for experience with a few libraries, I'd say: gstreamer worked for me on linux but was a huge pain to setup on windows and didn't work for me. This was quite some time ago and perhaps it's working better now. vlc.py is a simple library to test and see whether vlc would work for you. It doesn't work on 64 bit windows platforms at the moment; not sure why, but it seems many have reported similar errors, so it depends on how much cross-platform support you need.
Unfortunately, this is not easy to do. I've written most of a program that does video recording/playback on the 3 major desktop OS's. The state of video playback/recording in a "out-of-the-box" way is still unsolved for cross-platform, other than HTML embedding. This has a lot to do with the fact that:
Codecs are proprietary
OS's don't support common codecs
ffmpeg and similar projects have licenses that require you to release your source code if you include them in certain ways
A lot of the video playback players that exist are each rewritten by hand to handle each frame, buffering, streaming, audio sync'ing, and the like.
So you can go with HTML, or you can suffer through the cross-platform issues with the following coding libaries:
Python mplayer
Python vlc
Python opencv
Python pyaudio
Python pyside/pyqt phonon or qtmultimedia
Once you get it working on one development machine, expect it to break when it comes to installation on the end-user machine (distribute via: pyinstaller / appdmg / apt / chocolatey / Inno Setup )
On OSX, brew still has a lot of issues with this, but macports works better (I still had to do a lot of patching)
Linux is by far the easiest.
Windows is in-between the to as far as difficulty
I'd be eager to hear how iOS / Android / Windows RT / Kindle are
The problem is not unique, as even Netflix has yet to have a cross-platform video app: https://www.quora.com/Is-Netflix-building-an-app-for-the-Mac-App-Store?share=1

Categories

Resources