Delay an image transition in ffmpeg - image

How can I delay image left to right transition in ffmpeg?
[1:v]format=rgba,fade=in:st=30:d=0.3:alpha=1,fade=out:st=40:d=0.3:alpha=1[png];[vid][png]overlay=x='min(-(30-0.3)*w+2*w*t/3,15)':y=3*(H-h)/4-0.0:shortest=1
Because I start fade in at 30 sec, I set initial position of x to 27.7 and speed to 2*w*t/3. But the image does not appear at 30 seconds. What am I doing wrong?

Let's say that the image should be at x=15 when the fade-in finishes. So, at 30.3 s, it's at x=15, and it's traveling at w*2/3 /second. So, in 30+0.3 seconds, it will have traveled 30.3*w*(2/3), so starting point is 15 - (30+0.3)*w*2/3
Add the movement to that.
x='min(15-(30+0.3)*w*2/3+w*t*2/3,15)'

Related

Can't change Animation frame number in unity3D

I am trying to create an button animation in unity
When i create the clip,
frame number stays on 60 by default
then i change the frame number, but after moving the mouse pointer it go back to 60
i tried in again again by deleting the clip and recreating the clip
but no effect
still the same
for better understanding
1. when i create the clip
2. changing the frame number 60 to 0
3. after moving mouse pointer it back again to 60
You're trying to change total frame number.
Yes, It's in Unity 5.6 and upper versions, so that can be confusing.
If you look above to your sample 60 bar, you can see a place where 0 is typed:
That's your current frame
and you can make your desired animation changing the current time frame.
That number is the Sampling Rate of the animation, i.e. how many frames of that animation clip are "executed" in a second.
60 means the animation runs at 60fps, or 1 frame every 16.6ms, so the general formula is:
Sample = Number of frames / second
Hence, you can't set that value to 0, an animation that runs at 0 fps is a still frame.
To get a specific frame of the animation, you need to move the red vertical line or click on a specific time on the timeline bar.

Is it possible to get only the total number of black frames from a video clip using ffmpeg (windows user)?

I have a .avi video clip which runs for 30 minutes with 30 fps. I want to know the total number of black frames in that clip instead of showing every black frame. Is it possible to do it using ffmpeg?

Unity : 30fps vs 60fps on 30fps animation

I'm testing this on mobile, i have a 30 frame animation with 30 frame rate, i build it to my mobile with in-game target frame rate of 30 and 60. since the animation frame rate would be time base in unity, the animation would be exactly 1 second on both build.
This is what i assume would happen :
1) on 30fps build, the animation would play 1 frame on each in-game frame, so it would be 1 second.
2) on 60fps build, the animation would play 1 frame on every 2 in-game frame, so it would be 1 second as well.
My question is, why would the 60fps build look better compare with 30fps build? since the animation would just play 30 frame throughout 1 second.
There aren't anything else in the scene, only the animation, so nothing else would distract the feeling of 60fps would look better.
hope you all can understand the question, and if anyone have the same feeling, or you can test it yourself to see if you feel the same, feel free to comment, answer or discuss. Thanks.
I think i might have the answer, that's because since the animation would be time base, unity would fill better on empty keyframe in 60fps. example : set a position keyframe on 1st frame, then set another position key frame at 30th frame, unity would effectively play this as a 60 frame rate animation since there are so many empty keyframe.
I'm not sure if this is the exact answer, if someone can confirm this or there are no other answer i'll rate this as answer.
I find the question very vague and lacking specifics of what kind of animation is being discussed and how it is being used. 2D or 3D? Sprites or geometry? Frames of bitmap graphics or tweened motion created within Unity?
As an example: If your animation was a bitmap sprite animation and the sprite did not ever change coordinate positions, then 30 frames of bitmap animation played over a time duration of 1 second would appear EXACTLY THE SAME in a 60fps build as it would in a 30fps build.
If you're also moving the sprite from one XY to another set of XY, then the MOTION would appear smoother in the 60fps build due to interpolation of the coordinate positions (as you said in your own answer). But your bitmap frames still are playing exactly the same (1 image per 1/30ths of a second).
Similarly, if the animation discussed here is geometry, then everything is based on interpolation of the shapes and thus yes, 60 fps allows for 60 unique frames of animation.

