-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make opencv optional #39
Comments
However, I didn't get a good look at the part of the code that actually requires opencv, so if there is some way for me to use opencv on the pyvidplayer2 video efficiently without the pyvidplayer2 module using opencv, that's fine too (Maybe add an example?). |
Cv2 will indeed be an optional package. It seems like ffmpeg can do almost everything that cv2 can, except ffmpeg can also accept videos in memory. My biggest motivation for removing cv2 is because that would reduce the dependencies down to just pygame and ffmpeg, which would be really simple and lightweight. Also, what kind of video operations were you thinking of doing with cv2? |
Well I want to use pyvidplayer2 for some simple video editing (I know all the supposed drawbacks of not using a video editing framework like MLT. However, I am planning a unique rotoscoping program, probably not an NLE. A rationale is at the readme here: https://github.com/Hierosoft/rotocanvas). I'm likely to want to want to have:
|
What kind of interaction would you need with the video and cv2 for this? Reading video frames? |
The examples I gave are python_opencv examples, but only used opencv briefly. When I save the video, I will merely use ffmpeg. pyvidplayer2 won't be involved in that step I don't think. Therefore, I don't know enough yet. I don't know if I will need to use opencv with pyvidplayer2. I will likely just use opencv to analyze the source video apart from the GUI, save the metadata, then overlay my own widgets based on the metadata (such as boxes the user can move if the object tracking is wrong, but also to attach a sprite, blur effect, etc. to the tracked target). The reason pyvidplayer2 is useful regardless of that is:
My old program rotocanvas-cs very slow as it was using the ffmpeg command & saving each preview to a file (I wasn't good at using stdout back then, but should have probably used a library anyway): https://github.com/Poikilos/rotocanvas-cs. It used the code from another repo for the timecode construction function (can be used in |
Interesting. Have you browsed the documentation for things that may help you? For example I just added (hasn't been pushed to pypi yet but is available in the repo) a seek_frame function, which should quite accurately seek to a frame. In addition, frame_data and frame_surf both contain the video's current rendered frame as a numpy array and pygame surface, respectively. Also, check out the built-in post processing (which is what I was planning to have cv2 be an optional package for). However, yes, there isn't an audio post processing feature yet. How pyvidplayer2 uses ffmpeg is inaccessible to users. |
|
cv2 (formerly cv) could be removed:
-#38 (comment)
but maybe make it optional, since it is handy for advanced operations on the video.
Such as:
In the module:
...then split off a different requirements.txt called requirements-opencv.txt and just add opencv_python to that.
And
pip install pyvidplayer2[opencv]
can be defined if you do:The text was updated successfully, but these errors were encountered: