Re: [FFmpeg-user] write output of find_rect to a file?
On Sat, Jul 11, 2020 at 14:52:43 -0700, Hans Carlson wrote: > > 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. I agree with this. ffprobe doesn't do the counting for you. (I'm not saying I believe or don't believe it could or should.) > > 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. The XML output format has a proper XML schema file ffprobe.xsd, which describes the fields and the hierarchy. It's installed under $prefix/share/ffmpeg/ffprobe.xsd, and in the ffmpeg source tree, it's under doc/ffprobe.xsd. The JSON output should align with that (but formatted as JSON), I don't know about the CSV output. Regarding what pkt_pts_time represents or how it is calculated, you would have to look it up in the source, if it isn't documented anywhere. (Help in improving the documentation is always welcome, either as a patch, or as a modification of the wiki.) Cheers, Moritz ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
On 07/11/2020 05:52 PM, Hans Carlson wrote: On Sat, 11 Jul 2020, Michael Koch wrote: -snip- 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. I'm very interested in pkt_pts_time, too (and also pkt_duration_time). I assume both are computed based on SCR (or PTS or DTS) but the formula I have (below) doesn't produce sensible frame durations. Note that my only source is for MPEG. For example: First 10 bytes of a pack header: [0] pack_id 00 00 01 BA 44 00 05 24 94 D1 [4] marker 01-- [4.2] SCR --00 0-00 0-01 0010 0100 1001 0--- [4.5] marker -1-- [6.5] marker -1-- [8.5] marker -1-- [8.6] SCR_ext --00 1011 000- [9.7] marker ---1 formula: ((SCR)(300)+SCR_ext)/2700 seconds ((146)(300)+85)/2700 seconds The above is from an MPEG program stream, and match the numbers in the nav pack, but the frame durations are a little more than 3x too short, producing FPSs that are a little more than 3x too high. Compounding this is that nav packs and PES headers (which contain the numbers) only exist (in MPEG) for GOPs -- though ffprobe reports them for every frame (but how ffprobe does it is undocumented). Mark. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
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. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
> 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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] write output of find_rect to a file?
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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] write output of find_rect to a file?
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 ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".