Question

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

I'm trying to record via my laptop MIC. There's an unwelcome pause before start of recording.

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.

I tried an strace -f I see this

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

On scrolling UP

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

I also did this manually.. saved it to a file and then ran avconv on the file; That was MUCH faster (instantly finished).

What could be the problem.

Was it helpful?

Solution

That is easy, AVconv analyzing input stream.

To shorten the analysis use the switch -analyzeduration

Example:

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

-analyzeduration 1000 = analyze 1ms

As you write, the second solution is to run the commands in a row.

Script e.g.

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

Sorry for my excellent English.

GL

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top