openshot::Clip Class Reference

This class represents a clip (used to arrange readers on the timeline) More...

`#include <Clip.h>`

Inheritance diagram for openshot::Clip:

## Public Member Functions

void | AddEffect (EffectBase *effect)
| Add an effect to the clip. More...
| Clip ()
| Default Constructor. More...
| Clip (ReaderBase *new_reader)
| Constructor with reader. More...
| Clip (string path)
| Constructor with filepath (reader is automatically created... by guessing file extensions) More...
void | Close ()
| Close the internal reader. More...
list< EffectBase * > | Effects ()
| Return the list of effects on the timeline. More...
float | End ()
| Override End() method. More...
std::shared_ptr< Frame > | GetFrame (int64_t requested_frame)
| Get an openshot::Frame object for a specific frame number of this timeline. More...
string | Json ()
| Get and Set JSON methods. More...
Json::Value | JsonValue ()
| Generate Json::JsonValue for this object. More...
void | Open ()
| Open the internal reader. More...
string | PropertiesJSON (int64_t requested_frame)
ReaderBase * | Reader ()
| Get the current reader. More...
void | Reader (ReaderBase *new_reader)
| Set the current reader. More...
void | RemoveEffect (EffectBase *effect)
| Remove an effect from the clip. More...
void | SetJson (string value)
| Load JSON string into this object. More...
void | SetJsonValue (Json::Value root)
| Load Json::JsonValue into this object. More...
| ~Clip ()
| Destructor. More...
Public Member Functions inherited from openshot::ClipBase
| ClipBase ()
| Constructor for the base clip. More...
void | Id (string value)
| Set basic properties. More...
bool | operator< (ClipBase &a)
bool | operator<= (ClipBase &a)
bool | operator> (ClipBase &a)
bool | operator>= (ClipBase &a)
void | SetMaxSize (int width, int height)
| Set Max Image Size (used for performance optimization) More...

## Public Attributes

Keyframe | alpha
| Curve representing the alpha (1 to 0) More...
AnchorType | anchor
| The anchor determines what parent a clip should snap to. More...
Keyframe | channel_filter
| Audio channel filter and mappings. More...
Keyframe | channel_mapping
| A number representing an audio channel to output (only works when filtering a channel) More...
GravityType | crop_gravity
| Cropping needs to have a gravity to determine what side we are cropping. More...
Keyframe | crop_height
| Curve representing height in percent (0.0=0%, 1.0=100%) More...
Keyframe | crop_width
| Curve representing width in percent (0.0=0%, 1.0=100%) More...
Keyframe | crop_x
| Curve representing X offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%) More...
Keyframe | crop_y
| Curve representing Y offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%) More...
FrameDisplayType | display
| The format to display the frame number (if any) More...
GravityType | gravity
| The gravity of a clip determines where it snaps to it's parent. More...
Keyframe | has_audio
| Override has_video and has_audio properties of clip (and their readers) More...
Keyframe | has_video
| An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes) More...
Keyframe | location_x
| Curve representing the relative X position in percent based on the gravity (-1 to 1) More...
Keyframe | location_y
| Curve representing the relative Y position in percent based on the gravity (-1 to 1) More...
VolumeMixType | mixing
| What strategy should be followed when mixing audio with other clips. More...
Keyframe | perspective_c1_x
| Curves representing X for coordinate 1. More...
Keyframe | perspective_c1_y
| Curves representing Y for coordinate 1. More...
Keyframe | perspective_c2_x
| Curves representing X for coordinate 2. More...
Keyframe | perspective_c2_y
| Curves representing Y for coordinate 2. More...
Keyframe | perspective_c3_x
| Curves representing X for coordinate 3. More...
Keyframe | perspective_c3_y
| Curves representing Y for coordinate 3. More...
Keyframe | perspective_c4_x
| Curves representing X for coordinate 4. More...
Keyframe | perspective_c4_y
| Curves representing Y for coordinate 4. More...
Keyframe | rotation
| Curve representing the rotation (0 to 360) More...
ScaleType | scale
| The scale determines how a clip should be resized to fit it's parent. More...
Keyframe | scale_x
| Curve representing the horizontal scaling in percent (0 to 1) More...
Keyframe | scale_y
| Curve representing the vertical scaling in percent (0 to 1) More...
Keyframe | shear_x
| Curve representing X shear angle in degrees (-45.0=left, 45.0=right) More...
Keyframe | shear_y
| Curve representing Y shear angle in degrees (-45.0=down, 45.0=up) More...
Keyframe | time
| Curve representing the frames over time to play (used for speed and direction of video) More...
Keyframe | volume
| Curve representing the volume (0 to 1) More...
Color | wave_color
| Curve representing the color of the audio wave form. More...

