Pixel and percent in filters sets

in the file “Text Simple with Gradient Back” (filter set file) i can see this :
<property name="geometry">0% 75% 100% 25%</property>
values are in percentage, so the filters work whatever the resolution of the project (1920x1080, 1080x1920, 1280x720,…)

when I perform the same filter set, in the file I get this :
<property name="geometry">0 0 1920 1080 1</property>
the values are in pixels and therefore the filter works correctly only with projects whose resolution is the same as when the filter was created

I guess we can manually edit the file but can all filter values be expressed as a percentage ? crop : rectangle, text : rich, mask : simple shape, etc…

1 Like

Correct me if I’m wrong, but wouldn’t that mean that we would lose the rectangle control in these filters?
When the rectangle control was added to the Crop: Rectangle filter, the percentage values were converted to pixel values.

1 Like

Je pense que les valeurs en % sont utilisées dans les préréglages.
Ainsi, quelque soit le format de votre projet, quand vous utilisez un préréglage, vous obtenez la même taille du rectangle dans l’UI et le VUI. Ainsi, un rectangle de 50% de large et 50% de haut donnera un rectangle de 640 x 360 dans un projet 720p et 960 x 540 dans un projet 1080.
Au chargement du préréglage, le logiciel convertit les pourcentages en pixels pour remplir les zones de saisie de l’UI.
Par contre, lorsqu’on enregistre le projet, les données sont inscrites en pixels dans le fichier mlt

I think the % values are used in the presets.
So no matter what format your project is, when you use a preset, you get the same size rectangle in the UI and VUI. For example, a rectangle that is 50% wide and 50% high will result in a 640 x 360 rectangle in a 720p project and 960 x 540 in a 1080 project.
When the preset is loaded, the software converts the percentages into pixels to fill the input areas of the UI.
However, when the project is saved, the data is written in pixels in the mlt file

2 Likes

oui il me semble que après l’ajout des filtres les valeurs qui sont en pourcentages sont converties en pixel, mais cela n’est pas si gênant, l’utilité des pourcentages ce situe à mon avis dans l’ajout des filtres de façon correct, ensuite que ce soit des pourcentages ou des pixels cela n’a pas d’importance du moment où le premier placement des élément masque, texte, etc est juste par rapport au ratio de la vidéo et de sa résolution

yes it seems to me that after adding the filters the values which are in percentages are converted into pixels, but that is not so annoying, the usefulness of the percentages lies in my opinion in the addition of the filters in a correct way , then whether it’s percentages or pixels it doesn’t matter as long as the first placement of the mask, text, etc. element is right with respect to the ratio of the video and its resolution

la bonne méthode de faire est je pense d’éditer le fichier du set de filtres pour manuellement convertir les valeurs de pixels en pourcentage, mais j’ignore si l’on peut utiliser des pourcentage dans tout les filtres ou si c’est le cas dans seulement quelques filtre

the right way to do is I think to edit the filter set file to manually convert the pixel values to percentages, but I don’t know if you can use percentages in all filters or if that’s the case in just a few filters

Essayez ceci.
Créez un projet de 1280 x 720, ajoutez une image sur V1
Appliquez n’importe quel filtre qui utilise un rectangle et réglez les valeurs sur
X = 320 ; Y = 180 ; W = 640 ; H = 360
Enregistrez et fermez le projet.
Ouvrez le fichier mlt du projet avec un éditeur de texte, et remplacez les valeurs
320 180 640 360 1 par 25% 25% 50% 50% 1
Enregistrez et ouvrez à nouveau le projet dans SC.
Le rectangle n’a pas changé.
Mais dès que vous sauvegardez à nouveau, SC remet les valeurs en pixels dans le fichier mlt.

Try this.
Create a 1280 x 720 project, add an image on V1
Apply any filter that uses a rectangle and set the values to
X = 320; Y = 180; W = 640; H = 360
Save and close the project.
Open the project mlt file with a text editor, and replace the values
320 180 640 360 1 with 25% 25% 50% 50% 1
Save and open the project again in SC.
The rectangle has not changed.
But as soon as you save again, SC puts the pixel values back into the mlt file.

Vous voulez éditer quel fichier ?
Le fichier ui.qml du filtre ? Le fichier .mlt du projet ? ou le fichier des préréglages du filtre ?

Which file do you want to edit?
The filter’s ui.qml file? The project .mlt file? or the filter presets file?

c’est le fichier du set de filtre que j’édite celui qui se trouve dans C:\Users\Utilisateur\AppData\Local\Meltytech\Shotcut\filter-sets

its the filter set file i am editing the one that is in
C:\Users\Utilisateur\AppData\Local\Meltytech\Shotcut\filter-sets

Je n’ai pas encore utilisé cette nouvelle fonctionnalité, mais je pense que cela devrait fonctionner.
Vous ne risquez rien à faire un essai.

I haven’t used this new feature yet, but I think it should work.
It’s safe to give it a try.

You can use % in a filter preset an it would work in any resolutions, bus as whole number % i not a precise as pixel there is the real unit. at FHD (1920x1080)
1% (horisontal) = 19.2 pixel and 1% (vertical) = 10.8. Ex 5% vertical = 54 pixel
But if you want 1/3 of the height = 1080/3 = 360 pixel
33% = 356.4 (4 pixel less than a 1/3)
So when you save the project you need to save it in pixel, to be precise.
If the resolution get higher, the precision of 1% get even lower
image

1 Like

Are decimal percentages not supported? I haven’t played with it yet, so I’m curious.

Looks like decimals work
preset with 33% height / width

preset with 33.3333%

But pixels are exact whole number, so real number fractions like % will give rounding errors in some cases.
It is fine for presets, but project files need the precise number of pixel, because a project has an exact size in pixels

Thanks for sharing the results! The MLT engine typically truncates a conversion to pixel coordinates if there is a decimal, so it should be fine. This is standard functionality to make Preview Scaling work. It uses the same concepts.

This topic was automatically closed after 90 days. New replies are no longer allowed.