dec05eba / gpu-screen-recorder-issues

GPU Screen Recorder issue tracker
11 stars 0 forks source link

[BUG] Input channel layout "" is invalid or unsupported. #8

Closed YozoraWolf closed 3 months ago

YozoraWolf commented 3 months ago

Describe the bug

When starting replay I get this bug:

[hevc_nvenc @ 0x55f6e12112c0] ignoring invalid SAR: 0/0
[hevc_nvenc @ 0x55f6e24fcfc0] ignoring invalid SAR: 0/0
Warning: opus audio codec is chosen but your ffmpeg version does not support s16/flt sample format and performance might be slightly worse. You can either rebuild ffmpeg with libopus instead of the built-in opus, use the flatpak version of gpu screen recorder or record with flac audio codec instead (-ac flac). Falling back to fltp audio sample format instead.
[SWR @ 0x7fe0e8000900] Input channel layout "" is invalid or unsupported.
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized
[SWR @ 0x7fe0e8000900] Context has not been initialized

I've tried recording with no audio and the problem fixes itself, which leads me to believe this is an issue with audio (which could be or not related to ffmpeg)

To Reproduce The GPU Screen Recorder command you ran or if you used the GUI version then describe which options you used.

Just running:

gpu-screen-recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos

Expected behavior

The error should not show up, audio should be clear and correct when saving.

Screenshots

The program IS running, so I can save it but then it sounds like this:

https://github.com/dec05eba/gpu-screen-recorder-issues/assets/5296711/2c5e4a38-82ad-44f7-9368-49105f51a040

Desktop (please complete the following information):

Additional context

I've tried all codecs to no avail, this is my ffmpeg version: ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers (flatpak)

System Info:

System:
  Kernel: 5.15.0-102-generic x86_64 bits: 64 compiler: gcc v: 11.4.0
    Desktop: Cinnamon 6.0.4 tk: GTK 3.24.33 wm: muffin vt: 7 dm: LightDM 1.30.0
    Distro: Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: Dell product: Dell G15 5515 v: 1.16.0
    serial: <superuser required> Chassis: type: 10 v: 1.16.0
    serial: <superuser required>
  Mobo: Dell model: 09YV3R v: A00 serial: <superuser required> UEFI: Dell
    v: 1.16.0 date: 01/09/2024
Battery:
  ID-1: BAT1 charge: 40.6 Wh (100.0%) condition: 40.6/86.0 Wh (47.3%)
    volts: 12.0 min: 11.4 model: BYD 0x48,0x31,0x35,0x4B,0x69,0x03,0
    type: Li-ion serial: <filter> status: Full
  ID-2: hidpp_battery_2 charge: 22% condition: N/A volts: 3.7 min: N/A
    model: Logitech G915 TKL LIGHTSPEED Wireless RGB Mechanical Gaming Keyboard
    type: N/A serial: <filter> status: Discharging
CPU:
  Info: 8-core model: AMD Ryzen 7 5800H with Radeon Graphics bits: 64
    type: MT MCP smt: enabled arch: Zen 3 rev: 0 cache: L1: 512 KiB L2: 4 MiB
    L3: 16 MiB
  Speed (MHz): avg: 3399 high: 3965 min/max: 1200/3200 boost: enabled
    cores: 1: 3170 2: 3155 3: 3441 4: 3660 5: 3965 6: 3962 7: 3165 8: 3169
    9: 3435 10: 3476 11: 3605 12: 3528 13: 3169 14: 3166 15: 3162 16: 3166
    bogomips: 102208
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm

Help would be appreciated, sorry if it may not be related.

Thanks

dec05eba commented 3 months ago

I've tried all codecs to no avail

do you mean that you tried all audio codecs? what does the terminal output look like if you use -ac aac instead? the issue is because of the old ffmpeg version and it should work if you use the flatpak version (which comes with ffmpeg version 6.1), but i'll try and fix this after I install linux mint 21 when I have time. ffmpeg 4.4 requires use of old functions that cant be used in ffmpeg 6.

Old versions of ffmpeg are not tested so there could be other bugs as well.

dec05eba commented 3 months ago

