Skip to content

Commit b2b4d25

Browse files
committed
Update: making transcoder efficient and faster
1 parent 47fd651 commit b2b4d25

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Utils/ffmpeg.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ const transcodeWithFFmpeg = async (fileName: string, filePath: string, progressC
116116
"-hls_time 4",// partition 4 seconds 15 parts
117117
"-hls_list_size 0",
118118
"-master_pl_name master.m3u8",
119+
`-threads 1`, // Limit threads
120+
`-preset ultrafast`, // Fastest encoding
121+
`-maxrate ${videoBitrate}`, // Constrain bitrate
122+
`-bufsize ${parseInt(videoBitrate)/2}`, // Small buffer
119123
])// check out
120124
.output(`${directoryPath}/${outputFileName}`)
121125
.on("end", (stdout, stderr) => {

0 commit comments

Comments
 (0)