[FFmpeg-user] write output of find_rect to a file?

Hans Carlson forbyta at gmx.com
Sun Jul 12 00:52:43 EEST 2020


On Sat, 11 Jul 2020, Michael Koch wrote:

>> $ 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 might be wrong, but I believe you need to infer the frame number based 
on where it appears in the output.  Given your example, with "frame" 
section and "csv" output, the 1st line is the 1st frame, the 2nd line is 
the 2nd frame, etc.

If you're processing this via a script of some kind, you might consider 
the JSON output format.  With JSON, the output is an ARRAY of OBJECTS 
where the frame number would be based on the ARRAY index.  Converting the 
JSON structure to various programming languages is usually quite simple. 
In perl for instance, it's one line of code and you now have a perl LIST 
of HASHES.

> I did search the documentation for a list of variables, but didn't find 
> any. Also "pkt_pts_time" seems to be undocumented.

I've never found any documentation for this either.  The closest is the 
output of "ffprobe -sections", but that only lists the possible 
"sections", not the "entries" within each section.  It would be nice if 
there was a "ffprobe -entries [section]" option that listed all entries 
(optionally for a specific section), along with a brief description of 
each entry. I have no idea if it would be possible for that to be 
auto-generated based on information already available in the existing 
code.


More information about the ffmpeg-user mailing list