## Protected Attributes

CriticalSection | getFrameCriticalSection
| Section lock for multiple threads. More...
Protected Attributes inherited from openshot::ClipBase
float | end
| The position in seconds to end playing (used to trim the ending of a clip) More...
string | id
| ID Property for all derived Clip and Effect classes. More...
int | layer
| The layer this clip is on. Lower clips are covered up by higher clips. More...
int | max_height
| The maximium image height needed by this clip (used for optimizations) More...
int | max_width
| The maximum image width needed by this clip (used for optimizations) More...
float | position
| The position on the timeline where this clip should start playing. More...
string | previous_properties
| This string contains the previous JSON properties. More...
float | start
| The position in seconds to start playing (used to trim the beginning of a clip) More...

## Additional Inherited Members

Protected Member Functions inherited from openshot::ClipBase
Json::Value | add_property_choice_json (string name, int value, int selected_value)
| Generate JSON choice for a property (dropdown properties) More...
Json::Value | add_property_json (string name, float value, string type, string memo, Keyframe *keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame)
| Generate JSON for a property. More...

## Detailed Description

This class represents a clip (used to arrange readers on the timeline)

Each image, video, or audio file is represented on a layer as a clip. A clip has many properties that affect how it behaves on the timeline, such as its size, position, transparency, rotation, speed, volume, etc...

// Create some clips
Clip c1(new ImageReader("MyAwesomeLogo.jpeg"));
Clip c2(new FFmpegReader("BackgroundVideo.webm"));
// CLIP 1 (logo) - Set some clip properties (with Keyframes)
c1.Position(0.0); // Set the position or location (in seconds) on the timeline
c1.gravity = GRAVITY_LEFT; // Set the alignment / gravity of the clip (position on the screen)
c1.scale = SCALE_CROP; // Set the scale mode (how the image is resized to fill the screen)
c1.Layer(1); // Set the layer of the timeline (higher layers cover up images of lower layers)
c1.Start(0.0); // Set the starting position of the video (trim the left side of the video)
c1.End(16.0); // Set the ending position of the video (trim the right side of the video)
c1.alpha.AddPoint(1, 0.0); // Set the alpha to transparent on frame #1
c1.alpha.AddPoint(500, 0.0); // Keep the alpha transparent until frame #500
c1.alpha.AddPoint(565, 1.0); // Animate the alpha from transparent to visible (between frame #501 and #565)
// CLIP 2 (background video) - Set some clip properties (with Keyframes)
c2.Position(0.0); // Set the position or location (in seconds) on the timeline
c2.Start(10.0); // Set the starting position of the video (trim the left side of the video)
c2.Layer(0); // Set the layer of the timeline (higher layers cover up images of lower layers)
c2.alpha.AddPoint(1, 1.0); // Set the alpha to visible on frame #1
c2.alpha.AddPoint(150, 0.0); // Animate the alpha to transparent (between frame 2 and frame #150)
c2.alpha.AddPoint(360, 0.0, LINEAR); // Keep the alpha transparent until frame #360
c2.alpha.AddPoint(384, 1.0); // Animate the alpha to visible (between frame #360 and frame #384)

Definition at line 109 of file Clip.h.

## Constructor & Destructor Documentation

## Clip() [1/3]

Clip::Clip | ( |  | ) |

Default Constructor.

Definition at line 125 of file Clip.cpp.

## Clip() [2/3]

Clip::Clip | ( | string | path | ) |

Constructor with filepath (reader is automatically created... by guessing file extensions)

Parameters

  path | The path of a reader (video file, image file, etc...). The correct reader will be used automatically.

Definition at line 146 of file Clip.cpp.

## Clip() [3/3]

Clip::Clip | ( | ReaderBase * | new_reader | ) |

Constructor with reader.

Parameters

  new_reader | The reader to be used by this clip

Definition at line 132 of file Clip.cpp.

## ~Clip()

Clip::~Clip | ( |  | ) |

Destructor.

Definition at line 194 of file Clip.cpp.

## Member Function Documentation

## AddEffect()

void Clip::AddEffect | ( | EffectBase * | effect | ) |

Add an effect to the clip.

Parameters

  effect | Add an effect to the clip. An effect can modify the audio or video of an openshot::Frame.

Definition at line 1019 of file Clip.cpp.

## Close()

void Clip::Close | ( |  | ) |

Close the internal reader.

Definition at line 247 of file Clip.cpp.

## Effects()

list<EffectBase*> openshot::Clip::Effects | ( |  | ) |

inline

Return the list of effects on the timeline.

Definition at line 182 of file Clip.h.

## End()

float Clip::End | ( |  | ) |

Override End() method.

Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.

Definition at line 261 of file Clip.cpp.

## GetFrame()

std::shared_ptr< Frame > Clip::GetFrame | ( | int64_t | requested_frame | ) |

Get an openshot::Frame object for a specific frame number of this timeline.

Returns
  The requested frame (containing the image)

Parameters

  requested_frame | The frame number that is requested

Definition at line 283 of file Clip.cpp.

## Json()

string Clip::Json | ( |  | ) |

virtual

Get and Set JSON methods.

Generate JSON string of this object

Implements openshot::ClipBase.

Definition at line 679 of file Clip.cpp.

## JsonValue()

Json::Value Clip::JsonValue | ( |  | ) |

virtual

Generate Json::JsonValue for this object.

Implements openshot::ClipBase.

Definition at line 761 of file Clip.cpp.

## Open()

void Clip::Open | ( |  | ) |

Open the internal reader.

Definition at line 230 of file Clip.cpp.

## PropertiesJSON()

string Clip::PropertiesJSON | ( | int64_t | requested_frame | ) |

virtual

Get all properties for a specific frame (perfect for a UI to display the current state of all properties at any time)

Implements openshot::ClipBase.

Definition at line 686 of file Clip.cpp.

## Reader() [1/2]

ReaderBase * Clip::Reader | ( |  | ) |

Get the current reader.

Definition at line 220 of file Clip.cpp.

## Reader() [2/2]

void Clip::Reader | ( | ReaderBase * | new_reader | ) |

Set the current reader.

Parameters

  new_reader | The reader to be used by this clip

Definition at line 210 of file Clip.cpp.

## RemoveEffect()

void Clip::RemoveEffect | ( | EffectBase * | effect | ) |

Remove an effect from the clip.

Parameters

  effect | Remove an effect from the clip.

Definition at line 1029 of file Clip.cpp.

## SetJson()

void Clip::SetJson | ( | string | value | ) |

virtual

Load JSON string into this object.

Implements openshot::ClipBase.

Definition at line 819 of file Clip.cpp.

## SetJsonValue()

void Clip::SetJsonValue | ( | Json::Value | root | ) |

virtual

Load Json::JsonValue into this object.

Implements openshot::ClipBase.

Definition at line 842 of file Clip.cpp.

## Member Data Documentation

## alpha

Keyframe openshot::Clip::alpha

Curve representing the alpha (1 to 0)

Definition at line 229 of file Clip.h.

## anchor

AnchorType openshot::Clip::anchor

The anchor determines what parent a clip should snap to.

Definition at line 156 of file Clip.h.

## channel_filter

Keyframe openshot::Clip::channel_filter

Audio channel filter and mappings.

A number representing an audio channel to filter (clears all other channels)

Definition at line 259 of file Clip.h.

## channel_mapping

Keyframe openshot::Clip::channel_mapping

A number representing an audio channel to output (only works when filtering a channel)

Definition at line 260 of file Clip.h.

## crop_gravity

GravityType openshot::Clip::crop_gravity

Cropping needs to have a gravity to determine what side we are cropping.

Definition at line 240 of file Clip.h.

## crop_height

Keyframe openshot::Clip::crop_height

Curve representing height in percent (0.0=0%, 1.0=100%)

Definition at line 242 of file Clip.h.

## crop_width

Keyframe openshot::Clip::crop_width

Curve representing width in percent (0.0=0%, 1.0=100%)

Definition at line 241 of file Clip.h.

## crop_x

Keyframe openshot::Clip::crop_x

Curve representing X offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%)

Definition at line 243 of file Clip.h.

## crop_y

Keyframe openshot::Clip::crop_y

Curve representing Y offset in percent (-1.0=-100%, 0.0=0%, 1.0=100%)

Definition at line 244 of file Clip.h.

## display

FrameDisplayType openshot::Clip::display

The format to display the frame number (if any)

Definition at line 157 of file Clip.h.

## getFrameCriticalSection

CriticalSection openshot::Clip::getFrameCriticalSection

protected

Section lock for multiple threads.

