Re: Script to convert all events to daily videos
Posted: Sun Jul 16, 2017 1:42 pm
Give this a try, it should do what you want. The "--prefix" CLI arg has been removed, and replaced by the more general "--outfmt" argument. There is also a new "--timefmt" arg.
With the old --prefix arg, you set only the first part of the filename, and the rest was automatically generated for you. Now you can explicitly set the output filename format, including any leading directories and filename extension. The --outfmt argument looks for two special tokens, {START_TIME} and {END_TIME}. In the actual filename, those tokens will be replaced by the start and end times of the video that is created. You can change the format of how these timestamps are created with the --timefmt option. What you can do with --timefmt is defined by Python's time.strftime function. (This should be familiar to anyone who's done any POSIX programming or has used the shell's date command.)
So to get the format that was requested
XXXX.from.May.20.2017-Time.10.27.00-to. May.21.2017-Time.10.27.00
You'd do something like this:
The defaults should be the same, so if you've never previously used the --prefix arg, then this updated version should behave no differently. If you simply want to retain the old-style "--prefix" behavior, then just append "_{START_TIME}_{END_TIME}.mkv" to the string you use for --prefix. For example:
becomes
.
Other than the creation of the output filename and the CLI args, the core functionality has not changed. So if you don't need these new generalized output filename config options, there is no need to upgrade.
With the old --prefix arg, you set only the first part of the filename, and the rest was automatically generated for you. Now you can explicitly set the output filename format, including any leading directories and filename extension. The --outfmt argument looks for two special tokens, {START_TIME} and {END_TIME}. In the actual filename, those tokens will be replaced by the start and end times of the video that is created. You can change the format of how these timestamps are created with the --timefmt option. What you can do with --timefmt is defined by Python's time.strftime function. (This should be familiar to anyone who's done any POSIX programming or has used the shell's date command.)
So to get the format that was requested
XXXX.from.May.20.2017-Time.10.27.00-to. May.21.2017-Time.10.27.00
You'd do something like this:
Code: Select all
./zm_mkvid.py --event-dir=/var/lib/zoneminder/events/Front_Porch_Camera/17/07/12/ --timefmt="%b.%d.%Y-Time.%H.%M.%S" --outfmt='XXXX.from.{START_TIME}-to.{END_TIME}.mkv'
Code: Select all
--prefix="My_Camera"
Code: Select all
--outfmt="My_Camera_{START_TIME}_{END_TIME}.mkv"
Other than the creation of the output filename and the CLI args, the core functionality has not changed. So if you don't need these new generalized output filename config options, there is no need to upgrade.