MLT Framework: How to add zomm animation to all the tracks? - mlt

I have three tracks as follow:
track0: [---------------------black-----------------------]
track1: [-------------------in.mp4------------------------]
track2: [-----][1.jpg][----------][1.jpg]
What I want to do is add a zoom animation to it, which means apply a zoomin or zoomout animation to the frame after being composited.
And I know The "affine" filter can be help me, So I tried this:
melt.exe
color:black out=00:00:20.000 -track
in.mp4 -track
-blank out=00:00:2.000 1.jpg in=00:00:00.000 out=00:00:5.000 -attach-clip affine background=colour:0 transition.geometry="0.49%/53.29%:41.72%x46.35%" -blank out=00:00:1.000 1.jpg in=00:00:00.000 out=00:00:5.000 -attach-clip affine background=colour:0 transition.geometry="0.00%/30.13%:69.86%x69.86%"
-filter affine transition.cycle=0 transition.geometry="0=0.00%/0.00%:100.00%x100.00%; 49=0.00%/0.00%:100.
00%x100.00%; 75=0.00%/-106.07%:206.07%x206.07%; 125=0.00%/-106.07%:206.07%x206.07%; 250=0.00%/-0.22%:100.22%x100.22%; 300=0.00%/-0.22%:100.22%x100.22%; 350=-31.34%/-31.64%:131.64%x131.64%"
-transition mix:-1 always_active=1 a_track=0 b_track=1 sum=1
-transition frei0r.cairoblend a_track=0 b_track=1 disable=0
-transition mix:-1 always_active=1 a_track=0 b_track=2 sum=1
-transition frei0r.cairoblend a_track=0 b_track=2 disable=0
-consumer avformat:zoom.mp4
Sorry for that very long command line.
But I have unexcepted results with the zoom animation effects only applyed to track2, in other words, only the 1.jpg has zoom animation effects. The frames in "in.mp4" have no animation effects.
what I want is to apply the zoom animation to all the tracks. And I know there must be something wrong with my command line. But I can't figure out how to do this with command line.
So how can I do this?

You should look at the melt documentation here:
https://mltframework.org/docs/melt/
The "-filter" parameter applies the filter to the track. So the results you see are expected. But there are other options to consider. "-attach" looks promising. You might need to move the filter later in the command. Read the section on "Attached Filters" for more details and examples.

Related

mlt: image distortion using lossless codec

I have two 1920x1080 PNG files, center.png and right.png, which are identical except that the image in right.png is shifted horizontally by 325 pixels.
With mlt XML, I made a two-second long video using the lossless FFV1 format, showing one second of center.png, and then one second of right.png. Here's my file, foo.mlt:
<?xml version='1.0' encoding='utf-8'?>
<mlt>
<profile width="1920" height="1080"
display_aspect_num="1920" display_aspect_den="1080"
sample_aspect_num="1" sample_aspect_den="1"
colorspace="709" progressive="1"
frame_rate_num="30" frame_rate_den="1"/>
<consumer mlt_service="avformat" properties="lossless/FFV1" target="out.mkv"/>
<producer id="center" mlt_service="qimage" resource="center.png" length="30"/>
<producer id="right" mlt_service="qimage" resource="right.png" length="30"/>
<playlist>
<entry producer="center"/>
<entry producer="right"/>
</playlist>
</mlt>
Then I run melt foo.mlt at the terminal and check the output file out.mkv in my video viewer. However, on close inspection, when right.png appears in the video, it is slightly distorted (with some sort of halo-type artifact). Here is a magnified view:
Weirdly, only the right.png image is distorted; the center.png displays correctly, even though the two images are identical except for positioning.
Is this a bug? I wouldn't expect any image distortion with a lossless codec, but maybe I've done something wrong.
My specs:
Ubuntu 20.04.2 LTS, 64-bit
melt 6.25.0
ffmpeg version 4.2.4-1ubuntu0.1
Thanks
"Lossless" is not always lossless. In the case of "lossless/FFV1", the chroma format is 4:2:2 which will cut the chroma resolution in half:
https://github.com/mltframework/mlt/blob/master/presets/consumer/avformat/lossless/FFV1
This could be relevant because if format conversion is required, it could cause chroma bleeding on pixels that do not land directly on a chroma sample.
As an experiment, you could try shifting the image by 326 pixels instead of 325 to see if the bleeding still occurs.
There was another question a while back that related to bleeding due to chroma subsampling:
Melt composite transition is slightly blending

Mel Button Color ScriptJob?

