Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Screen capture
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 340

PostPosted: Sat Aug 26, 2023 4:49 pm    Post subject: Screen capture Reply with quote

Trying to capture screen:

Code:
ffmpeg -video_size 768x920 -framerate 25 -f x11grab -i :0.0+250,120 -f alsa -ac 2 -i hw:0 output.mp4

Video is OK, but sound is missing. What's wrong with this command?
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3140

PostPosted: Sat Aug 26, 2023 5:17 pm    Post subject: Reply with quote

I suppose you're trying to record from your mike while you actually want to record your speakers.
You're gonna need loopback for this to work. This looks kinda promissing https://trac.ffmpeg.org/wiki/Capture/ALSA#Recordaudiofromanapplication
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 340

PostPosted: Sat Aug 26, 2023 5:40 pm    Post subject: Reply with quote

@szatox thanks for your input.
I tried to modprobe snd-aloop, but failed: Module snd-aloop not found in directory /lib/modules/6.1.12-gentoo. Kernel menuconfig seems lack of this module.
Is it separate package for snd-aloop?
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 340

PostPosted: Sat Aug 26, 2023 7:03 pm    Post subject: Reply with quote

Enabled CONFIG_SND_ALOOP, rebuilt kernel & modules, loaded module and corrected .asoundrc to match above link. Now no sound at all. When removing .asoundrc sound works again, but still no sound capture
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3140

PostPosted: Sat Aug 26, 2023 7:37 pm    Post subject: Reply with quote

When you had "no sound at all", did you try recording in that state or just noticed there is no audio playback and gave up?
That link has 2 examples of recording the output from application. First is loopback only, the other is loopback + playback. More complex, and more work to set up, but won't be interfering with you actually using your pc.
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 340

PostPosted: Sat Aug 26, 2023 7:55 pm    Post subject: Reply with quote

I need loopback+playback.
And I don't know what to put into asoundrc instead of <Your Output Device Name>
Code:
pcm.output {
   type hw
   card <Your Output Device Name>
}

_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 340

PostPosted: Sat Aug 26, 2023 8:58 pm    Post subject: Reply with quote

Right now I have this in asoundrc:

Code:
pcm.multi {
    type route;
    slave.pcm {
        type multi;
        slaves.a.pcm "output";
        slaves.b.pcm "loopin";
        slaves.a.channels 2;
        slaves.b.channels 2;
        bindings.0.slave a;
        bindings.0.channel 0;
        bindings.1.slave a;
        bindings.1.channel 1;
        bindings.2.slave b;
        bindings.2.channel 0;
        bindings.3.slave b;
        bindings.3.channel 1;
    }

    ttable.0.0 1;
    ttable.1.1 1;
    ttable.0.2 1;
    ttable.1.3 1;
}

pcm.!hw:0 {
   type plug
   slave.pcm "multi"
}

pcm.output {
   type hw
   card 0
}

pcm.loopin {
   type plug
   slave.pcm "hw:Loopback,0,0"
}

pcm.loopout {
   type plug
   slave.pcm "hw:Loopback,1,0"
}


And capturing with this command:
Code:
ffmpeg -video_size 768x920 -framerate 25 -f x11grab -i :0.0+250,120 -f alsa -ac 2 -i loopout output.mp4


Sound works, but still no sound in output.mp4.
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
shadowless
Tux's lil' helper
Tux's lil' helper


Joined: 27 Nov 2022
Posts: 101

PostPosted: Sun Aug 27, 2023 3:39 am    Post subject: Reply with quote

I don't need to specify a loopback plug in my asoundrc to record audio out. It varies per hardware setup, but usually the default alsa setup works out of the box.

Check the recording side of your sound device with alsamixer to make sure its not muted.
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 340

PostPosted: Sun Aug 27, 2023 2:50 pm    Post subject: Reply with quote

alsamixer shows that all capture devices unmuted (except microphone). Loopback device is enabled. Sources for capture input set to Line.
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum