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.06k stars 456 forks source link

Unable to use dshow devices with gdigrab/ddagrab anymore #176

Closed Jaex closed 10 months ago

Jaex commented 11 months ago

Hi, I was using your dshow devices together with other devices successfully for long time but after update FFmpeg to 6.0 which is needed for ddagrab support. I cannot use dshow with gdigrab or ddagrab anymore. I thought you may have idea about what could be wrong, thanks.

Example reproduce arguments:

ffmpeg -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size 1920x1080 -draw_mouse 1 -i desktop -f dshow -i audio="virtual-audio-capturer" -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -b:v 3000k -c:a aac -ac 2 -b:a 128k -y "output.mp4"

These arguments works fine with FFmpeg 5.1 or older versions but fails with FFmpeg 6.0 (latest).

FFmpeg 5.1 output:

D:\ShareX\Tools>ffmpeg-5.1.exe -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size 1920x1080 -draw_mouse 1 -i desktop -f dshow -i audio="virtual-audio-capturer" -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -b:v 3000k -c:a aac -ac 2 -b:a 128k -y "output.mp4"
ffmpeg version n5.1.1-3-gfcbd9ec248-20220911 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --disable-doc --disable-ffplay --disable-ffprobe --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220911
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[gdigrab @ 000002077a9533c0] Capturing whole desktop as 1920x1080x32 at (0,0)
[gdigrab @ 000002077a9533c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1690663149.503828, bitrate: 1990668 kb/s
  Stream #0:0: Video: bmp, bgra, 1920x1080, 1990668 kb/s, 30 fps, 1000k tbr, 1000k tbn
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, dshow, from 'audio=virtual-audio-capturer':
  Duration: N/A, start: 8391.326000, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 000002077a95fb00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 000002077a95fb00] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 @ 000002077a95fb00] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - 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=12 sliced_threads=1 slices=12 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=abr mbtree=0 bitrate=3000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1920x1080, q=2-31, 3000 kb/s, 30 fps, 15360 tbn
    Metadata:
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/3000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc59.37.100 aac
[gdigrab @ 000002077a9533c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=  151 fps= 30 q=29.0 size=    1536kB time=00:00:05.03 bitrate=2497.8kbits/s dup=13 drop=0 speed=0.988x

[q] command received. Exiting.

frame=  162 fps= 30 q=30.0 Lsize=    1668kB time=00:00:05.40 bitrate=2530.6kbits/s dup=14 drop=0 speed=0.987x
video:1576kB audio:84kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.463305%
[libx264 @ 000002077a95fb00] frame I:1     Avg QP:36.00  size:149461
[libx264 @ 000002077a95fb00] frame P:161   Avg QP:34.01  size:  9092
[libx264 @ 000002077a95fb00] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 000002077a95fb00] mb P  I16..4:  5.8%  0.0%  0.0%  P16..4:  7.4%  0.0%  0.0%  0.0%  0.0%    skip:86.8%
[libx264 @ 000002077a95fb00] final ratefactor: 34.18
[libx264 @ 000002077a95fb00] coded y,u,v intra: 18.7% 0.4% 0.5% inter: 3.2% 0.1% 0.2%
[libx264 @ 000002077a95fb00] i16 v,h,dc,p: 22% 49% 15% 14%
[libx264 @ 000002077a95fb00] kb/s:2390.10
[aac @ 000002077a961740] Qavg: 301.249
Received stop event after 549 passes

Ends successfully.

FFmpeg 6.0 (latest 2023-07-29) output:

D:\ShareX\Tools>ffmpeg -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size 1920x1080 -draw_mouse 1 -i desktop -f dshow -i audio="virtual-audio-capturer" -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -b:v 3000k -c:a aac -ac 2 -b:a 128k -y "output.mp4"
ffmpeg version N-111647-g44813d66e2-20230729 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230729
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[gdigrab @ 000002490f9f79c0] Capturing whole desktop as 1920x1080x32 at (0,0)
[gdigrab @ 000002490f9f79c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1690662901.206877, bitrate: 1990668 kb/s
  Stream #0:0: Video: bmp, bgra, 1920x1080, 1990668 kb/s, 30 fps, 1000k tbr, 1000k tbn
[aist#1:0/pcm_s16le @ 000002490fa850c0] Guessed Channel Layout: stereo
Input #1, dshow, from 'audio=virtual-audio-capturer':
  Duration: N/A, start: 8143.089000, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000024913519540] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0000024913519540] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 @ 0000024913519540] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - 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=12 sliced_threads=1 slices=12 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=abr mbtree=0 bitrate=3000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv444p(tv, progressive), 1920x1080, q=2-31, 3000 kb/s, 30 fps, 15360 tbn
    Metadata:
      encoder         : Lavc60.22.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/3000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.22.100 aac
