gst-rec
Advanced tools
Comparing version 0.0.2 to 0.0.3
46
index.js
@@ -18,3 +18,3 @@ #!/usr/bin/env node | ||
var opts = { | ||
boolean: ['ignore-config', 'show-config', 'version', 'help'], | ||
boolean: ['ignore-config', 'show-config', 'list-audio-devices', 'version', 'help'], | ||
string: [...Object.keys(recorder.opts), ...['http-port']], | ||
@@ -33,2 +33,8 @@ alias: { o: 'output', h: 'help', gstPath: 'gst-path' } | ||
if(argv['list-audio-devices']) | ||
{ | ||
var audioList = recorder.getAudioDevices(); | ||
return console.log(JSON.stringify(audioList, null, 2)); | ||
} | ||
getCmdOpts(); | ||
@@ -101,2 +107,19 @@ | ||
debug('Applied command line options'); | ||
var audioSrc = recorder.opts.audio.device; | ||
if( typeof audioSrc === 'string' | ||
&& audioSrc.substring(0, 3) === 'dev' | ||
&& Number.isInteger(parseInt(audioSrc.substring(3))) | ||
) { | ||
debug(`Searching for audio device with id: ${audioSrc}`); | ||
var audioDevices = recorder.getAudioDevices(); | ||
if(audioDevices) | ||
recorder.opts.audio.device = audioDevices.hasOwnProperty(audioSrc) ? audioDevices[audioSrc] : null; | ||
if(recorder.opts.audio.device !== null) | ||
debug(`Found audio device: ${recorder.opts.audio.device}`); | ||
else | ||
console.error('Requested audio device not found!'); | ||
} | ||
} | ||
@@ -175,16 +198,17 @@ | ||
console.log([ | ||
'', | ||
``, | ||
`gst-rec ${getVersion()}, universal screen recorder powered by GStreamer`, | ||
'Usage: gst-rec [OPTIONS]', | ||
'', | ||
'Options:', | ||
' -o, --output <mode> Set output mode: file | server | stdout (default: file)', | ||
`Usage: gst-rec [OPTIONS]`, | ||
``, | ||
`Options:`, | ||
` -o, --output <mode> Set output mode: file | server | stdout (default: file)`, | ||
` --ignore-config Do not read the user configuration in ~/${confLocation}`, | ||
` --show-config Only displays currently applied configuration and exits`, | ||
` --list-audio-devices Shows list of audio sources obtained from "pacmd" in JSON format`, | ||
` --gst-path <path> Path to gst-launch-1.0 binary (default: ${recorder.opts.gstPath})`, | ||
` --preset <name> Encoding speed preset: ultrafast | superfast (default: ${recorder.opts.preset})`, | ||
` --format <container> Used media container: matroska | mp4 (default: ${recorder.opts.format})`, | ||
' --http-port <port> Create simple http server besides GStreamer tcp server (only when output: server)', | ||
` --http-port <port> Create simple http server besides GStreamer tcp server (only when output: server)`, | ||
` --pipewire <key=value,...>`, | ||
' path=<value> Pipewire source path', | ||
` path=<value> Pipewire source path`, | ||
` --video <key=value,...>`, | ||
@@ -207,5 +231,5 @@ ` width=<value> Horizontal video resolution - ignored when scaling is disabled (default: ${recorder.opts.video.width})`, | ||
` name=<filename> Current capture filename without extension (default: ${recorder.opts.file.name} = auto-generated)`, | ||
' --version Show current app version', | ||
' -h, --help This help screen', | ||
'' | ||
` --version Show current app version`, | ||
` -h, --help This help screen`, | ||
`` | ||
].join('\n')); | ||
@@ -212,0 +236,0 @@ } |
{ | ||
"name": "gst-rec", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Universal screen recorder powered by GStreamer", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,3 +23,3 @@ # gst-rec | ||
# Change encoding preset, video container, output file location and set custom filename: | ||
gst-rec --preset ultrafast --format mp4 --file 'dir=/my/custom/with spaces/path,name=My Awesome Recording' | ||
gst-rec --preset ultrafast --format mp4 --file 'dir=/my/custom/path,name=My Awesome Recording' | ||
@@ -29,5 +29,8 @@ # Record desktop with audio from pulseaudio sink: | ||
# Record desktop and save it to `~/Videos` directory as MP4 file with AAC audio: | ||
gst-rec --audio device=alsa_output.pci-0000_00_01.1.hdmi-stereo.monitor,encoder=faac --format mp4 --file dir=~/Videos | ||
# Show list of system audio devices: | ||
gst-rec --list-audio-devices | ||
# Record to `~/Videos` directory as MP4 file with AAC audio from dev0: | ||
gst-rec --audio device=dev0,encoder=faac --format mp4 --file dir=~/Videos | ||
# Run GStreamer tcp server to allow connecting from multiple devices: | ||
@@ -49,3 +52,3 @@ gst-rec --output server --server host=127.0.0.1,port=8080 | ||
# Stream desktop with audio to Chromecast: | ||
gst-rec --audio device=alsa_output.pci-0000_00_01.1.hdmi-stereo.monitor,encoder=lamemp3enc -o - | castnow --quiet - | ||
gst-rec --audio device=dev0,encoder=lamemp3enc -o - | castnow --quiet - | ||
@@ -55,3 +58,3 @@ # Alter default configuration and display it in JSON format (can be placed in config file): | ||
# Create new config file with default vaules: | ||
# Create new config file with default values: | ||
gst-rec --ignore-config --show-config > ~/.config/gst-rec.json | ||
@@ -58,0 +61,0 @@ ``` |
12727
217
67