I am trying to find a peice of software or a process to automate clipping a video.

I have a device that records a 3 hour video of meeting that take place on a regular basis. The meeting do not ofthen last 3 hour so the last 1 or 2 hour is ussaly nothing but a black screen. I want to be able to automatically, after the video is captured as a mpeg, clip the the last part of the video that is nothing but black. I have tried playing around with the Avidemux 2.4 software and the "next back frame" button goes directly to where I want to clip the video but I have found no way of automating this with the script feature of the software. I have looked through this forum and the internet with no succes. Any help would be appriciated

Thanks