Skip to content

Editing Video Editing SDK Specification

杭州蓝松科技有限公司---技术实例展示 edited this page Jul 22, 2020 · 1 revision

words:

  • composition: is a container used to store various input files. The abbreviation is: compXXX, such as compDurationUs, which means the duration of the composition, in microseconds (Us)
  • Layer: Layer, we wrap the video into a layer, adding a video or picture is a layer.

ConcatComposition class

  • Means: concat video and picture. The total duration of the splicing of pictures and videos is used as the duration of the final exported video. The container has 3 layer classifications, namely: background layer, concat layer, and overlay layer. ˙

  • Background layer: Add a background layer to the container as a whole, support: color background, picture background, if you want to set different backgrounds for different layers, you can use the canvas/background function of the layer to set them separately;

  • Concat layer: Concat the picture and video selected by the user together. It can be added before the start, or inserted during the preview process, can be inserted at a specified time point, can be copied, can be deleted, and the front and back positions of each layer can be adjusted, Support gesture adjustment, support various methods of parent layer.

  • Overlay layer: On top of the concat layer, multiple other layers are superimposed on top and bottom. For example, overlay watermark, overlay text, overlay animation, etc. These are called overlay types. The layer can be adjusted up and down. Set the display start time point, you can set the display duration; can be superimposed, can be deleted, support gestures, rotate, move, zoom, filter mosaic, etc., and can perform all methods of the parent layer.

add videos and pictures

  • At present, most video editing is concat editing. For example, if you select a few videos and a few pictures, put the video first and the picture behind, and arrange concat into a final video.
  • It can be a single video, it can be multiple videos, it can be a picture or multiple pictures, or both pictures and videos After the video is added, the current default is to increase the entire video duration. After adding, you can set the video duration, the total duration of the container will change, get the layer object, and execute various methods of the layer. After the pictures are added, each picture is displayed for 3 seconds by default, the display time can be adjusted, and the pictures can be copied, deleted, and inserted.
  • If a transition is set, some pictures of the previous layer and the next layer overlap, and the overlap time can be set. After setting the transition, the total length of the final container is the sum of the length of each picture and video. If there is a transition or If the video changes speed, the corresponding container time will change;

time adjustment

  • The duration of the file itself. For example, the duration of the video, the duration of the sound, the picture is increased, the default is to display 3 seconds; the picture sequence and gif, etc. are their own duration; we call it originalDuration, which can only be read and cannot be modified, but you You can modify the display time of the file in the container and the time from which it is displayed;

  • You can modify: the display time point of the file in the container, whether it is looped, the display duration, if it loops, it will start from the display time point and loop to the end of the entire container, the time can be set in real time, real-time adjustment, real-time acquisition, when the display duration After the change, if you want to get the corresponding thumbnail, the image array in the thumbnail will also be changed accordingly;

  • If it is a video, the cut video length is supported. The two methods are: setCutStartTime and setCutEndTime, when the video starts to be cut, and where to cut; there is currently no restriction on video cutting, but it is recommended that you have a minimum cutting value of 1 second;

  • The names of these APIs are: original duration, displayDuration, startTimeOfComp (from what point in time the container starts to display);

Gesture + Move/Zoom/Rotate

  • When the container is created, the width and height are set. After the file is added, it will be placed in the middle of the container by default, that is, the width/2 and height/2 of the container; Each time you add a file, you will get a layer object. The layers support the touch event of moving, zooming and rotating by directly operating the screen with your fingers. You can move with one finger, zoom and rotate with two fingers; when a layer is selected, A red box will appear around it, indicating that the current layer is selected. In order to avoid accidentally touching other layers during operation, you can lock other layers. We provide rich APIs for you to set or get related Coordinates, we even define a class LSORect to let you get the relative coordinates corresponding to the current preview window and the absolute coordinates relative to the container;

  • We have also defined various common enumeration types, such as 4 zoom types, and 9 position points of top/bottom/left/right/center/top left/bottom left/top right/bottom right for you to choose; provide zoom factor, Zoom to actual size, set specific position, relative screen position, etc.

  • If you want to use the code to set, the set position is the position of the center point of the current layer. It can be zoomed to the specified size, and if the rotation is 0 degrees, it is 0 point directly above, and the angle is 0--360 degrees;

  • The keywords of these APIs are: scaleSize, scaleType, scaleFactor, positionType, centerPoint, positionInView, rotation.

Sticker/Watermark/Text

  • Stickers, watermarks, and texts, in our layer processing architecture, are presented in the form of images, because mobile GPUs process images; stickers, watermarks, and texts are based on the same technical principle, which are considered to be an image or a set of continuous The image is processed.

  • The text will provide various conversion methods inside the SDK, allowing you to conveniently operate with text layers. After the operation is completed, the SDK will convert it to an image for processing. If the text drawing method we provide is not detailed enough, you can also draw it yourself. Convert to picture or picture array and add to container.

  • Stickers and watermarks mean the same thing.We provide a single image layer, multiple image layers, Gif layers, etc., which you can set conveniently, you can set one or multiple.

  • After adding, you get the corresponding layer object, and your various picture operations are converted to operations on layer objects.

  • The keywords of these APIs are: BitmapLayer(android), BitmapListLayer(android), ImageLayer(ios), ImageListLayer(ios), Gif layer.

color adjustment/filter/beauty

  • The filter is to adjust the picture of the layer. It is a method of the layer like the zoom and movement of the layer. Color adjustment and filter and beauty are all different effects of the filter. Currently our beauty is only for the whole The screen is processed for skinning and whitening, without face recognition.
  • The currently supported color adjustments include: brightness/contrast/saturation/sharpening/color temperature/white balance/hue/exposure Currently 80 kinds of filters are supported, including the common 17 kinds of filters. It is currently recommended that you use these 17 kinds of filters. These filters can be seen in our demo.
  • The keywords of these APIs are: setFilter (setting will replace the previous one), add filter, remove filter, removeAllFilter;

Transition

  • The transition is an effect when two files are played concat, such as the previous paragraph disappears faintly, and the next paragraph gradually appears.

  • The current transition is set by the AE designer on the PC with after Effect, and then export it as a json file according to our format, and the SDK restores the effect of the PC design. The advantage is that the developer does not need to use the code to achieve the effect , You only need to send the corresponding json to the SDK according to different effects, and the SDK realizes such an effect, which is simple and efficient, and can achieve the same effect as Android and ios.

  • Use Ae software to make specifications on PC: Create a composite with a picture less than or equal to 544x960, and then perform rotation, zoom and transparency processing on it to form an animation; or mask it to form an animation; currently does not support simultaneous Rotate and zoom the effect of transparency + mask; the composite resolution should be less than or equal to 544x960, and the recommended duration should not be greater than 3 seconds, subject to the actual effect;

  • The transition settings are set through each specific layer. For example, there are 3 layers, named ABC respectively. To add a transition before AB, set the transition of the A layer object; add a transition between BC , Then set the transition of the B layer object;

  • The transition time can be set, the default is 1 second after setting the path, and the maximum can be set to 5 seconds;

  • The keywords of these APIs are: transition, transitionDuration, playTransition (preview), cancelTransition; The execution steps are: you need to set the transition path first, after setting, the default transition time is 1 second, if you want to preview, call playTransition; call cancelTransition to cancel the transition; after setting the path, you can set the transition time; set Later, if you need to preview the effect, then playTransition; if you want to apply it globally, you need to set a json file to each layer object; we will share the same json content internally;