gpt4 book ai didi

linux - 将 arecord 与 aconv 一起使用时出现不受欢迎的延迟

转载 作者:太空狗 更新时间:2023-10-29 12:32:21 25 4
gpt4 key购买 nike

arecord -f cd -D default:CARD=Intel -| avconv -i pipe:0 -acodec libmp3lame -aq 128k g3-$dt-$$.mp3

我正在尝试通过我的笔记本电脑 MIC 进行录音。开始录制前有一段不受欢迎的停顿。

avconv version 0.8.10-6:0.8.10-1, Copyright (c) 2000-2013 the Libav developers
built on Feb 5 2014 03:52:19 with gcc 4.7.2
Recording WAVE '-' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

<DELAY>

[wav @ 0x21b4300] max_analyze_duration reached
Input #0, wav, from 'pipe:0':
Duration: 03:22:53.94, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, mp3, to 'g3-Monday-April-14-2014-06_38_07PM-15308.mp3':
Metadata:
TSSE : Lavf53.21.1
Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 200 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
Press ctrl-c to stop encoding
^CAborted by signal Interrupt...te= 51.7kbits/s
size= 94kB time=14.86 bitrate= 51.6kbits/s
video:0kB audio:93kB global headers:0kB muxing overhead 0.143132%
Received signal 2: terminating.

我试过 strace -f我看到了这个

read(3, 0x7fff06200b80, 128)            = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN|POLLERR|POLLNVAL}], 1, -1^C <unfinished ...>
Aborted by signal Terminated...

向上滚动

stat("/usr/share/alsa/alsa.conf", {st_mode=S_IFREG|0644, st_size=9184, ...}) = 0
open("/dev/snd/controlC0", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
ioctl(3, UI_DEV_CREATE, 0x7fff06201b90) = 0
close(3) = 0
open("/dev/snd/timer", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
ioctl(3, 0x80045400, 0x7fff06201eb8) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, 0x7fff06201ebc) = 0
ioctl(3, TIOCSPGRP, 0x7fff06201ec0) = 0
ioctl(3, 0x80045400, 0x7fff0620230c) = 0
semop(786432, {{0, -1, SEM_UNDO|IPC_NOWAIT}}, 1) = 0
open("/dev/snd/controlC0", O_RDONLY|O_CLOEXEC) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
ioctl(5, UI_DEV_CREATE, 0x7fff062022f0) = 0
close(5)

= 0

我也是手动完成的。将它保存到一个文件中,然后在该文件上运行 avconv;那是 MUCH 更快(立即完成)。

可能是什么问题。

最佳答案

这很简单,AVconv 分析输入流。

要缩短分析时间,请使用开关 -analyzeduration

例子:

arecord -f cd -D default:CARD=Intel -| avconv -analyzeduration 1000 -i pipe:0 -acodec libmp3lame -aq 128k g3-$dt-$$.mp3

-analyzeduration 1000 = 分析 1ms

如您所写,第二种解决方案是连续运行命令。

脚本例如

#!/bin/bash
arecord .....
avconv .....

抱歉我的英语太棒了。

GL

关于linux - 将 arecord 与 aconv 一起使用时出现不受欢迎的延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23061126/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com