# "Format value" calculation question

**URL:** <https://community.mp3tag.de/t/format-value-calculation-question/61531>\
**Category:** Support\
**Created:** [July 12, 2023, 7:19pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531 "2023-07-12T19:19:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobNeptune](https://community.mp3tag.de/user_avatar/community.mp3tag.de/robneptune/32/14445_2.png) [@RobNeptune](https://community.mp3tag.de/u/RobNeptune)\
**Post date:** [July 12, 2023, 7:19pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531/1 "2023-07-12T19:19:59Z")

</div>

I am trying to create a calculation but cannot seem to figure it out and would welcome any advice...

My intent is to create an action that automatically multiplies the height and width of a video and then populates the result into a custom %Pixels% metatag.

Here is what I have done so far:

1. Created a new Column, %Pixels%
2. Convert \> Actions
3. New Action Group named Calculate Pixels.
4. New Action in that group, "Format value"
5. For "Field:", I defined %Pixels%.
6. For "Format string:", I defined $mul(%\_video\_width%,%\_video\_height%) based on the values documentation found here: [Format Strings and Placeholders – Mp3tag Documentation](https://docs.mp3tag.de/format/#technical-information)

However, when I saved and ran the custom action, nothing appeared within the %Pixels% column.  
Any ideas what I am doing wrong?

What I expected:  
1920x1080=2073600

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 12, 2023, 7:22pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531/2 "2023-07-12T19:22:59Z")

</div>

> [@RobNeptune](#):
>
> For "Field:", I defined %Pixels%.

It should be plain PIXELS.  
Check the extended tags dialogue Alt-T whether you have a field called %PIXELS% (and not as expected PIXELS)

Is it really necessary to save this information in a tag field or would you need it just for the display?  
The you could enter as "Value" for the column definition what you have used in the action:

> [@RobNeptune](#):
>
> `$mul(%_video_width%,%_video_height%)`

---

<div class="post-metadata">

**Author:** ![RobNeptune](https://community.mp3tag.de/user_avatar/community.mp3tag.de/robneptune/32/14445_2.png) [@RobNeptune](https://community.mp3tag.de/u/RobNeptune)\
**Post date:** [July 12, 2023, 7:50pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531/3 "2023-07-12T19:50:54Z")

</div>

> [@RobNeptune](#):
>
> $mul(%\_video\_width%,%\_video\_height%)

Thanks @ohrenkino - Changing the Field name fixed it!  
Regarding your question as to whether it is really necessary to save this information in a tag field, my ultimate goal is to leverage the "Pixel" values to automatically calculate the resolution of the video file within MP3Tag using an If/Then function that leverages the logic below. Please let me know if you have any suggestions on how to do this better or cleaner?

If PIXELS =1757184 AND "%\_video\_height%" equals 858, then populate RESOLUTION with 2K DCI CinemaScope  
If PIXELS = 2073600 AND "%\_video\_height%" equals 1080, then populate RESOLUTION with Full HD  
If PIXELS = 2157840 AND "%\_video\_height%" equals 1080, then populate RESOLUTION with 2K DCI Flat  
If PIXELS = 2211840 AND "%\_video\_height%" equals 1080, then populate RESOLUTION with 2K DCI Native  
If PIXELS = 2304000 AND "%\_video\_height%" equals 1200, then populate RESOLUTION with WUXGA  
If PIXELS = 2359296 AND "%\_video\_height%" equals 1152, then populate RESOLUTION with QWXGA  
If PIXELS = 3145728 AND "%\_video\_height%" equals 1536, then populate RESOLUTION with QXGA  
If PIXELS = 4147200 AND "%\_video\_height%" equals 1080, then populate RESOLUTION with 4K  
If PIXELS = 6144000 AND "%\_video\_height%" equals 1600, then populate RESOLUTION with 4K  
If PIXELS = 7028736 AND "%\_video\_height%" equals 1716, then populate RESOLUTION with 4K DCI CinemaScope  
If PIXELS = 7372800 AND "%\_video\_height%" equals 1440, then populate RESOLUTION with 5K  
If PIXELS = 8294400 AND "%\_video\_height%" equals 2160, then populate RESOLUTION with 4K UHD  
If PIXELS = 8294400 AND "%\_video\_height%" equals 3840, then populate RESOLUTION with 4K  
If PIXELS = 8631360 AND "%\_video\_height%" equals 2160, then populate RESOLUTION with 4K DCI Flat  
If PIXELS = 8847360 AND "%\_video\_height%" equals 2160, then populate RESOLUTION with 4K DCI Full Frame  
If PIXELS = 9216000 AND "%\_video\_height%" equals 2400, then populate RESOLUTION with WQUXGA

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 12, 2023, 7:57pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531/4 "2023-07-12T19:57:21Z")

</div>

I would suggest an action of the type "Format value" for RESOLUTION and  
Format string: `$replace($mul(%_video_width%,%_video_height%),9216000,WQUXGA,8847360,4K DCI Full Frame)`  
and so on for each of the pixel values.  
No need to save an implicid information twice.

---

<div class="post-metadata">

**Author:** ![RobNeptune](https://community.mp3tag.de/user_avatar/community.mp3tag.de/robneptune/32/14445_2.png) [@RobNeptune](https://community.mp3tag.de/u/RobNeptune)\
**Post date:** [July 12, 2023, 8:01pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531/5 "2023-07-12T20:01:07Z")

</div>

Brilliant, and thank you!

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [August 11, 2023, 8:01pm UTC](https://community.mp3tag.de/t/format-value-calculation-question/61531/6 "2023-08-11T20:01:18Z")

</div>

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