Skip to content

Commit 75a1f13

Browse files
committed
feat: support changing the h264 tune
1 parent 50f6ea0 commit 75a1f13

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ For instance if you plan on streaming to Twitch, set the OUTPUT to something lik
4949
`OUTPUT` is the output file/stream. Can either start with `rtmp://`, `gs://` or end with `.mp4`. Defaults to `output.mp4`
5050
`RATE` is the constant bitrate (CBR) used for the video. Defaults to `6000`
5151
`RESOLUTION` is the resolution of the video. Defaults to `1280x720`
52+
`TUNE` is the FFmpeg libx264 [tune setting](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). Defaults to `zerolatency`
5253
`URL` is the webpage to record. Required.
5354

5455
# Contributing

Diff for: src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { durationToFFmpegParams } from './ffmpeg'
88
const disableAudio = process.env.DISABLE_AUDIO === 'true'
99
const fps = process.env.FPS || 30
1010
const rate = process.env.RATE || 6000
11+
const tune = process.env.TUNE || 'zerolatency'
1112
const resolution = process.env.RESOLUTION
1213
const url = process.env.URL
1314

@@ -80,7 +81,7 @@ async function main() {
8081
`ffmpeg -y -loglevel error -hide_banner -async 1 -nostdin -s ${resolution} -r ${fps} -draw_mouse 0
8182
-f x11grab -i $DISPLAY
8283
-f pulse -ac 2 -i default
83-
-c:v libx264 -preset veryfast -tune zerolatency -b:v ${rate}k -minrate ${rate}k -maxrate ${rate}k -g 30
84+
-c:v libx264 -preset veryfast -tune ${tune} -b:v ${rate}k -minrate ${rate}k -maxrate ${rate}k -g 30
8485
${audioConfig}
8586
-ss 00:00:03 ${ffmpegDurationParams} -pix_fmt yuv420p ${exporter.getFFmpegOutputParams()}`.replaceAll(
8687
/[\n\r\s]+/gm,

0 commit comments

Comments
 (0)