rdp / screen-capture-recorder-to-video-windows-free

a free open source windows "screen capture" device and recorder (also allows VLC/ffmpeg and others to capture/stream desktop/audio)
https://github.com/rdp/screen-capture-recorder-to-video-windows-free/releases
Other
2.09k stars 458 forks source link

Error when starting from Python as subprocess #105

Closed mnifakram closed 6 years ago

mnifakram commented 6 years ago

It work well when recording from terminal, but it give me this error when starting from python script

Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1518206490.702120, bitrate: 1691761 kb/s
    Stream #0:0: Video: bmp, bgra, 1680x1050, 1691761 kb/s, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
[dshow @ 000001a8ec9ac4e0] Could not find audio only device with name ["virtual-audio-capturer"] among source devices of type audio.
[dshow @ 000001a8ec9ac4e0] Searching for audio device within video devices for "virtual-audio-capturer"
[dshow @ 000001a8ec9ac4e0] Could not find audio only device with name ["virtual-audio-capturer"] among source devices of type video.
audio="virtual-audio-capturer": I/O error
return subprocess.Popen([
        'ffmpeg',
        # Video
        '-f', 'gdigrab', '-i', 'desktop',

        # Video + Audio
        '-f', 'dshow', '-i',
        'audio="virtual-audio-capturer"',
        '-y', filename
    ], shell=False)

Any idea?

rdp commented 6 years ago

Is it calling the "right" kind of ffmpeg (32 vs 64 bit). Also what if you just run ffmpeg -list_devices true -f dshow -i dummy

On Fri, Feb 9, 2018 at 1:24 PM, mnifakram notifications@github.com wrote:

It work well when recording from terminal, but it give me this error when starting from python script

Input #0, gdigrab, from 'desktop': Duration: N/A, start: 1518206490.702120, bitrate: 1691761 kb/s Stream #0:0: Video: bmp, bgra, 1680x1050, 1691761 kb/s, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc [dshow @ 000001a8ec9ac4e0] Could not find audio only device with name ["virtual-audio-capturer"] among source devices of type audio. [dshow @ 000001a8ec9ac4e0] Searching for audio device within video devices for "virtual-audio-capturer" [dshow @ 000001a8ec9ac4e0] Could not find audio only device with name ["virtual-audio-capturer"] among source devices of type video. audio="virtual-audio-capturer": I/O error

return subprocess.Popen([ 'ffmpeg',

Video

    '-f', 'gdigrab', '-i', 'desktop',

    # Video + Audio
    '-f', 'dshow', '-i',
    'audio="virtual-audio-capturer"',
    '-y', filename
], shell=False)

Any idea?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/105, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAw0Obq9SRCbtIkXVtGVgaxLawRKoUQks5tTKl1gaJpZM4SAe-8 .

mnifakram commented 6 years ago

it's calling the right ffmpeg and listing the devices shows both audio and video devices. Also running it directly from the terminal works well. It's just a matter of running it from Python script.

rdp commented 6 years ago

what is the output if you say -loglevel verbose?

On Sat, Feb 10, 2018 at 9:27 AM, mnifakram notifications@github.com wrote:

it's calling the right ffmpeg and listing the devices shows both audio and video devices. Also running it directly from the terminal works well. It's just a matter of running it from Python script.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/105#issuecomment-364668181, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAw0BS7uVDU70xyGFTH7cWccQKq4et7ks5tTcN4gaJpZM4SAe-8 .

mnifakram commented 6 years ago
[gdigrab @ 0000012bb8d8a2c0] Capturing whole desktop as 1680x1050x32 at (0,0)
[gdigrab @ 0000012bb8d8a2c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1518484810.636775, bitrate: 1691761 kb/s
    Stream #0:0: Video: bmp, 1 reference frame, bgra, 1680x1050, 1691761 kb/s, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
[dshow @ 0000012bb8d8c560] Could not find audio only device with name ["virtual-audio-capturer"] among source devices of type audio.
[dshow @ 0000012bb8d8c560] Searching for audio device within video devices for "virtual-audio-capturer"
[dshow @ 0000012bb8d8c560] Could not find audio only device with name ["virtual-audio-capturer"] among source devices of type video.
audio="virtual-audio-capturer": I/O error

the same output!!!

rdp commented 6 years ago

what about list devices from within python?

mnifakram commented 6 years ago

They do exist both 😞

Here's a test script if you have a few minutes to check it.

import subprocess

#subprocess.Popen(['ffmpeg', '-list_devices', 'true', '-f', 'dshow', '-i', 'dummy'], shell=False)

subprocess.Popen([
    'ffmpeg',
    # Video
    '-f', 'gdigrab', '-i', 'desktop',

    # Video + Audio
    '-f', 'dshow', '-i',
    'audio="virtual-audio-capturer"',
    # '-framerate', f'{frame_rate}',

    # Output - raw / 0 compression
    '-vcodec', 'libx264',
    '-preset', 'ultrafast', '-qp', '0', '-pix_fmt', 'yuv444p',
    # overwrite the file if it exists
    #'-loglevel', 'verbose',
    '-y', 'test.mkv'
], shell=False)
mnifakram commented 6 years ago

Not sure if this could help you but running it in the main process worked.

import os

os.system('ffmpeg -f gdigrab -i desktop -f dshow -i audio="virtual-audio-capturer" -y test.mkv')
rdp commented 6 years ago

what if remove quotes around virtual-audio-capturer?

mnifakram commented 6 years ago

Removing the quotes does the job. Thank you so much