[in#0/gdigrab @ 000002490f9e1100] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=  155 fps= 30 q=27.0 size=    1280kB time=00:00:05.13 bitrate=2042.8kbits/s dup=9 drop=1 speed=0.999x

[q] command received. Exiting.

[out#0/mp4 @ 00000249134b8500] video:1602kB audio:88kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.471089%
frame=  170 fps= 30 q=27.0 Lsize=    1698kB time=00:00:05.63 bitrate=2469.6kbits/s dup=9 drop=1 speed=   1x
[libx264 @ 0000024913519540] frame I:1     Avg QP:37.00  size:148077
[libx264 @ 0000024913519540] frame P:169   Avg QP:31.89  size:  8829
[libx264 @ 0000024913519540] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0000024913519540] mb P  I16..4:  1.8%  0.0%  0.0%  P16..4: 11.5%  0.0%  0.0%  0.0%  0.0%    skip:86.6%
[libx264 @ 0000024913519540] final ratefactor: 33.52
[libx264 @ 0000024913519540] coded y,u,v intra: 19.9% 2.2% 2.9% inter: 4.2% 0.3% 0.5%
[libx264 @ 0000024913519540] i16 v,h,dc,p: 29% 46% 18%  8%
[libx264 @ 0000024913519540] kb/s:2315.60
[aac @ 00000249132b0680] Qavg: 382.249
Received stop event after 563 passes
Conversion failed!

Ends with Conversion failed! error.

Jaex commented 11 months ago

I created ticket at FFmpeg Trac now: https://trac.ffmpeg.org/ticket/10504

rdp commented 10 months ago

Is this from the command line or gui?

On Fri, Aug 4, 2023 at 6:33 PM Jaex @.***> wrote:

I created ticket at FFmpeg Trac now: https://trac.ffmpeg.org/ticket/10504

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1666303977, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUBSZMEEVUM75DQ7I5DXTWIFRANCNFSM6AAAAAA24W6MLY . You are receiving this because you are subscribed to this thread.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1666303977@ github.com>

Jaex commented 10 months ago

Command line.

rdp commented 10 months ago

output with -loglevel debug please?

On Thu, Aug 10, 2023 at 10:18 AM Jaex @.***> wrote:

Command line.

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1673529245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUF2ABV6GFEOXEXATMTXUUCVHANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1673529245@ github.com>

Jaex commented 10 months ago

You can use the -report option or define the FFREPORT environment variable (to any value) to get the exact command line and the full verbose console output in a file named ffmpeg-*.log in the current directory.

I used -report option in https://trac.ffmpeg.org/ticket/10504 attachments:

Is it enough or I should also use -loglevel debug option?

rdp commented 10 months ago

does it create a file?

On Sat, Aug 12, 2023 at 6:27 AM Jaex @.***> wrote:

You can use the -report option or define the FFREPORT environment variable (to any value) to get the exact command line and the full verbose console output in a file named ffmpeg-*.log in the current directory.

I used -report option in https://trac.ffmpeg.org/ticket/10504 attachments:

https://camo.githubusercontent.com/899908aade36d8523fa7b32f1d33c27abbe5787def449d90b64f23a4758e4538/68747470733a2f2f6a6165782e6765747368617265782e636f6d2f323032332f30382f6368726f6d655f367a38506562784f61352e706e67

Is it enough or I should also use -loglevel debug option?

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1675889583, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUBXCLURKGDKMBYJT7LXU5ZBPANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1675889583@ github.com>

Jaex commented 10 months ago

Yes, video file is playable and not corrupt.

rdp commented 10 months ago

So it is working then outputting an erroneous "Conversion Failed!" message?

On Tue, Aug 15, 2023 at 4:30 PM Jaex @.***> wrote:

Yes, video file is playable and not corrupt.

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1679712637, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUCJI4WKKR6O4I5DYHTXVPZ6LANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1679712637@ github.com>

Jaex commented 10 months ago

Yes. And because ffmpeg process exit code is not 0, my screen recording app thinks it is failed.

rdp commented 10 months ago

-loglevel debug show anything?

On Wed, Aug 16, 2023 at 8:10 AM Jaex @.***> wrote:

Yes. And because ffmpeg process exit code is not 0, my screen recording app thinks it is failed.

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1680693321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUBZCONXA2ZA6QX7FBTXVTIG5ANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1680693321@ github.com>

Jaex commented 10 months ago

-loglevel debug show anything?

I tried now, it gives same result. Looks like -report is also using "-loglevel debug".

‘verbose, 40’
Same as info, except more verbose.

‘debug, 48’
Show everything, including debugging information.

So it always shows 48.

rdp commented 10 months ago

Mine doesn't say "Conversion failed" with that command? What OS? What output when run normally?

On Fri, Aug 18, 2023 at 4:16 PM Jaex @.***> wrote:

-loglevel debug show anything?

I tried now, it gives same result. Looks like -report is also using "-loglevel debug".

https://camo.githubusercontent.com/3be6159530f74de21552082e783cd4218057562acc599879e35ad6275a795082/68747470733a2f2f6a6165782e6765747368617265782e636f6d2f323032332f30382f6368726f6d655f3778656b6452316572302e706e67

‘verbose, 40’ Same as info, except more verbose.

‘debug, 48’ Show everything, including debugging information.

So it always shows 48.

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1684486699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUDN6MN4Y6KXH6GHOADXV7STBANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1684486699@ github.com>

Jaex commented 10 months ago

Windows 10 64 bit 22H2.

First post includes normal output from cmd without debug: https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issue-1827656017

Jaex commented 10 months ago

Mine doesn't say "Conversion failed" with that command?

Are you testing with latest master build? Because it works fine with old FFmpeg builds. Only failing in latest FFmpeg builds.

rdp commented 9 months ago

What happened? :)

On Wed, Sep 6, 2023 at 4:43 PM Jaex @.***> wrote:

Closed #176 https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176 as completed.

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#event-10301152290, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUH3F6APHU6YMZTDTTLXZD4CDANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issue/176/issue_event/10301152290 @github.com>

Jaex commented 9 months ago

What happened? :)

It is fixed: https://trac.ffmpeg.org/ticket/10504#comment:5

rdp commented 9 months ago

Nice!

On Tue, Sep 19, 2023 at 10:49 PM Jaex @.***> wrote:

What happened? :)

It is fixed: https://trac.ffmpeg.org/ticket/10504#comment:5

— Reply to this email directly, view it on GitHub https://github.com/rdp/screen-capture-recorder-to-video-windows-free/issues/176#issuecomment-1726962772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUAXKXNIUP6QZ2ALP5TX3JYTXANCNFSM6AAAAAA24W6MLY . You are receiving this because you commented.Message ID: <rdp/screen-capture-recorder-to-video-windows-free/issues/176/1726962772@ github.com>