Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,000 --> 00:00:03,591
In this video we're going to be changing the speed of a clip.
2
00:00:03,591 --> 00:00:05,591
We have this footage of two guys playing basketball.
3
00:00:05,591 --> 00:00:07,091
It was shot at a high frame rate,
4
00:00:07,091 --> 00:00:10,191
so it's slow motion when we play it back at 24 frames a second.
5
00:00:10,191 --> 00:00:13,591
We're going to look at ways that we can speed it up,
6
00:00:13,591 --> 00:00:15,591
so it plays back in real-time.
7
00:00:15,591 --> 00:00:17,948
I think the footage was shot at 96 frames a second,
8
00:00:17,948 --> 00:00:21,590
which is four times more than the usual 24 frames a second.
9
00:00:21,591 --> 00:00:25,019
This means that for every frame in our 24 frame a second
10
00:00:25,019 --> 00:00:27,091
project there are 4 frames from the footage,
11
00:00:27,091 --> 00:00:30,744
so we are going to need to speed it up by a factor of 4
12
00:00:30,744 --> 00:00:32,591
to get it to play back in real-time.
13
00:00:32,591 --> 00:00:34,437
If you remember back to the first class,
14
00:00:34,437 --> 00:00:37,590
I've already shown you one way to speed a clip up by
15
00:00:37,590 --> 00:00:40,514
using an expression in the Read node, so let's try that.
16
00:00:40,514 --> 00:00:41,898
Before we go any further, though,
17
00:00:41,898 --> 00:00:45,090
let's add a frame number burn-in with a Text node,
18
00:00:45,090 --> 00:00:47,590
so we can see what is happening.
19
00:00:47,591 --> 00:00:52,409
I'll add a Text node and type value frame in square brackets on one line and
20
00:00:52,409 --> 00:01:00,590
metadata input/frame in square brackets on the next line.
21
00:01:00,591 --> 00:01:03,667
The top number is based on the timeline in Nuke,
22
00:01:03,667 --> 00:01:05,757
whereas the bottom number is reading the metadata that is
23
00:01:05,757 --> 00:01:08,590
embedded in the actual frame being passed through the Read node
24
00:01:08,590 --> 00:01:10,590
after any expression has been applied.
25
00:01:10,591 --> 00:01:14,591
Before we enter the expression the two numbers will match.
26
00:01:14,591 --> 00:01:17,590
We can open the Read node and choose expression,
27
00:01:17,590 --> 00:01:19,744
and type frame multiplied by four.
28
00:01:19,744 --> 00:01:25,019
Now frame one on the timeline is going to show frame four of the footage.
29
00:01:25,019 --> 00:01:28,091
On frame two we will see frame eight of the footage.
30
00:01:28,091 --> 00:01:30,924
Notice how the top number in the Text node hasn't changed
31
00:01:30,924 --> 00:01:33,257
because it's based on the new timeline,
32
00:01:33,257 --> 00:01:36,257
and we are effectively applying the retime to the
33
00:01:36,257 --> 00:01:38,590
footage before it gets to our timeline.
34
00:01:38,591 --> 00:01:42,591
When we hit play you can see the clip is playing back real-time now.
35
00:01:42,591 --> 00:01:44,591
You'll also notice that the clip ends much sooner because we've
36
00:01:44,591 --> 00:01:48,591
effectively removed three-quarters of the frames.
37
00:01:48,591 --> 00:01:52,590
This works, in this case, because the footage starts at frame 0.
38
00:01:52,591 --> 00:01:54,898
If the frame numbering with the footage starts at 1001,
39
00:01:54,898 --> 00:01:58,590
like it often does in Visual Effects, this isn't going to work.
40
00:01:58,591 --> 00:02:00,898
If I load in this version of the same clip,
41
00:02:00,898 --> 00:02:05,898
which is identical, except that it does start on frame 1001,
42
00:02:05,898 --> 00:02:08,590
you can see the problem.
43
00:02:08,591 --> 00:02:11,162
One thousand and one multiplied by 4 is 4004,
44
00:02:11,162 --> 00:02:13,524
and this clip ends at frame 1337,
45
00:02:13,524 --> 00:02:19,591
so we are already way beyond our frame range on our first frame.
46
00:02:19,591 --> 00:02:22,924
We could fix the expression by subtracting 1000 from the
47
00:02:22,924 --> 00:02:25,409
frame number before we do the multiplication,
48
00:02:25,409 --> 00:02:27,591
then adding it back on afterwards.
49
00:02:27,591 --> 00:02:32,590
That expression would look like this, frame-1000 in brackets,
50
00:02:32,591 --> 00:02:36,591
multiply by 4, add 1000, but like before,
51
00:02:36,591 --> 00:02:40,206
there are dedicated nodes that give us more options than just
52
00:02:40,206 --> 00:02:42,191
trying to do everything in the Read node.
53
00:02:42,191 --> 00:02:44,591
Let's remove the expression from the Read node,
54
00:02:44,591 --> 00:02:46,591
and delete the second line from the Text node.
55
00:02:46,591 --> 00:02:53,591
From now on our retimes will be based on the numbers in the Nuke timeline.
56
00:02:53,591 --> 00:02:56,257
The simplest way to apply a constant speed change to
57
00:02:56,257 --> 00:03:00,591
a clip is to use the Retime node, which we looked at in the previous video.
58
00:03:00,591 --> 00:03:03,591
Let's bring that in and set the speed to four.
59
00:03:03,591 --> 00:03:05,948
I'm also going to set the filter to nearest for now,
60
00:03:05,948 --> 00:03:08,091
and we'll come back to this later.
61
00:03:08,091 --> 00:03:12,591
Now you can see that the clip plays back at real speed.
62
00:03:12,591 --> 00:03:18,590
Notice that the output end frame now shows 1085.
63
00:03:18,591 --> 00:03:21,591
Using the speed slider is a very logical way of working,
64
00:03:21,591 --> 00:03:24,591
and other nodes that we'll cover later also have the same option,
65
00:03:24,591 --> 00:03:29,591
but it is often more practical to deal with frame numbers rather than speed.
66
00:03:29,591 --> 00:03:32,591
Working with frame numbers instead of speed makes it easier to use
67
00:03:32,591 --> 00:03:36,591
expressions to apply these changes in time to other nodes or to pass
68
00:03:36,591 --> 00:03:39,590
the retime data on to other applications.
69
00:03:39,591 --> 00:03:42,591
This is why the time TimeWarp node is probably the most used node in
70
00:03:42,591 --> 00:03:45,591
Visual Effects when it comes to setting up retimes.
71
00:03:45,591 --> 00:03:46,744
It's an incredibly simple node,
72
00:03:46,744 --> 00:03:49,283
and we don't often use it to render the final result,
73
00:03:49,283 --> 00:03:51,590
but we usually use it to set up the retimes,
74
00:03:51,591 --> 00:03:55,591
and then link the output to other nodes.
75
00:03:55,591 --> 00:03:57,437
In the TimeWarp node we simply define which frame of the source
76
00:03:57,437 --> 00:04:00,591
we want to view at each frame of the timeline.
77
00:04:00,591 --> 00:04:01,191
By default,
78
00:04:01,191 --> 00:04:03,291
you'll notice that Nuke automatically creates two
79
00:04:03,291 --> 00:04:05,019
key frames on the input property,
80
00:04:05,019 --> 00:04:09,129
one for the first frame and one for the last frame of our timeline.
81
00:04:09,129 --> 00:04:12,190
The value of these key frames matches the frame numbers of
82
00:04:12,190 --> 00:04:13,990
the first and the last frames of the clip,
83
00:04:13,990 --> 00:04:17,091
and if you look in the Curve Editor you can see that the
84
00:04:17,091 --> 00:04:19,129
interpolation between the key frames is linear,
85
00:04:19,129 --> 00:04:21,841
so currently the input frame of the clip matches
86
00:04:21,841 --> 00:04:24,591
the output frame of the timeline, a one to one relationship,
87
00:04:24,591 --> 00:04:27,590
so there is no speed change on the clip.
88
00:04:27,591 --> 00:04:31,206
As we scrub through it you'll see that the input value matches the output value.
89
00:04:31,206 --> 00:04:34,591
The slope of this graph represents the speed of the clip.
90
00:04:34,591 --> 00:04:37,162
The x-axis of the graph is the output frame,
91
00:04:37,162 --> 00:04:39,924
and the y-axis of the graph is the input frame.
92
00:04:39,924 --> 00:04:40,724
As it is,
93
00:04:40,724 --> 00:04:45,590
an increase of one on the x-axis results in an increase of one on the y-axis.
94
00:04:45,591 --> 00:04:47,898
This means that the gradient of the graph is one,
95
00:04:47,898 --> 00:04:50,590
and therefore the speed of the clip is one.
96
00:04:50,590 --> 00:04:54,341
The gradient of a graph for any point is called the derivative.
97
00:04:54,341 --> 00:04:55,841
Nuke will calculate this for us,
98
00:04:55,841 --> 00:04:59,532
and we can display it in a Text node in a similar way
99
00:04:59,532 --> 00:05:01,591
to how we display the frame numbers.
100
00:05:01,591 --> 00:05:04,590
Let's create a new Text node, below the TimeWarp this time,
101
00:05:04,591 --> 00:05:07,257
and enter value TimeWarp1.
102
00:05:07,257 --> 00:05:07,924
lookup.
103
00:05:07,924 --> 00:05:10,591
derivative in square brackets.
104
00:05:10,591 --> 00:05:12,898
The word lookup is actually the name of the input
105
00:05:12,898 --> 00:05:14,590
frame variable in the TimeWarp node,
106
00:05:14,590 --> 00:05:18,591
so this expression is telling the Text node to display the
107
00:05:18,591 --> 00:05:23,591
derivative of the input frame value on the current frame.
108
00:05:23,591 --> 00:05:24,924
We need to move this text down a little bit,
109
00:05:24,924 --> 00:05:26,514
so it's not covering up the frame numbers.
110
00:05:26,514 --> 00:05:30,448
We want to apply a constant speed change of four to the clip,
111
00:05:30,448 --> 00:05:33,590
so we want the gradient of our graph to be four.
112
00:05:33,591 --> 00:05:37,591
We do this by changing the relationship between the input and the output.
113
00:05:37,591 --> 00:05:38,233
If you remember,
114
00:05:38,233 --> 00:05:41,649
the Retime node told us that when we sped the clip up by a
115
00:05:41,649 --> 00:05:44,826
factor of four our clip ended on frame 1085,
116
00:05:44,826 --> 00:05:53,590
so we need to map frame 1337 of the input to frame 1085 on our timeline.
117
00:05:53,591 --> 00:05:54,990
We can do this in multiple ways.
118
00:05:54,990 --> 00:05:58,129
The first way is to use the controls in the node directly.
119
00:05:58,129 --> 00:06:03,590
We can move to frame 1085 in the timeline, and type 1337 into the dialog box.
120
00:06:03,590 --> 00:06:07,045
If you hit play now you'll see that the footage plays
121
00:06:07,045 --> 00:06:09,591
back faster until 1085 and then freezes,
122
00:06:09,591 --> 00:06:10,876
which is what we would expect,
123
00:06:10,876 --> 00:06:14,091
but if you look at the frame number burn-in you'll see that the frames
124
00:06:14,091 --> 00:06:16,390
aren't always increasing by 4 whole frame numbers,
125
00:06:16,390 --> 00:06:19,590
and the gradient is changing on every frame,
126
00:06:19,591 --> 00:06:22,052
and after 1085 it isn't frozen at all.
127
00:06:22,052 --> 00:06:25,437
It's reading in frames beyond the end of our clip and around 1190
128
00:06:25,437 --> 00:06:27,448
the frame numbers are actually going backwards,
129
00:06:27,448 --> 00:06:29,591
so what's going on here?
130
00:06:29,591 --> 00:06:31,841
If we look at the Curve Editor we can see that the
131
00:06:31,841 --> 00:06:33,448
graph is no longer a straight line.
132
00:06:33,448 --> 00:06:36,590
When we added a third key frame Nuke created a nice,
133
00:06:36,591 --> 00:06:40,591
smooth curve between it and the other key frames.
134
00:06:40,591 --> 00:06:42,591
This curved line means that the retime isn't linear.
135
00:06:42,591 --> 00:06:44,590
It's going to vary on every frame.
136
00:06:44,590 --> 00:06:47,136
It will be faster where the graph is steeper,
137
00:06:47,136 --> 00:06:48,227
slower where it's flatter,
138
00:06:48,227 --> 00:06:53,590
and it will actually run backwards when the graph starts sloping downwards.
139
00:06:53,591 --> 00:06:55,591
Luckily, there's an easy way to fix this.
140
00:06:55,591 --> 00:06:58,162
We can select all of the key frames and set the interpolation
141
00:06:58,162 --> 00:07:01,091
of the graph to linear by right-clicking on one of the key
142
00:07:01,091 --> 00:07:02,954
frames and choosing Interpolation, Linear.
143
00:07:02,954 --> 00:07:08,045
We could also just hit L with all our key frames selected.
144
00:07:08,045 --> 00:07:10,821
I like typing numbers into the node directly,
145
00:07:10,821 --> 00:07:13,590
as it's' easy to be very specific, but as you can see,
146
00:07:13,591 --> 00:07:15,206
it can lead to some unexpected results,
147
00:07:15,206 --> 00:07:19,360
so let's look at the other ways we could change the value.
148
00:07:19,360 --> 00:07:22,590
Let's start with a fresh TimeWarp node.
149
00:07:22,591 --> 00:07:26,590
We could change the key frame values directly in the Curve Editor.
150
00:07:26,591 --> 00:07:29,591
We can drag the key frames around or we can click on
151
00:07:29,591 --> 00:07:31,424
them and type in specific values.
152
00:07:31,424 --> 00:07:37,409
This is great, but sometimes I find working in the Curve Editor too fiddly,
153
00:07:37,409 --> 00:07:40,590
especially when I'm using a Wacom tablet,
154
00:07:40,591 --> 00:07:44,591
so instead we could also use the Dope Sheet.
155
00:07:44,591 --> 00:07:47,591
If we make sure that the key frames for the lookup values are visible,
156
00:07:47,591 --> 00:07:50,390
we can drag them along the timeline.
157
00:07:50,390 --> 00:07:55,129
So now we have our clip sped up by a factor of four,
158
00:07:55,129 --> 00:07:57,591
so it's playing back at the read speed.
159
00:07:57,591 --> 00:08:02,052
We can change the length of our project to match the new length of this clip,
160
00:08:02,052 --> 00:08:05,744
1001 to 1085.
161
00:08:05,744 --> 00:08:15,590
Let's do that in our Project Settings panel.
162
00:08:15,591 --> 00:08:19,591
So let's summarize what we've covered in this module.
163
00:08:19,591 --> 00:08:21,162
You want to have nailed down the exact footage you want
164
00:08:21,162 --> 00:08:22,591
to work with before getting to Nuke.
165
00:08:22,591 --> 00:08:26,514
It's much easier to go through large chunks of footage in an edit
166
00:08:26,514 --> 00:08:29,590
application than it is in a compositing tool.
167
00:08:29,591 --> 00:08:30,821
Like most things that we'll do in Nuke,
168
00:08:30,821 --> 00:08:32,662
there are many different ways to achieve the same result,
169
00:08:32,662 --> 00:08:36,019
but even if the result is the same each option will
170
00:08:36,019 --> 00:08:39,590
have its advantages over others.
171
00:08:39,591 --> 00:08:42,590
Always try to make your Nuke script as clear and concise as you can,
172
00:08:42,591 --> 00:08:46,591
and that doesn't always mean just using as few nodes as possible.
173
00:08:46,591 --> 00:08:51,591
It's good practice to separate major operations into individual nodes.
174
00:08:51,591 --> 00:08:53,162
You can use expressions and Text nodes to help you keep
175
00:08:53,162 --> 00:08:56,318
track of your retimes and troubleshoot anything that isn't
176
00:08:56,318 --> 00:08:58,591
working the way you expected.
177
00:08:58,591 --> 00:09:02,590
Where possible, try not to trim off extra frames in a permanent operation.
178
00:09:02,591 --> 00:09:04,090
Also, try to set up your scripts,
179
00:09:04,090 --> 00:09:07,305
so that you can extend the frame range easily if necessary.
180
00:09:07,305 --> 00:09:09,448
If you have the option,
181
00:09:09,448 --> 00:09:14,591
try to set up your retimes using frame numbers rather than speed values.
182
00:09:14,591 --> 00:09:26,591
It will allow you to be much more flexible with your project.
16246
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.