Created
September 4, 2020 19:03
-
-
Save teezzan/d8ee470f6dfc4f6ff2bad95e4e83e9ad to your computer and use it in GitHub Desktop.
Add Text to Video Using Nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ffmpeg = require('fluent-ffmpeg'); | |
var axios = require('axios'); | |
// make sure you set the correct path to your video file | |
var proc = ffmpeg('./input.mp4') | |
.videoFilters({ | |
filter: 'drawtext', | |
options: { | |
fontfile:'font.ttf', | |
text: 'THIS IS TEXT', | |
fontsize: 20, | |
fontcolor: 'white', | |
x: '(main_w/2-text_w/2)', | |
y: 50, | |
shadowcolor: 'black', | |
shadowx: 2, | |
shadowy: 2 | |
} | |
}) | |
.input('https://verse.mp3quran.net/arabic/shaik_abu_baker_alshatri/64/001002.mp3') | |
.on('end', function () { | |
console.log('file has been converted succesfully'); | |
}) | |
.on('error', function (err) { | |
console.log('an error happened: ' + err.message); | |
}) | |
// save to file | |
.save('./out.mp4'); |
I've tried, and always fail even being helped with GPT, and EVEN GPT CANNOT DO THAT, but with this, it works 🤣
thank yoou!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That works!
Now, how can we draw two paragraphs, one after the other? I'm trying to chain two "drawtext" filters, but the latter one overwrites the first one.