I pushed a test fix to git, can you do a git pull & install and try again? I haven't been able to test it yet but if this works it saves me time having to setup another distro on my computer

YozoraWolf commented 3 months ago

do you mean that you tried all audio codecs? what does the terminal output look like if you use -ac aac instead? the issue is because of the old ffmpeg version and it should work if you use the flatpak version (which comes with ffmpeg version 6.1), but i'll try and fix this after I install linux mint 21 when I have time. ffmpeg 4.4 requires use of old functions that cant be used in ffmpeg 6.

Old versions of ffmpeg are not tested so there could be other bugs as well.

Thank you for the support!

with aac it outputs:

gpu-screen-recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac aac -k hevc -c mp4 -r 60 -o /home/wolf/Videos
[hevc_nvenc @ 0x5638876ff5c0] ignoring invalid SAR: 0/0
[SWR @ 0x7fbb68000900] Input channel layout "" is invalid or unsupported.
[SWR @ 0x7fbb68000900] Context has not been initialized
[aac @ 0x563887cd2340] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x563887cd2340] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x563887cd2340] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x563887cd2340] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x563887cd2340] Input contains (near) NaN/+-Inf

I see, I did install the flatpak version from the Software Manager, however I did try to install the latest build manually. (I tried upgrading to latest version to see if it was a version bug, but I had another error with I totally forgot about, it was like a week ago)

Flatpak version seems to be 7:4.4.2-0ubuntu0.22.04.1 . I'll try to reinstall ffmpeg to see if that works.

It would be good to add it as a note for future users.

There is another issue with audio I will add in a separate issue since I've been using two audio sinks.

Thank you, @dec05eba ^^

dec05eba commented 3 months ago

Flatpak version seems to be 7:4.4.2-0ubuntu0.22.04.1 . I'll try to reinstall ffmpeg to see if that works.

the flatpak version of gpu screen recorder includes its own ffmpeg so it will always be the same version for everybody, so im not sure what you mean.

But also can you try this:

I pushed a test fix to git, can you do a git pull & install and try again? I haven't been able to test it yet but if this works it saves me time having to setup another distro on my computer

YozoraWolf commented 3 months ago

the flatpak version of gpu screen recorder includes its own ffmpeg so it will always be the same version for everybody, so im not sure what you mean.

Oh, I meant this. What I meant to say is that I did try to install the latest version of ffmpeg like a week ago, but it brought another bug, so I uninstalled and installed the flatpak version instead.

But also can you try this:

I pushed a test fix to git, can you do a git pull & install and try again? I haven't been able to test it yet but if this works it saves me time having to setup another distro on my computer

Will do as soon as I can, thanks.

YozoraWolf commented 3 months ago

But also can you try this:

I pushed a test fix to git, can you do a git pull & install and try again? I haven't been able to test it yet but if this works it saves me time having to setup another distro on my computer

Output:

wolf@wolf-mint:~/.gsr$ gpu-screen-recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos
[hevc_nvenc @ 0x55f0bd706e80] ignoring invalid SAR: 0/0
[hevc_nvenc @ 0x55f0be5e4fc0] ignoring invalid SAR: 0/0
Warning: opus audio codec is chosen but your ffmpeg version does not support s16/flt sample format and performance might be slightly worse. You can either rebuild ffmpeg with libopus instead of the built-in opus, use the flatpak version of gpu screen recorder or record with flac audio codec instead (-ac flac). Falling back to fltp audio sample format instead.
[SWR @ 0x7f1874000900] Input channel layout "" is invalid or unsupported.
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
[SWR @ 0x7f1874000900] Context has not been initialized
^C[SWR @ 0x7f1874000900] Context has not been initialized
wolf@wolf-mint:~/.gsr$ ^C
wolf@wolf-mint:~/.gsr$ gpu-screen-recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac aac -k hevc -c mp4 -r 60 -o /home/wolf/Videos
[hevc_nvenc @ 0x55fa36e9e480] ignoring invalid SAR: 0/0
[hevc_nvenc @ 0x55fa37d7be40] ignoring invalid SAR: 0/0
[SWR @ 0x7fae68000900] Input channel layout "" is invalid or unsupported.
[SWR @ 0x7fae68000900] Context has not been initialized
[aac @ 0x55fa3834f200] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x55fa3834f200] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x55fa3834f200] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x55fa3834f200] Input contains (near) NaN/+-Inf
Failed to encode audio!
[aac @ 0x55fa3834f200] Input contains (near) NaN/+-Inf

I reinstalled gsr, should I try reinstalling another version of ffmpeg instead?

P.S.: would it be possible to include build version with --help?

dec05eba commented 3 months ago

Thanks, i'll install linux mint 21 and fix it. But for now you can use the flatpak version of gpu screen recorder instead which doesn't have this issue.

YozoraWolf commented 3 months ago

Thanks, i'll install linux mint 21 and fix it. But for now you can use the flatpak version of gpu screen recorder instead which doesn't have this issue.

I'll keep that in mind, thanks.

I will probably wait for a patch, I use gsr cli scripts to manage all actions, so I'm not sure the gtk version would help me on this.

But I'll keep you posted about the issue!

Again thank you for the support, keeping this open until you decide what can be done further!

dec05eba commented 3 months ago

I will probably wait for a patch, I use gsr cli scripts to manage all actions, so I'm not sure the gtk version would help me on this.

You can actually launch gpu screen recorder cli with the flatpak as well, just replace gpu-screen-recorder with flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder in the command, so for example\ gpu-screen-recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos\ becomes\ flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos

killall --- commands to stop/save with gpu screen recorder also works when running flatpak like this, so it works the same way. The main difference between installing from source and the flatpak version is that the flatpak version will ask for root password the first time you record your monitor for root permission (except on nvidia on x11). When you install from source it removes having to do this one step once.

YozoraWolf commented 3 months ago

I will probably wait for a patch, I use gsr cli scripts to manage all actions, so I'm not sure the gtk version would help me on this.

You can actually launch gpu screen recorder cli with the flatpak as well, just replace gpu-screen-recorder with flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder in the command, so for example gpu-screen-recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos becomes flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos

killall --- commands to stop/save with gpu screen recorder also works when running flatpak like this, so it works the same way. The main difference between installing from source and the flatpak version is that the flatpak version will ask for root password the first time you record your monitor for root permission (except on nvidia on x11). When you install from source it removes having to do this one step once.

wolf@wolf-mint:~$ flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder -w screen -fm cfr -f 60 -a bluez_sink.C0_91_B9_DE_7C_AE.a2dp_sink.monitor -ac opus -k hevc -c mp4 -r 60 -o /home/wolf/Videos
[hevc_nvenc @ 0x55621c2aca00] ignoring invalid SAR: 0/0
[hevc_nvenc @ 0x55621c2aca00] ignoring invalid SAR: 0/0
update fps: 247
update fps: 247
update fps: 247
update fps: 246
update fps: 247
update fps: 247
update fps: 247
update fps: 247

Great! Works like a charm, will be using the CLI from the flatpak then :)

Thanks for the continued support, @dec05eba !

dec05eba commented 3 months ago

Ok so I tried it on linux mint 21.3 and I cant reproduce this issue there. The warning and error doesn't show up for me and the audio works fine. Can you run this ldd $(which gpu-screen-recorder) | grep libav and post the output here? are you using libav* (ffmpeg) libraries installed from the package manager?

YozoraWolf commented 3 months ago

Ok so I tried it on linux mint 21.3 and I cant reproduce this issue there. The warning and error doesn't show up for me and the audio works fine. Can you run this ldd $(which gpu-screen-recorder) | grep libav and post the output here? are you using libav* (ffmpeg) libraries installed from the package manager?

