FFV1 in TVAI breaks at about 16,27 MPx

sometimes if i grab a video and try to process it into an output size, processing of any kind while using the FFV1 codec ends with a “resolution error”, and checking the logs reveals an error message that sounds rather absurd to me:

[ffv1 @ 00000000030A3FC0] Unsupported number 4 of slices requested, please specify a supported number with -slices (ex:4,6,9,12,16, ...)

trying to take the clue from TVAI and assuming it’s related to resolution, i went into a rabbit hole of experimenting on a 3840x1920 video by testing miniscule differences in output scaling like a maniac, and here’s what i found:

  • 5760x2880 (prioritize scale 150%) - fails
  • 5684x2842 (prioritize scale 148%) - works

then trying to get closer to the apparent point where processing fails by choosing the “prioritize width” resize method instead, i found that:

  • 5708x2854 (16,290632 MPx) - fails
  • 5704x2852 (16,267808 MPx) - works

if i grab a standard 4k video instead (3840x2160, so taller than the previous one), my results of changing output resolution with “prioritize width” again are:

  • 5380x3026 (16,279880 MPx) - fails
  • 5376x3024 (16,257024 MPx) - works

what i’m seeing here is that the limit is not expressed in width or height, but in pixel amount. at a point somewhere between 16,267808 and 16,279880 megapixels, the ffv1 codec in TVAI ceases to operate. what an excellent use of my time :skull:

is it a limitation of the codec? if i use an external tools (also powered by ffmpeg) to just scale up a 4k video into an 8k one and encode it into ffv1 mkv, it works fine. so i guess not? perhaps some bug related to parameters provided to ffmpeg maybe.

and of course, if i try to output my file in TVAI to a different codec capable of high res like h265 or prores, there’s no issue, i can also go all the way up to 8k resolution with these ones. but i’d rather be able to use ffv1 instead.

okay, so i tested it on a 2023-12-28 build of ffmpeg, and i guess it’s about the “-slices” parameter.

if i try to encode an 8k video by forcing 4 slices:

ffmpeg.exe -i "test-in.mkv" -s 7680x3840 -vcodec ffv1 -level 3 -slices 4 test-out.mkv

i get the same error. apparently that’s too little slices. if i use the same command but define 6 slices instead, it works.

i think the solution is to just omit the slices parameter in TVAI. if i do that when encoding an 8k video, it defaults to 6 slices, and if i convert to 3840x1920 instead, it defaults to 4. seems like it already picks the smallest amount of slices required by default, so manually forcing it to 4 is not necessary and breaks encoding beyond that ~16,27 MPx point.

edit: forgot you can modify encoders in TVAI yourself so i did just that, removed all the “-slices 4” from " %programdata%\Topaz Labs LLC\Topaz Video AI\models\video-encoders.json" and the issue is gone.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.