ffpyplayer | A cython implementation of an ffmpeg based player | Media Player library
kandi X-RAY | ffpyplayer Summary
kandi X-RAY | ffpyplayer Summary
A cython implementation of an ffmpeg based player.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Run pkg - config
- Get the output of a command
- Get wheel data
ffpyplayer Key Features
ffpyplayer Examples and Code Snippets
Community Discussions
Trending Discussions on ffpyplayer
QUESTION
In my project I like to play a video with cv2 and sound with ffpyplayer.
The code is shown below works except this last line:
...ANSWER
Answered 2021-May-06 at 03:29You forgot to close MediaPlayer
.
According to document:
close_player(self)
Closes the player and all resources.
I've used pathlib.Path.unlink()
to remove file, but should work same with os.remove
. Check out pathlib.Path
as this provides convenient and powerful high-level interfaces.
QUESTION
I am trying to play a sound using Kivy. The sound plays perfectly and everything works perfectly on my laptop, but when I load the APK on my Android device, the sound does not play.
I have manually allowed "storage permissions" on my android device, and in my buildozer.spec file I have included permissions to write and read external storage. I created a test file to try and debug to see what was going wrong but to no avail. I will share the details of this test file below.
To start, here is the .py file:
...ANSWER
Answered 2020-Sep-29 at 07:23There may be quite a few reasons for this. First of all, I don't see anything wrong with the code so there must be a problem with the target system. I suggest that you check whether any access (to speaker) is blocked by antivirus software.......This has happened repeatedly with me in the past, checking the app permissions is probably the only solution.
QUESTION
I'm developing a GUI with a video player. I'm using the Video
widget, but on play I can see that my video is not/badly deinterlaced, and that some lines appears on the frame. My video is a high res video, and I have no problem playing it on my system player, only in Kivy.
I have looked in the documentation of both kivy and ffpyplayer, and nothing seems to mention deinterlacing
My code so far is simply
...ANSWER
Answered 2020-Jun-19 at 13:28So I wasn't able to pass the needed parameters to the ffmpeg player used by Kivy, so instead I converted the videos with ffmpeg before passing them to kivy... Not a perfect solution, but hey, it works !
QUESTION
how can i control frames in opencv? here you insert the url of a video in the internet/local and this streams it to you.but voice and video are not Coordinated.video is faster than voice :/
...ANSWER
Answered 2020-May-31 at 21:17It seems you can't control when to play audio because it uses SDL
to play it in separated thread but get_frame()
gives tuple (frame, val)
and frame
is (image, time_when_to_display_image)
and you should use this time_when_to_display_image
to control when to display image.
And all this code doesn't need cv2.VideoCapture()
to get frame.
I use cv2
only to display it but you can use any GUI to create window to display it.
I use current_time
to get next frame without using time.sleep()
because video wasn't smooth.
BTW: You can use player.set_size(720, 480)
to resize frame.
QUESTION
I'm stuck at this problem. I have tried to install all prerequisites that i found in internet. I'm using Windows 10 and CMDer. This error also occured in any of programs of Kivy that i run. Here's the error details.
...ANSWER
Answered 2020-Apr-05 at 13:04The error fixed by configuring C:\Users\\.kivy\config.ini
:
QUESTION
[ERROR ] [Image ] Error loading texture somevideo.mpg
- The error is caused and I am not able to use any of the attributes except
play()
ANSWER
Answered 2020-Mar-01 at 04:13According to the documentation, partial
“freezes” some portion of a function’s arguments
So that your print
function in the partial
is just printing the value of self.video1.loaded
as it was when the partial
function was called.
Here is a version of your posted code that prints the current version of loaded
every half second:
QUESTION
I am looking for a way to stream a video file to a QPixmap in PyQt using FfPyPlayer. The docs give an example to stream Image objects out of the player, however I am not sure how to convert this Image to a QPixmap. I do see that there is a way to convert it to a bytearray, and QPixmap does have a QPixmap.loadFromData()
function but I was not able to tie these two together successfully.
Here's the example from the docs:
...ANSWER
Answered 2019-Oct-29 at 09:51The problem is that QPixmap.loadFromData() expects actual image "files", while what ffpyplayer (as in ffmpeg) provides are actually raw images, which is the actual representation (rasterization) of the images as they will eventually appear.
For various reasons, QPixmap cannot directly deal with raw data, as it's intended for showing images on screen, while QImages can, as they also are hardware independent.
QImage can load raw image data (meaning that, for example, if the image is compressed, the raw data is the actual representation of an uncompressed image), but it needs to know something about the "image format" and, obviously the image width/height.
When you use QPixmap.loadFromData() what actually happens is that Qt "guesses" the image file format, decompresses it (if necessary) to get data about "each pixel", gets both graphical size and pixel format, then it builds an internal QImage with all that information and finally returns it as QPixmap.
In this case, you already have all that data provided by ffpyplayer, so you just skip the first "decoding" passage entirely and create a QImage, and then get a QPixmap from it.
QUESTION
So I'm trying to do something really janky. I'm using opencv and ffpyplayer to try to make an embedded video player on a Tk window.
It does work but i'm having issue syncing the audio and the video, i can get close to a decent result but after a bit it goes out of sync again.
whole code:
...ANSWER
Answered 2019-Mar-26 at 21:43So ok I found a wayyyy better solution to this. I tried using again the vlc module, I had trouble using it before but after I got through it I actually found a way to print the output from vlc to a frame with a canvas.
It's actually stupidly simple, I got rid of cv2 and ffpyplayer and used a simple VLC player
Note that in my case Screen is a Frame, so to make this work just use 'Frame'.winfo_id() to get the id of the tk frame where to output the video, the audio works as well. Then just use player .set_hwnd(ID) to set it to the vlc player.
QUESTION
I am using pypy3 to compile python project which is related to video streaming. I wanted to speed up the video (want to increase average frames per second).
To run the project, I need to install opencv-python, scipy, ffpyplayer, and pyglet.
I tried installing opencv using just pip, however, it did not work (I tried almost every possibilities).
After research, I figured out that I have to use pip inside pypy folder (../pypy3/bin/pip). However, it gives same error that "Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python". Also scipy "error: library dfftpack has Fortran sources but no Fortran compiler found".
Have anyone ever used those packages with pypy? I have tried in virtualenv and on my computer too.
Please help me with this since I am working on this for several weeks already. (I have tried on OSX and windows)
...ANSWER
Answered 2019-Feb-26 at 21:29OpenCV on PyPI (where pip downloads from) provides only binary wheels that are compiled for cpython, not pypy. Unfortunately there is no source for binary wheels for PyPy at this time. You dont' really have any good options at this point in time (Feb 2019):
- Try compiling from source with CMake, the OpenCV source code, and PyPy, but I wouldn't expect it to work out of the box.
- Use this CFFI alternative which has not been updated in quite a while
- Use cpython to interact with OpenCV and somehow pass the result to PyPy via something like pymetabiosis but that project seems unsupported
Have you profiled your code and determined that python is slowing you down? From the packages you named, I would imagine the problem is that you are just trying to do too much in each frame, or that you are not using double buffering to read a frame while processing the previous one.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ffpyplayer
You can use ffpyplayer like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page