[nodes] KeyframeSelection: Flag outputExtension for video inputs

If at least one of the inputs is a video, then the `outputExtension`
attribute should never be set to "none": if it is, no frame will ever be
written on disk, and as a consequence, no SfMData file will be written,
meaning that the whole score computation and keyframe selection process
will have been done for nothing.
This commit is contained in:
Candice Bentéjac 2023-08-22 11:11:52 +02:00
parent e6bf7e6e2d
commit 76d2e8680e

View file

@ -3,6 +3,9 @@ __version__ = "4.1"
import os import os
from meshroom.core import desc from meshroom.core import desc
# List of supported video extensions (provided by OpenImageIO)
videoExts = [".avi", ".mov", ".mp4", ".m4a", ".m4v", ".3gp", ".3g2", ".mj2", ".m4v", ".mpg"]
class KeyframeSelectionNodeSize(desc.DynamicNodeSize): class KeyframeSelectionNodeSize(desc.DynamicNodeSize):
def computeSize(self, node): def computeSize(self, node):
inputPathsSize = super(KeyframeSelectionNodeSize, self).computeSize(node) inputPathsSize = super(KeyframeSelectionNodeSize, self).computeSize(node)
@ -273,6 +276,8 @@ You can extract frames at regular interval by configuring only the min/maxFrameS
value="none", value="none",
values=["none", "exr", "jpg", "png"], values=["none", "exr", "jpg", "png"],
exclusive=True, exclusive=True,
validValue=lambda node: not (any(ext in input.value.lower() for ext in videoExts for input in node.inputPaths.value) and node.outputExtension.value == "none"),
errorMessage="A video input has been provided. The output extension should be different from 'none'.",
uid=[0], uid=[0],
), ),
desc.ChoiceParam( desc.ChoiceParam(