Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find screen recording device #24

Open
pjc1288 opened this issue May 15, 2021 · 14 comments
Open

Cannot find screen recording device #24

pjc1288 opened this issue May 15, 2021 · 14 comments

Comments

@pjc1288
Copy link

pjc1288 commented May 15, 2021

Hello,

FIrst of all thank you for your work.

I receive this message when I press the button to record 'Cannot find screen recording device'

I have installed ffmpeg but i dont know what to do.

Best

@arciisine
Copy link
Owner

Operating system would be really helpful. And how did you install ffmpet? The plugin supports auto installing it for you so it could also be using a different version potentially.

The easiest way to debug is to get a CLI command that reproduces the issue to help narrow it down.

@arciisine
Copy link
Owner

@pjc1288 Wanted to follow up if you were able to find any more information about the issue?

@arciisine
Copy link
Owner

@pjc1288 If you can, please run npx @arcsine/screen-recorder test.mp4 from the command line, and the output should help identify the problem.

@willgarcia
Copy link

willgarcia commented Aug 1, 2021

Same issue as @pjc1288

@arciisine This is the output on Mac M1 after running a brew install ffmpeg + npx @arcsine/screen-recorder test.mp4:

bash-3.2$ npx @arcsine/screen-recorder test.mp4
/usr/local/homebrew/bin/ffmpeg -f avfoundation -list_devices true -i ""
Invalid exit status: 1
/usr/local/homebrew/bin/ffmpeg -capture_cursor 1 -threads 4 -f avfoundation -i 2:none -preset ultrafast -crf 10 -pix_fmt yuvj444p -c:v libx264 -y  -vf 'scale=2560:1080:flags=lanczos,crop=2560:993:0:25' test.mp4
Recording for 5 seconds...
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.11)
  configuration: --prefix=/usr/local/homebrew/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[AVFoundation indev @ 0x7fefd0535180] Configuration of video device failed, falling back to default.
[avfoundation @ 0x7fefd0816a00] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fefd0816a00] Supported pixel formats:
[avfoundation @ 0x7fefd0816a00]   uyvy422
[avfoundation @ 0x7fefd0816a00]   yuyv422
[avfoundation @ 0x7fefd0816a00]   nv12
[avfoundation @ 0x7fefd0816a00]   0rgb
[avfoundation @ 0x7fefd0816a00]   bgr0
[avfoundation @ 0x7fefd0816a00] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7fefd0816a00] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '2:none':
  Duration: N/A, start: 119449.999000, bitrate: N/A
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 2560x1080, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0x7fefc0008000] deprecated pixel format used, make sure you did set range correctly
[mp4 @ 0x7fefd4815000] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 @ 0x7fefd083c200] MB rate (10080000000) > level limit (16711680)
[libx264 @ 0x7fefd083c200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x7fefd083c200] profile High 4:4:4 Predictive, level 6.2, 4:4:4, 8-bit
[libx264 @ 0x7fefd083c200] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=10.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuvj444p(pc, progressive), 2560x993, q=2-31, 1000k fps, 1000k tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
More than 1000 frames duplicated
Done

Notes:

  • the first time the npx script is executed, MacOS asks to allow "Screen Recording" for VSCode in the "Security & Privacy" settings.
  • the npx script hangs even if it shows "Done" at the end. Pressing "q" also does not stop the script
  • the generated test.mp4 file has a size of 60Mb but QuickTime can't open it (message: The file isn’t compatible with QuickTime Player)

@arciisine
Copy link
Owner

arciisine commented Aug 1, 2021

Thanks @willgarcia. Looking at this there are a few things:

First (and primarily),

/usr/local/homebrew/bin/ffmpeg -f avfoundation -list_devices true -i ""
Invalid exit status: 1

is somewhat concerning. I don't have access to an M1 Mac, but I have run ffmpeg with the latest OSX version and don't recall having seen this issue. If you are able to run the command directly

/usr/local/homebrew/bin/ffmpeg -f avfoundation -list_devices true -i ""

and post the output, that would be fantastic.

Second, the ffmpeg behavior of not honoring q is most likely tied to how the program is launched (and specifically the stdin stream is most likely not connected). It is not usually used in a method of interactive behavior like this, so that was not the inteded experience. Something to try is invoking the command manually (outside of the library) and see what happens:

/usr/local/homebrew/bin/ffmpeg -capture_cursor 1 -threads 4 -f avfoundation -i 2:none -preset ultrafast -crf 10 -pix_fmt yuvj444p -c:v libx264 -y  -vf 'scale=2560:1080:flags=lanczos,crop=2560:993:0:25' test.mp4

Lastly, QuickTime is weird in what it considers to be a valid mp4 output. FFmpeg/VLC/Chrome/Windows Media all understand the outputted file, the issue is that QuickTime for some reason does not. I have a placeholder issue (#5) that allows for making a quicktime compatible mp4, but at the cost of the reduced color space (the image looks washed out mainly). When converting the final output to an animated GIF, this issue is entirely mitigated.

@willgarcia
Copy link

Thanks @arciisine

A few more logs to troubleshoot:

bash-3.2$ /usr/local/homebrew/bin/ffmpeg -f avfoundation -list_devices true -i ""
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.11)
  configuration: --prefix=/usr/local/homebrew/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[AVFoundation indev @ 0x7fa52862d380] AVFoundation video devices:
[AVFoundation indev @ 0x7fa52862d380] [0] FaceTime HD Camera
[AVFoundation indev @ 0x7fa52862d380] [1] Capture screen 0
[AVFoundation indev @ 0x7fa52862d380] AVFoundation audio devices:
[AVFoundation indev @ 0x7fa52862d380] [0] MacBook Pro Microphone
: Input/output error

and similar issue with the next command:

bash-3.2$ /usr/local/homebrew/bin/ffmpeg -capture_cursor 1 -threads 4 -f avfoundation -i 2:none -preset ultrafast -crf 10 -pix_fmt yuvj444p -c:v libx264 -y  -vf 'scale=2560:1080:flags=lanczos,crop=2560:993:0:25' test.mp4
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.5 (clang-1205.0.22.11)
  configuration: --prefix=/usr/local/homebrew/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[AVFoundation indev @ 0x7fb842d09b40] Invalid device index
2:none: Input/output error

I'll do another test to see if I reproduce on another MBP pro x86 instead of my m1 arm.

@arciisine
Copy link
Owner

arciisine commented Aug 1, 2021

Yeah the issue looks to be around the output of the first call:

[AVFoundation indev @ 0x7fa52862d380] AVFoundation video devices:
[AVFoundation indev @ 0x7fa52862d380] [0] FaceTime HD Camera
[AVFoundation indev @ 0x7fa52862d380] [1] Capture screen 0
[AVFoundation indev @ 0x7fa52862d380] AVFoundation audio devices:
[AVFoundation indev @ 0x7fa52862d380] [0] MacBook Pro Microphone

The video device, index [1] is the one we would want to pass into the subsequent call. But because first call is ending in an error, this is getting missed, and causing an issue. The first call shouldn't end in an error, but it does seem to be doing just that. Also, the library has the ability to download it's own version from a set of statically compiled binaries. It might be worth trying that as well, and seeing if its possibly a difference in the binary from brew vs the pre-existing ones.

@willgarcia
Copy link

I tried to use the pre-compiled version available here: https://github.com/arciisine/vscode-chronicler/blob/master/binaries/osx/ffmpeg and it seems to confirm the problem has to do with the screen device not being found:

bash-3.2$ npx @arcsine/screen-recorder test.mp4 
/usr/local/bin/ffmpeg -f avfoundation -list_devices true -i ""
Successfully terminated
/Users/will/.npm/_npx/c71e018737289961/node_modules/@arcsine/screen-recorder/lib/os.js:65
            throw new Error('Cannot find screen recording device');
                  ^

Error: Cannot find screen recording device
    at Function.getMacInputDevices (/Users/will/.npm/_npx/c71e018737289961/node_modules/@arcsine/screen-recorder/lib/os.js:65:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Function.getDarwinArgs (/Users/will/.npm/_npx/c71e018737289961/node_modules/@arcsine/screen-recorder/lib/ffmpeg.js:56:22)
    at async Function.startRecording (/Users/will/.npm/_npx/c71e018737289961/node_modules/@arcsine/screen-recorder/lib/ffmpeg.js:120:24)
    at async run (/Users/will/.npm/_npx/c71e018737289961/node_modules/@arcsine/screen-recorder/lib/cli.js:20:20)

@chozandrias76
Copy link

This effects me. Tunneling over SSH.

@arciisine
Copy link
Owner

@chozandrias76 When you say tunneling over ssh, do you mean you are forwarding the XSession over ssh? The scenario of using this and SSH doesn't seem to be clicking for me. Could you describe your use case in a little more depth?

@aragalie
Copy link

This issue still persists. I'm on MacOS Monterey 12.3.1

Probably something related to permissions? For me, if I download the ffmeg binary in Downloads, then it works.
But if download it somewhere else (and point to it in settings.json. of VSCode), e.g in Documents, then I get the same error "Cannot find screen recording device

@sugatoray
Copy link

sugatoray commented Dec 19, 2022

Has this been resolved? I tried with my macbook pro m1, and am getting the same error.

I added the path to PATH variable in addition to declaring the ffmpeg-executable in vscode settings. That fixed this part.

Had used brew install ffmpeg

@arciisine
Copy link
Owner

@sugatoray I don't have an M1 to test with. It looks like downloading ffmpeg via the extension is working per the comment above, have you tried that yet?

@sugatoray
Copy link

sugatoray commented Dec 19, 2022

I have tried with both brew and direct installation via Chronicler. But have not been able to make it work yet. Chronicler stays stuck as Chronicler stopping... forever, when you try stopping it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants