Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] ffmpeg video+audio capture question
Date: Wed, 18 Sep 2019 20:15:15
Message-Id: 2723206.3st8b7eCfH@localhost
In Reply to: Re: [gentoo-user] [OT] ffmpeg video+audio capture question by Walter Dnes
1 On Wednesday, 18 September 2019 19:03:02 BST Walter Dnes wrote:
2 > On Wed, Sep 18, 2019 at 11:16:41AM +0100, Mick wrote
3 >
4 > > On Wednesday, 18 September 2019 10:10:16 BST Walter Dnes wrote:
5 > > > ffmpeg -f alsa -ac 2 -i hw:0 -video_size 1920x1080 -framerate 25 -f
6 > > > x11grab
7 > > > -i :0.0 output.mp4
8 > >
9 > > The above should work, but only if your active audio card has Card
10 > > ID 0. If your PC uses HDMI as the first card you'll need to adjust
11 > > /etc/asound.conf accordingly to switch to your analogue audio device,
12 > > or perhaps try hw:1 in the above incantation instead.
13 >
14 > "aplay -l" outputs
15 >
16 > **** List of PLAYBACK Hardware Devices ****
17 > card 0: PCH [HDA Intel PCH], device 0: CX20641 Analog [CX20641 Analog]
18 > Subdevices: 0/1
19 > Subdevice #0: subdevice #0
20 > card 0: PCH [HDA Intel PCH], device 3: Generic Digital [Generic Digital]
21 > Subdevices: 1/1
22 > Subdevice #0: subdevice #0
23 >
24 > If I try "hw:1" it dies immediately (No such file or directory)
25
26 Yes, you only have one card 0. The first device (default) is the analogue.
27
28 What does 'arecord -l' show?
29
30
31 > No /etc/asound.conf or $HOME/.asoundrc on my system. But there is a
32 > large (9596 bytes) /usr/share/alsa/alsa.conf
33
34 You would need to create a asound.conf card to switch from the HDMI to
35 analogue as the default card, if your hardware was like mine - but it is not.
36
37
38 Let's try something else, specifying a sub-device. What happens with:
39
40 -i hw:0,1
41
42 or
43
44 -i hw:0,0,1
45
46
47 Adjust the above according to what arecord shows.
48
49
50 > The console I launch ffmpeg from shows a lot of stuff like...
51 >
52 > [alsa @ 0x559c480c94c0] ALSA buffer xrun.
53 > frame= 2337 fps= 25 q=28.0 size= 11008kB time=00:01:33.05 bitrate=
54 > 969.1kbits/frame= 2350 fps= 25 q=28.0 size= 11008kB time=00:01:33.05
55 > bitrate= 969.1kbits/frame= 2362 fps= 25 q=28.0 size= 11008kB
56 > time=00:01:33.05 bitrate= 969.1kbits/frame= 2375 fps= 25 q=28.0 size=
57 > 11008kB time=00:01:33.05 bitrate= 969.1kbits/[alsa @ 0x559c480c94c0] ALSA
58 > buffer xrun. frame= 2387 fps= 25 q=28.0 size= 11264kB time=00:01:35.21
59 > bitrate= 969.2kbits/frame= 2400 fps= 25 q=28.0 size= 11264kB
60 > time=00:01:35.21 bitrate= 969.2kbits/frame= 2412 fps= 25 q=28.0 size=
61 > 11264kB time=00:01:35.21 bitrate= 969.2kbits/frame= 2425 fps= 25 q=28.0
62 > size= 11264kB time=00:01:35.21 bitrate= 969.2kbits/[alsa @
63 > 0x559c480c94c0] ALSA buffer xrun.
64 >
65 > When I playback with mplayer and exit, there's a bunch of diagnostics.
66 > Towards the end it says...
67 >
68 > ==========================================================================
69 > Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
70 > AUDIO: 48000 Hz, 2 ch, floatle, 0.1 kbit/0.00% (ratio: 17->384000)
71 > Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
72 > ==========================================================================
73 > AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
74 > Starting playback...
75 > Could not find matching colorspace - retrying with -vf scale...
76 > Opening video filter: [scale]
77 > Movie-Aspect is undefined - no prescaling applied.
78 > [swscaler @ 0x7f28e3f20100]bicubic scaler, from yuv444p to yuv420p using
79 > MMXEXT VO: [xv] 1920x1080 => 1920x1080 Planar YV12
80 > A: 38.9 V: 35.9 A-V: 3.003 ct: 3.588 0/ 0 17% 12% 0.0% 0 0
81 > Timing looks severely broken, resetting
82 > A: 38.9 V: 39.6 A-V: -0.717 ct: 3.805 0/ 0 17% 12% 0.0% 0 0
83 >
84 > The message about timing may be a clue.
85
86 I think timing issues should not affect the audio (it could be out of sync
87 with the video). The ffmpeg output seems noisy and you're getting alsa buffer
88 over/under runs. Try this:
89
90 -f alsa -thread_queue_size 2048
91
92 or use 1024, if 2048 takes too long to allow the recording to start. This
93 should do away with the message 'ALSA buffer xrun'.
94
95 The mplayer output shows you have an audio stream alright and I bet ffprobe
96 will show the same. Unless you're trying to record frequencies not audible by
97 the human ear, I can think of one more thing.
98
99 Maximise the Mic's capture volume and any boost settings available. Once I
100 was trying to perform a voice recording using the built in microphone on a
101 lesser quality laptop, not understanding why I couldn't hear any audio on
102 playback. Well, I had to push the capture volume all the way up to 100%
103 before I heard audio being played back. What a relief! I thought I was going
104 deaf. LOL!!
105
106 HTH.
107 --
108 Regards,
109
110 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] [OT] ffmpeg video+audio capture question Walter Dnes <waltdnes@××××××××.org>