[FFmpeg-trac] #7777(undetermined:new): cropdetect values cut too much
FFmpeg
trac at avcodec.org
Fri Mar 8 19:35:44 EET 2019
#7777: cropdetect values cut too much
-------------------------------------+-------------------------------------
Reporter: JouMxyzptlk | Owner:
Type: defect | Status: new
Priority: normal | Component:
| undetermined
Version: unspecified | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by JouMxyzptlk):
Current workaround for my encoding batch, calculating w= and h= manually
since the detection of the x1 / x2 / y1 / y2 are correct:
{{{
set modulo=2
c:\prog\ffmpeg\bin\ffmpeg -hide_banner -ss 00:05:00 -loglevel info -i
%input% -frames:v 2000 -vf "cropdetect=16:%modulo%:2000" -f null NUL 2>&1
| grep -o -e "[0-9]\{1,\} x2:.*y2:[0-9]\{1,\}" | tail -1 | sed -e s/"
[a-z][0-9]:"/" "/g > %temp%\crop.txt
set a= && set b= && set c= && set d=
for /f "tokens=1-4" %%a in (%temp%\crop.txt) do set x1=%%a&& set x2=%%b&&
set y1=%%c&& set y2=%%d
set /a w=%x2%+1-%x1%
set /a h=%y2%+1-%y1%
:wcheck
set /a w2=%w%/%modulo%*%modulo%
if not "%w2%"=="%w%" set /a w=%w%+1 && goto :wcheck
:hcheck
set /a h2=%h%/%modulo%*%modulo%
if not "%h2%"=="%h%" set /a h=%h%+1 && goto :hcheck
set crop=crop=%w%:%h%:%x1%:%y1%
echo %crop%
}}}
You shoudn't use modulo higher that 8 since 1080 / 16 is 67.5, ending up
with h=1088 when using this calc method.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7777#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list