How to use video filters (cropdetect) with ffprobe

How to use video filters (cropdetect) with ffprobe

Checking the ffprobe docs apparently there is an option to use cropdetect with it. I am already aware that I could do this with ffmpeg like:

ffmpeg -ss 900 -i "foo.mkv" -vframes 100 -vf cropdetect -f null - 2>&1

but I'd like to do it with ffprobe simply because I'm trying to use this in a bash script, I have a bunch of ifs and elses depending on quality and format of the input before composing the final ffmpeg command and I want to leverage the json output from ffprobe

Regardless of what ever I tried I cannot use any of the video filters listed in documentation, and there are no examples listed there either. Does anyone know how to run a similar cropdetect filter with ffprobe?

I had some luck with:

ffprobe -f lavfi -i "movie=foo.mkv,cropdetect" -show_entries frame=pkt_pts_time:frame_tags -print_format json

But this seemingly print cropdetect for every frame in the video.

答案1

set packet_tags.

ffprobe -f lavfi -i movie=foo.mkv,cropdetect -show_entries packet_tags=lavfi.cropdetect.x1,lavfi.cropdetect.x2,lavfi.cropdetect.y1,lavfi.cropdetect.y2,lavfi.cropdetect.w,lavfi.cropdetect.h,lavfi.cropdetect.x,lavfi.cropdetect.y -print_format json

相关内容