Skip to content

With a very simple trick you can extract the motion of a video. Uses python and OpenCV

Notifications You must be signed in to change notification settings

jacobpclouse/Motion-Extraction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motion-Extraction

With a very simple trick you can extract the motion of a video. Uses python3 and OpenCV to compare current frame of the video to a previous frame to see where changes have been made in the frames (and any changes indicate motion).

Inspired by this video by Posy

NOTE: Recommend to only test on shorter videos (ie: not greater than 5 minutes) -- current program converts in REAL TIME

  • IE: 5 hour video = at least 5 hours to convert

How to run this program:

    1. Make sure you have python 3 download, installed and on path
    1. Use the activateVirEnv.txt to create a virtual environment
    1. Make sure you pip install -r requirements.txt to install all the needed packages
    1. Move your target MP4 video into the same directory as the motion_Extraction.py file
    1. Run the program with the command python motion_Extraction.py yourVideo.mp4 - you NEED to provide the video title as an argument
    1. If you want to see the extraction overlay, type yes. If you do not, type no
    1. If you just want the frame compared to the previous one, then type PREVIOUS. If you want a larger delay, type CUSTOM (you will the be prompted to enter your custom frame delay)
    1. Your output will be created in a subfolder within the OUTPUTS folder, enjoy!

Ideas:

  • [DONE] maybe combine the two while loops?
  • [DONE] invert then immediatly overlay?
  • [DONE] check pervious frame in one video then x frames back in another video (shows slower movement)
  • cut videos larger than like 3 minutes into chunks of 1 minutes, store in folder [check multiprocessing attempt folder]
  • then use threading to individually loop through and invert videos
  • then you can paste it together at the end

Resources used:

About

With a very simple trick you can extract the motion of a video. Uses python and OpenCV

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages