write output of find_rect to a file?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

write output of find_rect to a file?

Michael Koch
Hello,

I want to track an object and need the x,y coordinates of this object
for each frame.
Is it possible to write the output of the find_rect filter to a file?

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: write output of find_rect to a file?

Moritz Barsnick
Hi Michael,

On Mon, Jun 29, 2020 at 13:24:30 +0200, Michael Koch wrote:
> Hello,
>
> I want to track an object and need the x,y coordinates of this object
> for each frame.
> Is it possible to write the output of the find_rect filter to a file?

I don't have any good command line for find_rect handy, but it should
work with something like this (untested, of course):

$ ffprobe -f lavfi -i movie=input.mp4,find_rect=options -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.w,lavfi.rect.h,lavfi.rect.x,lavfi.rect.y -of csv

In other words, let ffprobe show you each frame's metadata.

You can redirect this output, or have the logging write a report file.

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: write output of find_rect to a file?

Michael Koch
Hi Moritz,

>
> I don't have any good command line for find_rect handy, but it should
> work with something like this (untested, of course):
>
> $ ffprobe -f lavfi -i movie=input.mp4,find_rect=options -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.w,lavfi.rect.h,lavfi.rect.x,lavfi.rect.y -of csv
>
> In other words, let ffprobe show you each frame's metadata.
>
> You can redirect this output, or have the logging write a report file.

Very good, that's exactly what I need. I did already make some tests
with -show_entries before I posted this question. But I didn't know the
names of the variables "lavfi.rect.x" and "lavfi.rect.y". Are these
variables documented somewhere? Is there also a variable for the quality
of the find_rect result, I mean the number that's compared against the
detection threshold?

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: write output of find_rect to a file?

Moritz Barsnick
On Mon, Jun 29, 2020 at 17:35:50 +0200, Michael Koch wrote:
> Very good, that's exactly what I need. I did already make some tests
> with -show_entries before I posted this question. But I didn't know the
> names of the variables "lavfi.rect.x" and "lavfi.rect.y". Are these
> variables documented somewhere?

Good point. It's not in the documentation, I got this from the source.
Apparently, the filter was designed mainly for use with another filter.

> Is there also a variable for the quality of the find_rect result, I
> mean the number that's compared against the detection threshold?

No, that value is not exposed.

(You could try modifying the source yourself, or, if you make a very
good point about it, make a feature request.)

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: write output of find_rect to a file?

Michael Koch
Am 29.06.2020 um 22:28 schrieb Moritz Barsnick:

> On Mon, Jun 29, 2020 at 17:35:50 +0200, Michael Koch wrote:
>> Very good, that's exactly what I need. I did already make some tests
>> with -show_entries before I posted this question. But I didn't know the
>> names of the variables "lavfi.rect.x" and "lavfi.rect.y". Are these
>> variables documented somewhere?
> Good point. It's not in the documentation, I got this from the source.
> Apparently, the filter was designed mainly for use with another filter.
>
>> Is there also a variable for the quality of the find_rect result, I
>> mean the number that's compared against the detection threshold?
> No, that value is not exposed.
>
> (You could try modifying the source yourself, or, if you make a very
> good point about it, make a feature request.)

Unfortunately I can't compile ffmpeg myself on my Windows system.
Ticket 8766   (I've also added some other things that are missing in the
documentation)

It's important to also have the "best_score" value to the log file,
because it contains valuable information about how reliable the x,y
coordinates are.

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: write output of find_rect to a file?

Valentin Schweitzer
> Unfortunately I can't compile ffmpeg myself on my Windows system.

If you are comfortable with compiling FFmpeg in general but lack
the tools on Windows, you could try the media-autobuild suite.
https://github.com/m-ab-s/media-autobuild_suite

If you need to recompile FFmpeg you can keep your ffmpeg_options.txt,
mpv_options.txt and media-autobuild_suite.ini files to reuse your
settings.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: write output of find_rect to a file?

Michael Koch
In reply to this post by Moritz Barsnick
Hi Moritz,

>
>> Hello,
>>
>> I want to track an object and need the x,y coordinates of this object
>> for each frame.
>> Is it possible to write the output of the find_rect filter to a file?
> I don't have any good command line for find_rect handy, but it should
> work with something like this (untested, of course):
>
> $ ffprobe -f lavfi -i movie=input.mp4,find_rect=options -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.w,lavfi.rect.h,lavfi.rect.x,lavfi.rect.y -of csv

The above command works fine, but is it possible to print the number of
the frame instead of the timestamp?
I did search the documentation for a list of variables, but didn't find
any. Also "pkt_pts_time" seems to be undocumented.

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".