Skip to content

Commit

Permalink
Update video conversion settings
Browse files Browse the repository at this point in the history
  • Loading branch information
infinitel8p committed Nov 13, 2023
1 parent ec5df27 commit 1639c07
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const server = http.createServer(app);
const wss = new WebSocket.Server({ server });

let clients = {};
const recordingsPath = './public/recordings'

// Handle WebSocket connection
wss.on('connection', function connection(ws) {
Expand Down Expand Up @@ -67,7 +68,7 @@ function broadcastData(data, senderWs) {

function convertToMp4(inputPath, outputPath) {
return new Promise((resolve, reject) => {
const command = `ffmpeg -i "${inputPath}" -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k "${outputPath}"`;
const command = `ffmpeg -i "${inputPath}" -c:v libx264 -preset ultrafast -crf 22 -c:a aac -b:a 128k "${outputPath}"`;

exec(command, (error, stdout, stderr) => {
if (error) {
Expand All @@ -89,6 +90,7 @@ function convertToMp4(inputPath, outputPath) {
}



function convertAllH264ToMp4(directory) {
fs.readdir(directory, (err, files) => {
if (err) {
Expand Down Expand Up @@ -117,7 +119,6 @@ convertAllH264ToMp4('./public/recordings');

// endpoint to get list of video files on server
app.get('/video-list', (req, res) => {
const recordingsPath = './public/recordings'
convertAllH264ToMp4(recordingsPath);
fs.readdir(recordingsPath, (err, files) => {
if (err) {
Expand Down

0 comments on commit 1639c07

Please sign in to comment.