Cloudinary Blog

Video Manipulations and Delivery for Angular Video Apps

Video Manipulations and Delivery for Angular Video Apps

On social media, videos posted by users constitute a significant amount of the content appeal on those platforms. From upload to manipulation to delivery, a smooth, efficient, and effective pipeline for the posting process is mandatory to ensure consistent user sessions and their steadily increasing volume. However, building such an infrastructure is a complex, labor-intensive, and problem-prone undertaking.

Enter Cloudinary, whose capabilities impressively form such an infrastructure. This article shows you how to manipulate, transform, and deliver videos in Angular apps with Cloudinary’s robust drop-in components.

Installing the Angular SDK

To manipulate and transform videos while on Cloudinary, leverage the parameters in its Angular video component.

First, install the Cloudinary SDK for your Angular version. Type this NPM command:

Copy to clipboard
npm install cloudinary-core @cloudinary/angular-5.x --save

Afterwards, import from the SDK the <cl-video> component, which places in your app an HTML 5 video player. That player plays videos—whether in webm, ogv, or mp4 format—without a glitch on all major web browsers.

Note
AngularJS 1.x developers: You can obtain the <cl-video> component by typing this Bower command line:

Copy to clipboard
bower install cloudinary_ng#1.x --save

You can now transform and manipulate videos with no need for a dedicated server. Read on for the specific tasks and their related procedures.

Transcoding Video Formats

The format parameter takes one of these three values: webm, ogv, and mp4.

For example, to transcode the existing format of an Angular video called cat to the webm format, code as follows:

Copy to clipboard
<cl-video public-id="cat" format="webm">

</cl-video>

Concatenating Angular Videos

To concatenate multiple Angular videos by overlaying one on top of another, specify the related values for the overlay parameter for the <cl-video> and <cl-transformation> components. For example:

Copy to clipboard
<cl-video public-id="footballer" >
  <cl-transformation width="400" height="250" crop="fill">
  </cl-transformation>
  <cl-transformation overlay="video:ball" flags="splice" width="300" height="200" crop="fill">
  </cl-transformation>
</cl-video>

Adjusting Video Quality

The quality parameter takes any value between 0 and 100. The lower the value, the smaller the video size. By specifying a value for quality, you set the level of quality you desire for the video size at delivery.

For example:

Copy to clipboard
<cl-video public-id="drink" >
  <cl-transformation quality="60">
  </cl-transformation>
</cl-video>

Controlling the Playback Speed

While playing videos, users often accelerate or reduce the playback speed to accommodate various scenarios. For example, to watch as many course videos offered by a time-limited subscription as possible, a user might choose to skim through some of them.

To enable control of playback speed, specify a value of between -50 and 100 for the accelerate attribute in the effect parameter.

Note
That value applies to both acceleration and deceleration. For example:

Copy to clipboard
<cl-video public-id="dog" >
  <cl-transformation width="300" effect="accelerate:100" crop="scale">
  </cl-transformation>
</cl-video>

Generating Video Previews With AI

AI automatically identifies the appealing excerpts of a video and generates a preview version of the duration that you specify. Code as follows:

Copy to clipboard
<cl-video public-id="afcon" >
  <cl-transformation effect="preview:duration_10">
  </cl-transformation>
</cl-video>

The value 10 above denotes 10 minutes. You can specify any value between [?] and [?].

Note
This feature, currently in Beta, truly rocks! Do take a spin with it. You’ll be awed.

Adding Captions and Subtitles

To add a caption to a video, specify the caption’s font type, font size, wording, and such for the text attribute in the overlay parameter. Here is a self-explanatory code example:

Copy to clipboard
<cl-video public-id="dog" >
  <cl-transformation overlay="text:arial_60:Angular%20Video" gravity="south" y="80" start-offset="2" end-offset="5">
  </cl-transformation>
</cl-video>

As soon as that video called dog starts playing, its text caption, Angular Video, is displayed.

To add subtitles to a video as an overlay, specify in the overlay parameter the font type and size that you desire along with the name of the related SRT file. For example:

Copy to clipboard
<cl-video public-id="cat" >
  <cl-transformation overlay="subtitles:arial_20:sample_sub_en.srt">
  </cl-transformation>
</cl-video>

Reminder: Be sure to upload the SRT.srt file to Cloudinary first.

For other transformations you can apply to Angular videos, see the related documentation.

Browsing Other References

The following Cloudinary documentation contains many nuances that are worth a look:


Further Reading on Video Manipulation

Recent Blog Posts

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more