New to mel and I'm writing a UI for object selecting in my Maya scene and I need help on how I can use the scriptjob to change the button color to white when the object is selected and back to default color when object is deselected. Button color should remain white as long as the object is selected. Kindly give solutions based on the code below. Thank!
if (`window -exists MyPicker`) deleteUI MySelecter;
window -title "Item Selecter" -widthHeight 170 300 -sizeable false -mxb false MySelecter;
formLayout -numberOfDivisions 100 MySelecter;{
button -label "object1" -w 170 -h 44 -enable true -backgroundColor 0.820 0.360 0.161 -command "select object1" object1_Btn;
button -label "object2" -w 170 -h 44 -enable true -backgroundColor 0.820 0.360 0.161 -command "select object2" object2_Btn;
button -label "object3" -w 170 -h 44 -enable true -backgroundColor 0.820 0.360 0.161 -command "select object3" object3_Btn;
button -label "object4" -w 170 -h 44 -enable true -backgroundColor 0.820 0.360 0.161 -command "select object4" object4_Btn;
button -label "object5" -w 170 -h 44 -enable true -backgroundColor 0.820 0.360 0.161 -command "select object5" object5_Btn;
}
formLayout -edit
//object button
-attachForm object1_Btn "top" 14
-attachForm object1_Btn "left" 0
-attachForm object2_Btn "top" 71
-attachForm object2_Btn "left" 0
-attachForm object3_Btn "top" 128
-attachForm object3_Btn "left" 0
-attachForm object4_Btn "top" 185
-attachForm object4_Btn "left" 0
-attachForm object5_Btn "top" 242
-attachForm object5_Btn "left" 0
MySelecter;
showWindow MySelecter;
This answer is all in Python, so you can convert it to MEL if you insist on using it.
Script jobs can trigger in many different ways when an event occurs. This could be things like when the time has changed, the user does an undo, or in your case when the selection has changed.
You can get a full list of these event names by running this:
cmds.scriptJob(listEvents=True)
The one you're looking for is "SelectionChanged".
To get this to work you need to define a function that will be called when the script job is triggered (when the selection changes). Here's a simple example of that.
import maya.cmds as cmds
# Create a function that will be called from the script job whenever there's a change to the selection.
def func():
print "The selection has changed!"
# Create a new script job and save the result to a variable. The result is the script job's id number.
script_job_id = cmds.scriptJob(event=["SelectionChanged", func])
# When it's no longer needed, pass the script job's id with the kill parameter to remove it.
#cmds.scriptJob(kill=script_job_id)
So in your case when you run the function it can check if the object is selected, and depending on if it is or not you can make it color the button.
When your tool closes you can remove the script job by using its kill parameter so that it's no longer running when you don't need it.
And as as side note that you wrote to Haggi unless you have a good reason I would just stick to Python instead of MEL. The syntax is much easier, it has insane amount of libraries, and it's just more powerful to do simple things like manipulating strings. Plus Python is used in many other softwares, MEL is not. It's true that there are some commands that can only be done in MEL but you can easily evaluate a MEL string with Python.

PowerCLI vSphere set-annotation

I am able to set notes in annotation with below PowerCLI vSphere.
Input: serverdetails.txt
name,notes
Server 1, This is an application server : .Net
Command:
Import-Csv "C:\temp\serverdetails.txt" | %{ Set-Vm -Name $.Name -Description $.Name -Confirm:$false }
Current Output in annotation i get is as below, complete content in one line.
This is an application server : .Net
However, i need below output in annotation (in two lines):
Line 1: This is an application server
Line 2: .Net
That's not really how the notes field operates, it's more designed around displaying information in the multi-VM view where multi-line output wouldn't work.
If you're looking for something that can display multiple lines, in an prescriptive manner, look at using Tags or even Annotations/Custom Attributes.

Preview actual image of PathGeometry in WPF MVVM