FFmpeg fade audio to volume

I have say 5 segments of audio and i want to set each segment to a specific volume but when i concat the segments i'd like there to be a fade from previous volume to the next volume.
I see afade filter is for simply fading in/out. I see acrossfade which would more than likely be desirable except that the video the audio will play over will not be cross-faded.
I'm wondering if this can be done with something like aeval or if there are any good ideas out there.
Maybe someone can explain this filter function or where to learn about the syntax:
Fade volume after time 10 with an annihilation period of 5 seconds:
volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
I realized i can use afade and just manipulate the start time of the fade by calculating the time it takes to fade out to the next volume on a linear scale.
So to fade to 50% volume on a 15 second video, i would do something like
afade=t=out:st=14:d=2
Meaning i start a 2 second linear fade with 1 second left of audio, therefor leaving it at 50% volume on finish.

How does 'rate' property of JavaFX Animation class behave?

I have two rectangle shapes which are in translate transition as below
//First rectangle animation
TranslateTransition translateTransition1 = new TranslateTransition();
translateTransition1.setNode(rect1);
translateTransition1.setFromX(10);
translateTransition1.setFromY(0);
translateTransition1.setToX(10);
translateTransition1.setToY(300);
translateTransition1.setCycleCount(8);
//translateTransition.setAutoReverse(true);
translateTransition1.play();
translateTransition1.setRate(0.1);
//Second rectangle animation
TranslateTransition translateTransition2 = new TranslateTransition();
translateTransition2.setNode(rect2);
translateTransition2.setFromX(10);
translateTransition2.setFromY(-300); // This is the only difference
translateTransition2.setToX(10);
translateTransition2.setToY(300);
translateTransition2.setCycleCount(8);
//translateTransition.setAutoReverse(true);
translateTransition2.play();
translateTransition2.setRate(0.1);
Here both of these animation has rate (0.1) but they moved at different speed when I run the application.
As per the oracle document, 'rate' property defines speed/direction of the animation, then why does the two TranslateTranslations not have same speed even though I set it to 0.1?
Also how is the actual behaviour of the 'rate' property?
The Definition of Rate
Rate is not the velocity or speed in pixels per second of the translated object in the transition.
Think of rate like this (courtesy of Louis Tully in Ghostbusters):
I see you were exercising. So was I. I taped '20 Minute Workout' and played it back at high speed so it only took ten minutes and I got a really good workout.
Rate is like a fast forward, slow motion or rewind feature on a video recorder.
The Definition of Speed
I don't want to set duration. I just want the two rectangle to move at same speed.
Speed is distance over time.
If you want your rectangles to move at the same speed, make them move the same distance for the same duration.
Issues with your sample code
If you don't set a duration, one will be assigned for you. The default duration is 400 milliseconds, which is probably not what you want.
The rectangles in your question are moving at different speeds because you have asked them to travel different distances in the same time span.
Example
OK, you have probably got it now, but here is an example just in case.
TranslateTransition translateTransition1 = new TranslateTransition(
Duration.seconds(1), rect1
);
translateTransition1.setFromX(0);
translateTransition1.setToX(100);
translateTransition1.setInterpolator(Interpolator.LINEAR);
translateTransition1.play();
TranslateTransition translateTransition2 = new TranslateTransition(
Duration.seconds(2), rect2
);
translateTransition2.setFromX(0);
translateTransition2.setToX(100);
translateTransition2.setInterpolator(Interpolator.LINEAR);
translateTransition2.play();
rect2.setTranslateY(200);
So there are two rectangles:
rect1 moves a total distance of 100 pixels in one second, so its speed of travel is 100 pixels per second.
rect2 moves a total distance of 100 pixels in two seconds, so its speed of travel is 50 pixels per second.
A linear interpolator is used so that the transitions occur at constant velocity (e.g. a given rectangle does not accelerate or decelerate while it is moving).
If you want both rectangles to move at the same speed, you could set the duration of the second transition to one second, so it matches the duration of the first transition (their distance travelled already matches).
Alternatively, if you invoke translateTransition2.setRate(2), the second animation will play twice as quick, thus finishing in half of it's duration. This will double the speed of travel from 50 pixels per second to 100 pixels per second, matching the speed of the first rectangle.

Resources