Page 1 of 1

Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 12:29 am
by ibrewster
I have a camera set up in zone minder that streams video in h.265 format. The camera is set up with a source type of "Ffmpeg" and a rtsp:// url. This all works as expected, I can view the camera live and it creates events, but when I download the event video (on my Mac) I can't play it in QuickTime Player. VLC plays the video fine, for what that is worth.

I have discovered that if I run the following command on the video, QuickTime Player can now play it without issue:

Code: Select all

ffmpeg -i 1439962-video.mp4 -c copy -tag:v hvc1 output.mp4
So my question is this: if zone minder is really using Ffmpeg to capture the stream, as the source type of "Ffmpeg" would seem to indicate, is there a way I can set it to automatically use the "-c copy -tag:v hvc1" options when capturing/saving the stream?

Note that this is for a single camera, the other cameras I have set up do not use h.265.

Re: Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 7:42 am
by dougmccrary
Maybe it could go in Storage->Optional Encoder Parameters?

Re: Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 6:07 pm
by ibrewster
Good thought, but doesn't seem to work. Apparently that field needs things in key=value format, not command line args for one thing. I tried using tag:v=hvc1, but that didn't work, so it seems it's not just a format thing.

That said, after some more digging, I found this thread: viewtopic.php?t=31596, which suggested using filters, so I guess I'll give that a try. Though looking at the filters setup screen, I'm a bit confused as to how to make them run on new events - clicking the "list matches" button returns a list of old events, and I'd hate to have it run on every event every time it runs...

Re: Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 6:27 pm
by Magic919
As you can see in the other thread, the filter will mark the events as done and not do them again.

Re: Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 6:34 pm
by ibrewster
Nope, I can see in the other thread that "the event will be marked that it has ben processed". That neither says or implies that it won't do it again - especially when the "list matches" button continually returns the same list, implying that it WILL do them again.

I'll take your word for it and see what happens though! :D

Re: Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 7:01 pm
by ibrewster
Ok, so the filter approach does seem to be working, with the caveat that all the videos seem to be cut off after a couple of minutes. Is there any chance that the filter runs before the event is complete?

EDIT: Just confirmed this is the case. Event ID 1629259 is a currently recording event, but my script already got and processed it. Guess the approach needs more work.

Re: Use ffmpeg to retag video on capture?

Posted: Wed Feb 08, 2023 9:43 pm
by dougmccrary
You could test for end time, for starters.