-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,25 +130,28 @@ ffmpeg -re -i example.mp4 -c copy -f flv rtmp://localhost/live/stream | |
|
||
```bash= | ||
ffmpeg \ | ||
-framerate 5 \ | ||
-video_size 960x720 \ | ||
-i /dev/video0 \ | ||
-vcodec libx264 \ | ||
-preset veryfast \ | ||
-f flv rtmp://localhost/live/stream | ||
-b 8M \ | ||
-vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: \ | ||
text='%{localtime\:%T}': [email protected]: x=7: y=700" \ | ||
-f flv rtmp://localhost/live/stream; | ||
``` | ||
|
||
**Use USB Camera on macOS** | ||
|
||
```bash= | ||
ffmpeg \ | ||
-f avfoundation \ | ||
-framerate 30 \ | ||
-re -i 0 \ | ||
-r 5 \ | ||
-framerate 5 \ | ||
-i 0 \ | ||
-vcodec libx264 \ | ||
-preset ultrafast \ | ||
-acodec aac \ | ||
-ac 0 \ | ||
-g 25 \ | ||
-preset veryfast \ | ||
-vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: \ | ||
text='%{localtime\:%T}': [email protected]: x=7: y=700" \ | ||
-f flv rtmp://localhost/live/stream | ||
``` | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,21 +15,24 @@ const config = { | |
}; | ||
|
||
new MediaServer(process.env.LIVE_PRIVATE_KEY).run(); | ||
(async () => { | ||
|
||
const deamon = async (command) => { | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
// eslint-disable-next-line no-await-in-loop | ||
try { | ||
// eslint-disable-next-line no-await-in-loop | ||
await exec( | ||
'ffmpeg -i /dev/video0 -vcodec libx264 -preset veryfast -f flv rtmp://localhost/live/stream', | ||
); | ||
await exec(command); | ||
} catch (e) { | ||
console.error(e); | ||
break; | ||
} | ||
} | ||
})(); | ||
}; | ||
|
||
deamon( | ||
// eslint-disable-next-line no-useless-escape | ||
'ffmpeg -framerate 5 -video_size 960x720 -i /dev/video0 -vcodec libx264 -preset veryfast -b 8M -vf "drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: text="%{localtime:%T}": [email protected]: x=7: y=700" -f flv rtmp://localhost/live/stream', | ||
); | ||
deamon('ffmpeg -y -i rtmp://localhost/live/stream -r 0.1 -f image2 -updatefirst 1 capture.jpg'); | ||
|
||
ngrok | ||
.run(process.env.NGROK_TOKEN) | ||
|
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