Skip to content

Commit 926c1cf

Browse files
Format args arrays (again)
1 parent 2725a38 commit 926c1cf

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

server/aws/s3ThumbnailGenerator.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ async function checkFileExists(inputURL) {
4949
}
5050

5151
function doGenerateStreamThumbnail({Bucket, Key, inputURL}) {
52-
const args = ['-i', inputURL,
53-
'-ss', '00:00:01',
54-
'-vframes', '1',
55-
'-vf', "scale=w=1280:h=720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2",
56-
'-c:v', 'png',
57-
'-f', 'image2pipe',
58-
'-'];
59-
6052
return new Promise((resolve, reject) => {
53+
const args = [
54+
'-i', inputURL,
55+
'-ss', '00:00:01',
56+
'-vframes', '1',
57+
'-vf', "scale=w=1280:h=720:force_original_aspect_ratio=1,pad=1280:720:(ow-iw)/2:(oh-ih)/2",
58+
'-c:v', 'png',
59+
'-f', 'image2pipe',
60+
'-'
61+
];
62+
6163
const ffmpeg = spawn(process.env.FFMPEG_PATH, args);
6264
ffmpeg.stderr.on('data', data => {
6365
LOGGER.debug('stderr: {}', data);

server/aws/s3VideoUploader.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ const S3_CLIENT = new S3Client({});
99
exports.uploadVideoToS3 = ({inputURL, Bucket, Key}) => {
1010
return new Promise((resolve, reject) => {
1111
const outputURL = inputURL.replace('.mp4', '-final.mp4');
12-
const args = ['-i', inputURL, '-c:a', 'copy', '-c:v', 'copy', '-movflags', 'faststart', outputURL];
12+
const args = [
13+
'-i', inputURL,
14+
'-c:a', 'copy',
15+
'-c:v', 'copy',
16+
'-movflags', 'faststart',
17+
outputURL
18+
];
19+
1320
const ffmpeg = spawn(process.env.FFMPEG_PATH, args);
1421
ffmpeg.stderr.on('data', data => {
1522
LOGGER.debug('stderr: {}', data)

server/cron/streamScheduler.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,16 @@ function startStreamFromPrerecordedVideo({startTime, inputURL, streamKey}) {
136136
if (startMillis > 0) {
137137
args.push('-ss', `${startMillis}ms`);
138138
}
139-
args.push('-i', inputURL,
139+
args.push(
140+
'-i', inputURL,
140141
'-c:v', 'copy',
141142
'-c:a', 'copy',
142143
'-f', 'tee',
143144
'-map', '0:a?',
144145
'-map', '0:v?',
145146
'-f', 'flv',
146-
`${RTMP_SERVER_URL}/${streamKey}`);
147+
`${RTMP_SERVER_URL}/${streamKey}`
148+
);
147149

148150
mainroomEventBus.once(`streamStarted_${streamKey}`, resolve);
149151

server/mediaServer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,14 @@ async function deleteFile(filePath) {
308308
}
309309

310310
function getVideoDurationString(inputURL) {
311-
const args = ['-show_entries', 'format=duration',
312-
'-of', 'default=noprint_wrappers=1:nokey=1',
313-
'-sexagesimal',
314-
inputURL];
315-
316311
return new Promise((resolve, reject) => {
312+
const args = [
313+
'-show_entries', 'format=duration',
314+
'-of', 'default=noprint_wrappers=1:nokey=1',
315+
'-sexagesimal',
316+
inputURL
317+
];
318+
317319
const ffprobe = spawn(process.env.FFPROBE_PATH, args);
318320
ffprobe.on('error', err => {
319321
LOGGER.error('An error occurred when getting video file duration for {}: {}', inputURL, err.stack || err.toString());

0 commit comments

Comments
 (0)