From 5fee511315f1c89c70b7a2b4e2c8428f979143f6 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 20 Sep 2022 20:25:48 +0200 Subject: [PATCH] Add device pick --- record.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/record.ts b/record.ts index 370c302..ca46fcd 100755 --- a/record.ts +++ b/record.ts @@ -15,6 +15,11 @@ function sleep(time: number) { } void (async function () { + const pick_device = + await $`ls -1 /dev/video* | xargs -I {} bash -c "v4l2-ctl --device {} --info | grep --extended-regexp \\"(Model|Card type)\\" | awk -F: '{print \\$2}' | awk '{print \"{}\" \",\" \\$0}' | tr , '\n'" | zenity --list --column=device --column=name`; + + const dev = `/dev/video${pick_device.stdout.split(" ")[0]}`; + const source = spawn("ffmpeg", [ "-f", "video4linux2", @@ -25,7 +30,7 @@ void (async function () { "-video_size", "3840x2160", "-i", - "/dev/video2", + dev, "-f", "nut", "-c",