Definition at line 112 of file Clip.h.

## gravity

GravityType openshot::Clip::gravity

The gravity of a clip determines where it snaps to it's parent.

Definition at line 154 of file Clip.h.

## has_audio

Keyframe openshot::Clip::has_audio

Override has_video and has_audio properties of clip (and their readers)

An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes)

Definition at line 263 of file Clip.h.

## has_video

Keyframe openshot::Clip::has_video

An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes)

Definition at line 264 of file Clip.h.

## location_x

Keyframe openshot::Clip::location_x

Curve representing the relative X position in percent based on the gravity (-1 to 1)

Definition at line 225 of file Clip.h.

## location_y

Keyframe openshot::Clip::location_y

Curve representing the relative Y position in percent based on the gravity (-1 to 1)

Definition at line 226 of file Clip.h.

## mixing

VolumeMixType openshot::Clip::mixing

What strategy should be followed when mixing audio with other clips.

Definition at line 158 of file Clip.h.

## perspective_c1_x

Keyframe openshot::Clip::perspective_c1_x

Curves representing X for coordinate 1.

Definition at line 249 of file Clip.h.

## perspective_c1_y

Keyframe openshot::Clip::perspective_c1_y

Curves representing Y for coordinate 1.

Definition at line 250 of file Clip.h.

## perspective_c2_x

Keyframe openshot::Clip::perspective_c2_x

Curves representing X for coordinate 2.

Definition at line 251 of file Clip.h.

## perspective_c2_y

Keyframe openshot::Clip::perspective_c2_y

Curves representing Y for coordinate 2.

Definition at line 252 of file Clip.h.

## perspective_c3_x

Keyframe openshot::Clip::perspective_c3_x

Curves representing X for coordinate 3.

Definition at line 253 of file Clip.h.

## perspective_c3_y

Keyframe openshot::Clip::perspective_c3_y

Curves representing Y for coordinate 3.

Definition at line 254 of file Clip.h.

## perspective_c4_x

Keyframe openshot::Clip::perspective_c4_x

Curves representing X for coordinate 4.

Definition at line 255 of file Clip.h.

## perspective_c4_y

Keyframe openshot::Clip::perspective_c4_y

Curves representing Y for coordinate 4.

Definition at line 256 of file Clip.h.

## rotation

Keyframe openshot::Clip::rotation

Curve representing the rotation (0 to 360)

Definition at line 230 of file Clip.h.

## scale

ScaleType openshot::Clip::scale

The scale determines how a clip should be resized to fit it's parent.

Definition at line 155 of file Clip.h.

## scale_x

Keyframe openshot::Clip::scale_x

Curve representing the horizontal scaling in percent (0 to 1)

Definition at line 223 of file Clip.h.

## scale_y

Keyframe openshot::Clip::scale_y

Curve representing the vertical scaling in percent (0 to 1)

Definition at line 224 of file Clip.h.

## shear_x

Keyframe openshot::Clip::shear_x

Curve representing X shear angle in degrees (-45.0=left, 45.0=right)

Definition at line 247 of file Clip.h.

## shear_y

Keyframe openshot::Clip::shear_y

Curve representing Y shear angle in degrees (-45.0=down, 45.0=up)

Definition at line 248 of file Clip.h.

## time

Keyframe openshot::Clip::time

Curve representing the frames over time to play (used for speed and direction of video)

Definition at line 233 of file Clip.h.

## volume

Keyframe openshot::Clip::volume

Curve representing the volume (0 to 1)

Definition at line 234 of file Clip.h.

## wave_color

Color openshot::Clip::wave_color

Curve representing the color of the audio wave form.

Definition at line 237 of file Clip.h.

The documentation for this class was generated from the following files:

- Clip.h
- Clip.cpp

OpenShot Wipe Tests.c1
c1
Definition: OpenShot Wipe Tests.py:8
openshot::SCALE_CROP
@ SCALE_CROP
Scale the clip until both height and width fill the canvas (cropping the overlap)
Definition: Enums.h:51
openshot::LINEAR
@ LINEAR
Linear curves are angular, straight lines between two points.
Definition: Point.h:47
openshot::GRAVITY_LEFT
@ GRAVITY_LEFT
Align clip to the left of its parent (middle aligned)
Definition: Enums.h:40
openshot::Clip::Clip
Clip()
Default Constructor.
Definition: Clip.cpp:125
OpenShot Wipe Tests.c2
c2
Definition: OpenShot Wipe Tests.py:14