Breaking a video into frames with python
-
23-06-2021 - |
Вопрос
I am trying to write a program that deletes frames of a video that don't have a particular symbol in them. My general plan:
- Split the audio from the video
- Split the video into frames
- Run the frames through a subroutine that looks for the symbol, by checking the pixels where it should be for being the correct color, and logging the ones that don't.
- Delete those frames and corresponding audio seconds
- Splices it all back together.
I need some help finding libraries that can do this. I was wondering if wxpython
could do the detection of pixel color. I have no idea what library could split audio and video and which could edit audio. I know ffmpeg could split the video into frames but after two days of work I still have not been able to install it for python 2.7, so I either need a way to install it or a different library to do it. Any ideas?
Решение
wxPython is mainly for desktop GUI development. I would look at pyAudio for the audio bit or possibly one of the following:
- http://xoomer.virgilio.it/sam_psy/psych/sound_proc/sound_proc_python.html
- https://github.com/Rudd-O/python-audioprocessing/
- http://code.google.com/p/pyo/
You might be able to use one of the Mplayer wrappers for the video:
Or check out that OpenCV project that Sergey mentioned: