2024-12-04, 08:55 PM
(This post was last modified: 2024-12-04, 09:01 PM by TheDreadPirate. Edited 1 time in total.)
Circling back to the cropdetect. Two things
1) I got accelerated decoding working with crop detect.
2) I've recently re-encountered an edge case that I've encountered a few times in the past.
The accelerated command looks like this. It doesn't make crop detection happen any faster, in fact it slows things down by about 50%, but it massively lowers the CPU usage.
It's probably the hwdownload slowing things down. But, as you mentioned, I couldn't find a QSV filter to do everything in hardware.
You will have to do some detection first with ffprobe. The pixel format filter needs to match the video. "p010le" for 10-bit video and "nv12" for 8-bit video are the two that QSV supports.
Regarding #2. If, at the start of the cropdetect at the -ss timestamp, your video has a different aspect ratio, either for stylistic effect or because it is a small logo on an all black background, the cropdetect will get it wrong if the windows isn't large enough. Your -t 5:00 helped me with that. I had been using "-ss 120 -to 180". MOST videos will have go back to 16:9 or 21:9 by the end of that 5 minute window.
But I have a new movie where there is an extended intro/prelude with a different resolution and aspect ratio than the rest of the movie that lasts the entirety of the 5 minute cropdetect window. Extending how long crop detect goes on for seems like a waste.
I'm debating how to handle this edge case. Two crop detects at different time stamps? Pick the one with the larger canvas? Each crop detect at a dynamic start time depending on the length of the video?
1) I got accelerated decoding working with crop detect.
2) I've recently re-encountered an edge case that I've encountered a few times in the past.
The accelerated command looks like this. It doesn't make crop detection happen any faster, in fact it slows things down by about 50%, but it massively lowers the CPU usage.
Code:
ffmpeg -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -hwaccel qsv -hwaccel_output_format qsv -ss 120 -t 5:00 -i Bookworm.mkv -vf hwdownload,format=p010le,fps=1/2,cropdetect=mode=black:reset=60 -f null - 2>&1
It's probably the hwdownload slowing things down. But, as you mentioned, I couldn't find a QSV filter to do everything in hardware.
You will have to do some detection first with ffprobe. The pixel format filter needs to match the video. "p010le" for 10-bit video and "nv12" for 8-bit video are the two that QSV supports.
Regarding #2. If, at the start of the cropdetect at the -ss timestamp, your video has a different aspect ratio, either for stylistic effect or because it is a small logo on an all black background, the cropdetect will get it wrong if the windows isn't large enough. Your -t 5:00 helped me with that. I had been using "-ss 120 -to 180". MOST videos will have go back to 16:9 or 21:9 by the end of that 5 minute window.
But I have a new movie where there is an extended intro/prelude with a different resolution and aspect ratio than the rest of the movie that lasts the entirety of the 5 minute cropdetect window. Extending how long crop detect goes on for seems like a waste.
I'm debating how to handle this edge case. Two crop detects at different time stamps? Pick the one with the larger canvas? Each crop detect at a dynamic start time depending on the length of the video?