I might be missing libav* , since nothing is being output. (Which is curious because I'm using ffmpeg straight from the package manager)

dec05eba commented 3 months ago

That doesn't make sense, its a required dependency. Unless you are using ffmpeg before it split to different libraries, in which case it would be a very very old version of ffmpeg libraries. Can you post the output of ldd $(which gpu-screen-recorder) instead?

YozoraWolf commented 3 months ago

That doesn't make sense, its a required dependency. Unless you are using ffmpeg before it split to different libraries, in which case it would be a very very old version of ffmpeg libraries. Can you post the output of ldd $(which gpu-screen-recorder) instead?

    linux-vdso.so.1 (0x00007ffef01bf000)
    libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007efbfd83e000)
    libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007efbfd839000)
    libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007efbfd82c000)
    libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007efbfd824000)
    libpulse.so.0 => /lib/x86_64-linux-gnu/libpulse.so.0 (0x00007efbfd7cf000)
    libva.so.2 => /lib/x86_64-linux-gnu/libva.so.2 (0x00007efbfd79d000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efbfd6b4000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efbfd696000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007efbfd66b000)
    libva-drm.so.2 => /lib/x86_64-linux-gnu/libva-drm.so.2 (0x00007efbfd666000)
    libva-x11.so.2 => /lib/x86_64-linux-gnu/libva-x11.so.2 (0x00007efbfd65e000)
    libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007efbfd648000)
    libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007efbfd63b000)
    libwayland-egl.so.1 => /lib/x86_64-linux-gnu/libwayland-egl.so.1 (0x00007efbfd636000)
    libwayland-client.so.0 => /lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007efbfd625000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efbfd3f9000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efbfd3d9000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efbfd1b0000)
    libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007efbfd184000)
    libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007efbfd16f000)
    libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007efbfd162000)
    libpulsecommon-15.99.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-15.99.so (0x00007efbfd0dd000)
    libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007efbfd08f000)
    /lib64/ld-linux-x86-64.so.2 (0x00007efc00569000)
    libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007efbfd088000)
    libxcb-dri3.so.0 => /lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007efbfd081000)
    libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007efbfd074000)
    libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007efbfd06e000)
    libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007efbfd066000)
    libsndfile.so.1 => /lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007efbfcfe5000)
    libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007efbfcf1e000)
    libasyncns.so.0 => /lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007efbfcf16000)
    libapparmor.so.1 => /lib/x86_64-linux-gnu/libapparmor.so.1 (0x00007efbfcf01000)
    libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007efbfcee9000)
    libFLAC.so.8 => /lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007efbfceab000)
    libvorbis.so.0 => /lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007efbfce7e000)
    libvorbisenc.so.2 => /lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007efbfcdd3000)
    libopus.so.0 => /lib/x86_64-linux-gnu/libopus.so.0 (0x00007efbfcd76000)
    libogg.so.0 => /lib/x86_64-linux-gnu/libogg.so.0 (0x00007efbfcd6b000)
    libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007efbfcc9c000)
    liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007efbfcc7a000)
    libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007efbfcb31000)
    libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007efbfcb24000)
    libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007efbfcafe000)

I'm just as confused as you are. I'm still running the Package Manager version:

ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers

Haven't updated it yet.

dec05eba commented 3 months ago

Can you run pkg-config --modversion libavcodec and post the output here?

YozoraWolf commented 3 months ago

Can you run pkg-config --modversion libavcodec and post the output here?

61.1.101

dec05eba commented 3 months ago

huh? thats newer than arch linux one. Have you possibly corrupted ffmpeg library files on your system by installing ffmpeg from source?

YozoraWolf commented 3 months ago

huh? thats newer than arch linux one. Have you possibly corrupted ffmpeg library files on your system by installing ffmpeg from source?

I've possibly done so when I built from source and then reinstalled flatpak one. So perhaps the issue lies there, a corrupt ffmpeg reinstall :/ That kinda sucks

dec05eba commented 3 months ago

maybe it can be fixed if you reinstall ffmpeg from the package manager, or look if you see the libav* files in another location such as /usr/local/lib, in which case you should remove them. But you should do that by running uninstall command from the ffmpeg source to make sure it removes all the ffmpeg files

dec05eba commented 3 months ago

But it's also possible that the issue you see here is something that new ffmpeg will cause in gpu screen recorder and then it will have to be fixed. But i'll see that when its released. I'll close this issue for now as I believe it's an issue you will have to fix on your system. You can re-open this issue if you know for sure that it uses your distros ffmpeg and still has this issue.