Results 1 to 7 of 7

Thread: How do I find movement in a video file

  1. #1
    Join Date
    Dec 2004
    Location
    Manchester
    Beans
    2,082
    Distro
    Ubuntu Studio 13.04 Raring Ringtail

    How do I find movement in a video file

    I am experimenting with a DIY CCTV system using an old helmet cam. I can leave it running, and then later collect it and download the file to a computer. However hours of footage of the back yard are not exciting viewing, so I'd like something to scan through the files, and let me know where anything eventful happened.

    I have found lots of information about Motion, which looks great, but seems to only work with a live video stream. Does anyone know of an equivalent that works with a folder of existing video files?

  2. #2
    Join Date
    Jul 2013
    Beans
    190

    Re: How do I find movement in a video file

    unfortunately i don't know a application. But, if you have java programming experience you can try to do
    it on your own. I would give ImageJ a try, import my avi file and convert it to a thing called ImageStack. I would
    make two from the same video an try building differences and using correlation etc. There are also some
    plugings for biological use, all code is open an should bring you further if you try.
    For example http://www.uhnresearch.ca/facilities/wcif/.

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: How do I find movement in a video file

    This looks promising...
    http://cwee.ucdavis.edu/projects/CBVision

    Unfortunately they don't provide pre-built binaries but there are instructions for compiling it yourself in the downloadable pdf manual.
    Cheesemill

  4. #4
    Join Date
    Dec 2004
    Location
    Manchester
    Beans
    2,082
    Distro
    Ubuntu Studio 13.04 Raring Ringtail

    Re: How do I find movement in a video file

    thanks for comments. I found out a bit of info with more searching
    to use motion with existing files you can make a fake webcam device using video4linux loopback http://www.lavrsen.dk/foswiki/bin/vi...LoopbackDevice

    I also found that you can split the video into frames with ffmpeg
    Code:
    ffmpeg -i inputvideo.h264 -r 1 -f image2 -s 240x135  frames_%6d.png
    (grabs 1 frame per second)
    then use matplotlib to read each image, subtract the last one, and sum the pixel differences.

  5. #5
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,517
    Distro
    Ubuntu

    Re: How do I find movement in a video file

    am sure you have a reson but whats wrong with using motion as the cctv?

  6. #6
    Join Date
    Feb 2013
    Beans
    1

    Re: How do I find movement in a video file

    If you can tweak the code, I'm pretty sure motion detection and file I/O are samples that come with http://opencv.org/

  7. #7
    Join Date
    Feb 2014
    Beans
    1

    Re: How do I find movement in a video file

    It can be done by installing VirtualDub and AVISynth 2.5 with the following AVISynth plugins: RT_Stats v1.20, FrameSel v1.03, GScript, and Grunt. Note that "FrameSel" is NOT the same as the "FrameSelect" plugin.

    Edit SecurityCamExtractMotion.AVS that comes with RT_Stats and edit the video file it refers to as well as any parameters you want to tweak. I used it with TH set to 12.5, commented "ShowMetrics(..." and uncommented "AutoGetFrames(...". Open SecurityCamExtractMotion.AVS in VirtualDub and after a long delay (about 30 minutes for 5 hours of video), you'll see a video containing only frames where motion was detected.

    I've only gotten it to work with AVI files and I was running it under Windows but supposedly it works in Ubuntu as well. I tried to use it with an MTS/M2TS file and it acted like it worked but did not show the correct frames. So I had to use another video processor to render the MTS file as AVI.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •