Use ffmpeg to retag video on capture?

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
ibrewster
Posts: 31
Joined: Sat Aug 31, 2019 4:18 pm

Use ffmpeg to retag video on capture?

Post 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.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Use ffmpeg to retag video on capture?

Post by dougmccrary »

Maybe it could go in Storage->Optional Encoder Parameters?
ibrewster
Posts: 31
Joined: Sat Aug 31, 2019 4:18 pm

Re: Use ffmpeg to retag video on capture?

Post 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...
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Use ffmpeg to retag video on capture?

Post by Magic919 »

As you can see in the other thread, the filter will mark the events as done and not do them again.
-
ibrewster
Posts: 31
Joined: Sat Aug 31, 2019 4:18 pm

Re: Use ffmpeg to retag video on capture?

Post 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
ibrewster
Posts: 31
Joined: Sat Aug 31, 2019 4:18 pm

Re: Use ffmpeg to retag video on capture?

Post 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.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Use ffmpeg to retag video on capture?

Post by dougmccrary »

You could test for end time, for starters.
Post Reply