In my application there is a common Icon.xaml file which contains many PathGeometry Figures having unique key names like as shown below.
<PathGeometry x:Key="CloseGeometry" Figures="m 357.0883 499.0572 12.62375 12.6275 5.31375 -5.31625 -12.62625 -12.62625 12.62625 -12.61875 -5.31375 -5.3125 -12.62375 12.62 -12.6325 -12.62 -5.30375 5.3125 12.6175 12.61875 -12.6175 12.62625 5.30375 5.31625 12.6325 -12.6275 z"/>
<PathGeometry x:Key="NormalGeometry" Figures="M4.3685131,23.127279L4.3685131,47.283243 47.117023,47.283243 47.117023,23.127279z M25.087107,13.948568C23.539013,13.948568 22.286318,15.201555 22.286318,16.74834 22.286318,18.292325 23.539013,19.547214 25.087107,19.547214 26.6327,19.547214 27.886597,18.292325 27.886597,16.74834 27.886597,15.201555 26.6327,13.948568 25.087107,13.948568z M16.126242,13.948568C14.580646,13.948568 13.326751,15.201555 13.326751,16.74834 13.326751,18.292325 14.580646,19.547214 16.126242,19.547214 17.673136,19.547214 18.928329,18.292325 18.928329,16.74834 18.928329,15.201555 17.673136,13.948568 16.126242,13.948568z M7.1679735,13.948568C5.621069,13.948568 4.3685136,15.201555 4.3685131,16.74834 4.3685136,18.292325 5.621069,19.547214 7.1679735,19.547214 8.713438,19.547214 9.9674625,18.292325 9.9674625,16.74834 9.9674625,15.201555 8.713438,13.948568 7.1679735,13.948568z M0,10.684L53.755001,10.684 53.755001,51.668001 0,51.668001z M8.5679998,0L58.668022,0 64,0 64,5.6864691 64,45.317999 58.668022,45.317999 58.668022,5.6864691 8.5679998,5.6864691z"/>
<PathGeometry x:Key="MaximiseGeometry" Figures="M5.2010002,14.812L5.2010002,43.573997 56.098,43.573997 56.098,14.812z M29.868601,3.8869994C28.026201,3.8869996 26.534,5.3791947 26.534,7.2190399 26.534,9.0588851 28.026201,10.553 29.868601,10.553 31.7085,10.553 33.202,9.0588851 33.202,7.2190399 33.202,5.3791947 31.7085,3.8869996 29.868601,3.8869994z M19.200649,3.8869994C17.359457,3.8869996 15.867001,5.3791947 15.867001,7.2190399 15.867001,9.0588851 17.359457,10.553 19.200649,10.553 21.042044,10.553 22.536999,9.0588851 22.536999,7.2190399 22.536999,5.3791947 21.042044,3.8869996 19.200649,3.8869994z M8.5339746,3.8869994C6.6931,3.8869996 5.2010002,5.3791947 5.2010002,7.2190399 5.2010002,9.0588851 6.6931,10.553 8.5339746,10.553 10.37495,10.553 11.867,9.0588851 11.867,7.2190399 11.867,5.3791947 10.37495,3.8869996 8.5339746,3.8869994z M0,0L63.999001,0 63.999001,48.792999 0,48.792999z"/>
<PathGeometry x:Key="MinimiseGeometry" Figures="M 0 1, 1 1 "/>
.....
But my problem is that there are around 300 to 400 different PathGeometries and it becomes difficult to check whether particular type of Image exists or not.
Example:
If new WPF form is gettign developed by programmer in which s\he needs to use delete Icon then s\he will first check in Icon.xaml file whether it already exists or not, if not then it will be added.But this checking needs to be done manually which is a pain.
So is there any simplest way to preview or check whether particular iamge exists or not.
Currently, I konw two tools can help you preview PathGeometry data of xaml.
XamlPadX
Download: XamlPadX v4.0.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Grid>
<Path Stroke="Black" StrokeThickness="2" Data="M4.3685131,23.127279L4.3685131,47.283243 47.117023,47.283243 47.117023,23.127279z M25.087107,13.948568C23.539013,13.948568 22.286318,15.201555 22.286318,16.74834 22.286318,18.292325 23.539013,19.547214 25.087107,19.547214 26.6327,19.547214 27.886597,18.292325 27.886597,16.74834 27.886597,15.201555 26.6327,13.948568 25.087107,13.948568z M16.126242,13.948568C14.580646,13.948568 13.326751,15.201555 13.326751,16.74834 13.326751,18.292325 14.580646,19.547214 16.126242,19.547214 17.673136,19.547214 18.928329,18.292325 18.928329,16.74834 18.928329,15.201555 17.673136,13.948568 16.126242,13.948568z M7.1679735,13.948568C5.621069,13.948568 4.3685136,15.201555 4.3685131,16.74834 4.3685136,18.292325 5.621069,19.547214 7.1679735,19.547214 8.713438,19.547214 9.9674625,18.292325 9.9674625,16.74834 9.9674625,15.201555 8.713438,13.948568 7.1679735,13.948568z M0,10.684L53.755001,10.684 53.755001,51.668001 0,51.668001z M8.5679998,0L58.668022,0 64,0 64,5.6864691 64,45.317999 58.668022,45.317999 58.668022,5.6864691 8.5679998,5.6864691z" />
</Grid>
</Page>
Then put the PathGeometry data (string of the node "Figures") to the value of inside "Data":
Next, you need to click "Auto Parse" button in left top postion, you can view the rendering result (red border region in screenshot). See below, I just use the data second one from your data.
WPF Geometry Transformation Tool
Download: WPF Geometry Transformation Tool.
Put the string of the node "Figures" into the textarea of Input Geometry, then you can see the result (red border region in screenshot).

Implement NOT logic (Negative logic) in nagios alarm

I am newbie in network monitoring field and I have just started my work on nagios. So I have some basic doubts related to nagios.
we have a localhost.cfg at /usr/local/nagios/etc/objects/localhost.cfg
define service{
use local-service ; Name of service template to use
host_name blah-16.10
service_description Sample Check
check_command check_http_services!-H mydomain.com -u "/sample_url" --string "foo bar" -t 60
}
My questions:
1.) I know this script checks "http service" for the url "www.mydomain.com/sample_url" and find the text "foo bar" on that web page.
but I do not know the meaning/usage of the options (-H, -u, -t 60, --string)
i have googled but I can not find proper documentation where I can find the meaning of these parameters. Can anyone please suggest some link/urls for this?
2.) I want to implement kind of negative logic in my alarm. For example: I want to raise the alarm only when I find "status closed"`string on my web page (www.mydomain.com/sample_url)
How can I achieve this in nagios?
Note: During my searching, I found all those examples which worked like "If 'sample string' found within specific time then 'No Alarm'. If 'sample string' not found in specific time, then only 'Raise Alarm'".
But i need exact opposite.

Resources