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 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'); |
@Heinrich-Visualization check this out: https://stackoverflow.com/a/50749822/21420
how can we customize font family?
I got solution instead of font-family use font:"Comic Sans MS" etc for font customization
can you tell us how to add text at some seconds,, if possible
You can use option enable in options as : enable:"between(t,5,7)"
you can have any value here I have used 5 and 7 to enable text between 5 to 7 seconds of the video
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you tell us how to add text at some seconds,, if possible