NodeJS, FFmpeg: Generic server to transform video

We will implement the NodeJS video service that allows us to transform videos using declarative instructions (scale, crop, horizontally flip, and put different overlays beneath the video)

Vladimir Topolev
Numatic Ventures

--

We have already implemented the API shape and TypeScript declarations that will be used in this article. For more details, please refer to this article. Briefly, the JSON request should look like this:

{
"composition": {
"type": "video",
"path": "path to video resource",
"start": "00:00:05",
"length": "00:00:10",
"operations": [
{
"type": "crop",
"width": 200,
"height": 300
},
{
"type": "horizintalFlip"
},
{
"type": "scale",
"width": 200,
"height": -1
}
],
"overlays": [
{
"type": "image",
"path": "path to logo resource"
},
{
"type": "text",
"text": "Hello",
"x": 54,
"y": 300
}
]
}
}

In this article, we will discuss how to implement an API using NodeJS and the FFmpeg framework. You can check out the final result at any time during the reading of the article by clicking on the following repository link. Each…

--

--

Vladimir Topolev
Numatic Ventures

Addicted Fullstack JS engineer. Love ReactJS and everything related to animation