FFMpeg motion detection offers a way to create videos that are smaller and shorter becuase it only captures changed scenes. This post discussed the topic, https://superuser.com/questions/984841/ffmpeg-remove-parts-without-motion. Here is the command I used based off of this conversation.
ffmpeg -i "http://viewr1:email@example.com/mjpeg/stream.cgi?chn=0" -vf "select=gt(scene\,0.004),setpts=N/(25*TB)" IPCam4_Motion.mp4
The one thing I noticed was the timestamp in the video is being detected as a scene change, this introduces a higher noise floor. I found that my lowest scene value to be .004. This site, http://www.bogotobogo.com/FFMpeg/ffmpeg_thumbnails_select_scene_iframe.php provided an explination of how the scene directive is used. In my example above, the .004 represents a .4 percent change. My cameras are set to 1280×720, this is 921600 pixels. This means motion is detected if 3686, which is .4 percent of 921600, or more pixels change values between frames.
The resulting video from the example above is hard to view, so I run this command to split the video into a series of images.
ffmpeg -i "IPCam4_Motion.mp4" -vf fps=25 "IPCam4_Motion%d.png"
Using FFMpeg to isolate active motion in video is a big time and space saver. This following video covers a 24 hour period. The video is 132 MB in size and is 5:22 minutes long. Again, most of the video is not needed. I ran this command with a scene change value of 1 percent to extract the video with motion.
ffmpeg -i "IPCam4_20180805.mp4" -vf "select=gt(scene\,0.01),setpts=N/(25*TB)" IPCam4_20180805_Motion.mp4
The resulting video in comparison is 15 MB in size and runs for 27 seconds. When dealing with dozens of capture files, extracting motion only scenes is a huge time saver.