How to use a watch folder for video enconding

Video encoding for web is common task that requires some technical knowledge to be well performed. Moreover, it has several consecuences over the web performance, demanding a right automation of the process.

Now, using the Abraia gulp plugin it is easy to configure a watch folder and get all your videos optimized every time you add a new one to the folder. You just need to follow the guide bellow to perfectly optimize your videos without freezing your computer (a new task performs in the cloud). Moreover, you are not going to worry about the encoding parametrization because Abraia provides the best encoding settings for every major web format (MP4, WEBM, HEVC, HLS).

Abraia gulp plugin installarion

You need to have Node installed in your system. Once installed, you need to create a project directory to configure the watch folder.

Create a project folder and open a terminal inside it. Then start the project and install the gulp plugin:

npm init -y
npm install gulp gulp-abraia --save-dev

Get your free API key from the settings tab in the Abraia web console.

Video enconding configuration

Create a the gulpfile.js file and add the configuration bellow to start watching the videos folder. Every time you add a video to the watch folder, an encoding task is launched on the cloud. Remember to configure your API key at the start of the gulpfile.js.

process.env.ABRAIA_KEY='your_api_key'

const gulp = require('gulp')
const abraia = require('gulp-abraia')

gulp.task('variants', () => {
  return gulp.src('videos/*')
    .pipe(abraia([
      { height: 720, output: '{name}-720p.mp4' },
      { height: 720, output: '{name}-720p.webm' }
    ]))
    .pipe(gulp.dest('output'))
})

gulp.task('watch', () => {
  gulp.watch('videos/*', gulp.series('variants'))
})

You can easily generate perfectly optimized short videos in different formats and sizes, including padding and cropping options, and even overlay images and text (e.g. watermarking).

To get your configuration, use the Abraia console and download the variants configuration from the bulk tool. Then, just use the donwloaded configuration to update your waching folder.

gulp watch

Remember that Abraia only works with short videos (up to 5 minutes) with an initial maximum size of 100MB. We are focus on ecommerce, marketing, social media video formats.