Bug in FFMPEG Alsa?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Bug in FFMPEG Alsa?

christina zou
Hello,

I have two alsa commands:

1. ffmpeg -f alsa -acodec pcm_s32le -i mic_sv temp.wav

2. arecord -Dmic_sv -c2 -r48000 -fS32_LE -twav temp.wav

Command 1 takes 95% CPU and produces stuttery, clicky unusable audio.

Command 2 takes 5% CPU and produces perfect audio.

I'm on a Pi Zero. I compiled FFMPEG with ALSA support.

After a long chat in FFMPEG IRC, we believe there is something wrong with
the way FFMPEG waits for ALSA packets. At the very least, FFMPEG waits for
ALSA packets differently than arecord does.

How should I proceed?

Report logs for both commands are attached.

Thanks very much,
Christina

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

command_1.log (7K) Download Attachment
command2.log (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Carl Eugen Hoyos-2
2017-02-17 11:59 GMT+01:00 christina zou <[hidden email]>:

> 1. ffmpeg -f alsa -acodec pcm_s32le -i mic_sv temp.wav

I don't understand this command line: What is "-acodec pcm_s32le"
supposed to do (except forcing stuttery, unusable audio)?

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Nicolas George
In reply to this post by christina zou
Le nonidi 29 pluviôse, an CCXXV, christina zou a écrit :

> 1. ffmpeg -f alsa -acodec pcm_s32le -i mic_sv temp.wav
>
> 2. arecord -Dmic_sv -c2 -r48000 -fS32_LE -twav temp.wav
>
> Command 1 takes 95% CPU and produces stuttery, clicky unusable audio.
>
> Command 2 takes 5% CPU and produces perfect audio.
>
> I'm on a Pi Zero. I compiled FFMPEG with ALSA support.
>
> After a long chat in FFMPEG IRC, we believe there is something wrong with
> the way FFMPEG waits for ALSA packets. At the very least, FFMPEG waits for
> ALSA packets differently than arecord does.
Could you show us the output of the following command:

time ffmpeg -i temp_arecord.wav temp_ffmpeg.wav

... where temp_arecord.wav is the correct, non-stuttering file produced
by arecord?

And then the output of this one:

time ffmpeg -i temp_arecord.wav -c copy temp_ffmpeg2.wav

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Erik Dobberkau
In reply to this post by Carl Eugen Hoyos-2
2017-02-17 12:11 GMT+01:00 Carl Eugen Hoyos <[hidden email]>:

> 2017-02-17 11:59 GMT+01:00 christina zou <[hidden email]>:
>
> > 1. ffmpeg -f alsa -acodec pcm_s32le -i mic_sv temp.wav
>
> I don't understand this command line: What is "-acodec pcm_s32le"
> supposed to do (except forcing stuttery, unusable audio)?
>
> Carl Eugen
>
>
I would also suggest using -acodec pcm_s16le (and maybe -ac 1 when using a
mono microphone) as well as -ar 48000 (or 44100) and checking the results
thereof.

Erik
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Carl Eugen Hoyos-2
2017-02-17 12:19 GMT+01:00 Erik Dobberkau <[hidden email]>:
> 2017-02-17 12:11 GMT+01:00 Carl Eugen Hoyos <[hidden email]>:
>
>> 2017-02-17 11:59 GMT+01:00 christina zou <[hidden email]>:
>>
>> > 1. ffmpeg -f alsa -acodec pcm_s32le -i mic_sv temp.wav
>>
>> I don't understand this command line: What is "-acodec pcm_s32le"
>> supposed to do (except forcing stuttery, unusable audio)?

> I would also suggest using -acodec pcm_s16le (and maybe -ac 1 when using a
> mono microphone) as well as -ar 48000 (or 44100) and checking the results
> thereof.

Please don't!
Using -acodec pcm_s16le is not doing what you expect, just remove
all options.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

christina zou
In reply to this post by Carl Eugen Hoyos-2
Hi Carl,

Thanks for the quick reply!!

My mic natively records in 32bit LE format. I thought -acodec pcm_s32le was
merely supplying the input format?

On Fri, Feb 17, 2017 at 3:11 AM, Carl Eugen Hoyos <[hidden email]>
wrote:

> 2017-02-17 11:59 GMT+01:00 christina zou <[hidden email]>:
>
> > 1. ffmpeg -f alsa -acodec pcm_s32le -i mic_sv temp.wav
>
> I don't understand this command line: What is "-acodec pcm_s32le"
> supposed to do (except forcing stuttery, unusable audio)?
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Carl Eugen Hoyos-2
2017-02-17 12:19 GMT+01:00 christina zou <[hidden email]>:

> My mic natively records in 32bit LE format. I thought -acodec pcm_s32le was
> merely supplying the input format?

No, it overwrites the decoder to produce stuttery, unusable audio.

Please do not top-post here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

christina zou
Carl, thanks again for the help.

I'm really sorry about top-posting, but I have no idea what it means? I'm
replying to this email thread that I've started to ffmpeg-users from gmail.
Please advise me how else I should continue replying to this thread?

Thanks again.

On Fri, Feb 17, 2017 at 3:26 AM, Carl Eugen Hoyos <[hidden email]>
wrote:

> 2017-02-17 12:19 GMT+01:00 christina zou <[hidden email]>:
>
> > My mic natively records in 32bit LE format. I thought -acodec pcm_s32le
> was
> > merely supplying the input format?
>
> No, it overwrites the decoder to produce stuttery, unusable audio.
>
> Please do not top-post here, Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Carl Eugen Hoyos-2
In reply to this post by christina zou
2017-02-17 12:19 GMT+01:00 christina zou <[hidden email]>:
> Hi Carl,
>
> Thanks for the quick reply!!
>
> My mic natively records in 32bit LE format. I thought -acodec
> pcm_s32le was merely supplying the input format?

You are right and it seems to work here but since you are reporting an
issue I would suggest to try with default values first.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Phil Rhodes
In reply to this post by christina zou
> I'm really sorry about top-posting, but I have no idea what it means?
Don't worry about it - it isn't very important, and Carl has no formal authority to tell you what to do.
P
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Erik Dobberkau
In reply to this post by Carl Eugen Hoyos-2
> > I would also suggest using -acodec pcm_s16le (and maybe -ac 1 when using
> a
> > mono microphone) as well as -ar 48000 (or 44100) and checking the results
> > thereof.
>
> Please don't!
> Using -acodec pcm_s16le is not doing what you expect, just remove
> all options.
>
> Carl Eugen
>

Oh, good to know. Does this only apply to alsa and/or other non-file input,
or in general?

Erik
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Erik Dobberkau
In reply to this post by christina zou
> I'm really sorry about top-posting, but I have no idea what it means? I'm
> replying to this email thread that I've started to ffmpeg-users from gmail.
> Please advise me how else I should continue replying to this thread?
>
> Thanks again.
>

It means to answer below the message body and to remove all the excess text
which is not required to understand the answer or question in context of
the previous one.

Erik
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Carl Eugen Hoyos-2
In reply to this post by Erik Dobberkau
2017-02-17 12:50 GMT+01:00 Erik Dobberkau <[hidden email]>:

>> > I would also suggest using -acodec pcm_s16le (and maybe -ac 1 when using
>> a
>> > mono microphone) as well as -ar 48000 (or 44100) and checking the results
>> > thereof.
>>
>> Please don't!
>> Using -acodec pcm_s16le is not doing what you expect, just remove
>> all options.
>>
>> Carl Eugen
>>
>
> Oh, good to know. Does this only apply to alsa and/or other non-file input,
> or in general?

It applies in general, for alsa it should select the alsa format
but since there was an issue reported I suggest to test with
default options.

Next step will be to copy the options used for arecord.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Reindl Harald
In reply to this post by Phil Rhodes


Am 17.02.2017 um 12:46 schrieb Phil Rhodes:
>>  I'm really sorry about top-posting, but I have no idea what it means?
> Don't worry about it - it isn't very important, and Carl has no formal authority to tell you what to do

and you have?

a thread which get mixed with top posting, full quote and answer on
bottom and inline quoting with remove uneeded quotes becomes quickly a
complete messed only to top when a few contributors also start to
convert plaintext messages to HTML

common sense should tell that
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

christina zou
In reply to this post by Nicolas George
Hi Nicolas,

Here is the result of your two commands:

1. time ffmpeg -i temp_arecord.wav temp_ffmpeg.wav

Full output: http://pastebin.com/HU8qeggq  <http://pastebin.com/HU8qeggq>

real 0m3.154s

user 0m1.230s

sys 0m0.370s


2. time ffmpeg -i temp_arecord.wav -c copy temp_ffmpeg2.wav

Full output: http://vpaste.net/pCm4f

real 0m0.986s

user 0m0.510s

sys 0m0.430s


What do you think? Thanks,

C
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

christina zou
In reply to this post by Carl Eugen Hoyos-2
Hi Carl (and all),

Well, I can't remove the -acodec pcm_s32le option. If I just run:

ffmpeg -f alsa -i mic_sv temp.wav

'[alsa @ 0x243b3f0] cannot set sample format 0x10000 2 (Invalid argument)
mic_sv: Input/output error'

> Next step will be to copy the options used for arecord.
I already made sure the arecord and ffmpeg PCM options are identical. I
have just written a custom ALSA hook ('michooks') in ffmpeg that dumps all
the PCM settings. Here is the result:

1. arecord -v -r48000 -c2 -fS32_LE --period-size=16384
--buffer-size=65536 -Dmic_sv -twav /dev/null

Uses 5% CPU. Console output:  http://vpaste.net/CPk3A

2. ALSA_CONFIG_PATH=/usr/share/alsa/alsa.conf:./dumpasoundrc ffmpeg -f
alsa -acodec pcm_s32le -i michooks -f  null -

Uses 95% CPU. Console output: http://vpaste.net/xSvae

You can see that I've configured arecord/FFMPEG to have identical
settings (buffer sizes, period sizes, etc.)


Any thoughts? Thank you,

Christina

On Fri, Feb 17, 2017 at 3:43 AM, Carl Eugen Hoyos <[hidden email]>
wrote:

> 2017-02-17 12:19 GMT+01:00 christina zou <[hidden email]>:
> > Hi Carl,
> >
> > Thanks for the quick reply!!
> >
> > My mic natively records in 32bit LE format. I thought -acodec
> > pcm_s32le was merely supplying the input format?
>
> You are right and it seems to work here but since you are reporting an
> issue I would suggest to try with default values first.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

christina zou
I also wanted to share my full debug-level log from FFMPEG when I try to
record ALSA audio, below. I have a few questions:

1. Why is my ALSA duration a *negative* value?
2. My ALSA bitrate is shown as 3072 kbps. This seems high - I only have a
Pi Zero. Is this a value I can manually set?

$ ALSA_CONFIG_PATH=/usr/share/alsa/alsa.conf:./dumpasoundrc
/home/pi/special/ffmpeg/ffmpeg -v 9 -loglevel 99  -f alsa -acodec pcm_s32le
-i michooks -f  null -

ffmpeg version git-2017-02-05-e57fd92 Copyright (c) 2000-2017 the FFmpeg
developers

  built with gcc 4.9.2 (Raspbian 4.9.2-10)

  configuration: --extra-cflags=-I/opt/vc/include/IL --enable-nonfree
--enable-omx-rpi --logfile=CONFIG.TXT

  libavutil      55. 46.100 / 55. 46.100

  libavcodec     57. 75.100 / 57. 75.100

  libavformat    57. 66.101 / 57. 66.101

  libavdevice    57.  2.100 / 57.  2.100

  libavfilter     6. 73.100 /  6. 73.100

  libswscale      4.  3.101 /  4.  3.101

  libswresample   2.  4.100 /  2.  4.100

Splitting the commandline.

Reading option '-v' ... matched as option 'v' (set logging level) with
argument '9'.

Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument '99'.

Reading option '-f' ... matched as option 'f' (force format) with argument
'alsa'.

Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'pcm_s32le'.

Reading option '-i' ... matched as input url with argument 'michooks'.

Reading option '-f' ... matched as option 'f' (force format) with argument
'null'.

Reading option '-' ... matched as output url.

Finished splitting the commandline.

Parsing a group of options: global .

Applying option v (set logging level) with argument 9.

Successfully parsed a group of options.

Parsing a group of options: input url michooks.

Applying option f (force format) with argument alsa.

Applying option acodec (force audio codec ('copy' to copy stream)) with
argument pcm_s32le.

Successfully parsed a group of options.

Opening an input file: michooks.

[ALSA Debug Hook] Installing hooks.

Hooks PCM

Slave: Soft volume PCM

Control: Boost Capture Volume

min_dB: -3

max_dB: 50

resolution: 256

Slave: Route conversion PCM

  Transformation table:

    0 <- 0

    1 <- 0

Slave: Mmap emulation PCM

Slave: Hardware PCM card 1 'mems-mic' device 0 subdevice 0

[ALSA Debug Hook] hw_params:

Hooks PCM

Slave: Soft volume PCM

Control: Boost Capture Volume

min_dB: -3

max_dB: 50

resolution: 256

Its setup is:

  stream       : CAPTURE

  access       : RW_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

Slave: Route conversion PCM

  Transformation table:

    0 <- 0

    1 <- 0

Its setup is:

  stream       : CAPTURE

  access       : MMAP_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

Slave: Mmap emulation PCM

Its setup is:

  stream       : CAPTURE

  access       : MMAP_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

Slave: Hardware PCM card 1 'mems-mic' device 0 subdevice 0

Its setup is:

  stream       : CAPTURE

  access       : RW_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1073741824

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

  appl_ptr     : 0

  hw_ptr       : 0

[alsa @ 0x31ea450] All info found

[alsa @ 0x31ea450] stream 0: start_time: 1487382765.290 duration:
-9223372036854.775

[alsa @ 0x31ea450] format: start_time: 1487382765.290 duration:
-9223372036854.775 bitrate=3072 kb/s

Guessed Channel Layout for Input Stream #0.0 : stereo

Input #0, alsa, from 'michooks':

  Duration: N/A, start: 1487382765.289814, bitrate: 3072 kb/s

    Stream #0:0, 1, 1/1000000: Audio: pcm_s32le, 48000 Hz, stereo, s32,
3072 kb/s

Successfully opened the file.

Parsing a group of options: output url -.

Applying option f (force format) with argument null.

Successfully parsed a group of options.

Opening an output file: -.

Successfully opened the file.

detected 1 logical cores

[graph_0_in_0_0 @ 0x31f9310] Setting 'time_base' to value '1/48000'

[graph_0_in_0_0 @ 0x31f9310] Setting 'sample_rate' to value '48000'

[graph_0_in_0_0 @ 0x31f9310] Setting 'sample_fmt' to value 's32'

[graph_0_in_0_0 @ 0x31f9310] Setting 'channel_layout' to value '0x3'

[graph_0_in_0_0 @ 0x31f9310] tb:1/48000 samplefmt:s32 samplerate:48000
chlayout:0x3

[format_out_0_0 @ 0x31f9f10] Setting 'sample_fmts' to value 's16'

[format_out_0_0 @ 0x31f9f10] auto-inserting filter 'auto_resampler_0'
between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'

[AVFilterGraph @ 0x31f9980] query_formats: 4 queried, 6 merged, 3 already
done, 0 delayed

[auto_resampler_0 @ 0x31faf10] [SWR @ 0x321e130] Using fltp internally
between filters

[auto_resampler_0 @ 0x31faf10] ch:2 chl:stereo fmt:s32 r:48000Hz -> ch:2
chl:stereo fmt:s16 r:48000Hz

Output #0, null, to 'pipe:':

  Metadata:

    encoder         : Lavf57.66.101

    Stream #0:0, 0, 1/48000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536
kb/s

    Metadata:

      encoder         : Lavc57.75.100 pcm_s16le

Stream mapping:

  Stream #0:0 -> #0:0 (pcm_s32le (native) -> pcm_s16le (native))

Press [q] to stop, [?] for help

cur_dts is invalid (this is harmless if it occurs once at the start per
stream)

size=N/A time=00:00:17.84 bitrate=N/A speed=   1x

video:0kB audio:3345kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown

Input file #0 (michooks):

  Input stream #0:0 (audio): 26372 packets read (6851424 bytes); 26372
frames decoded (856428 samples);

  Total: 26372 packets (6851424 bytes) demuxed

Output file #0 (pipe:):

  Output stream #0:0 (audio): 26372 frames encoded (856428 samples); 26372
packets muxed (3425712 bytes);

  Total: 26372 packets (3425712 bytes) muxed

26372 frames successfully decoded, 0 decoding errors

Exiting normally, received signal 2.

Here is the console output of Arecord:

$ arecord -v -r48000 -c2 -fS32_LE --period-size=16384 --buffer-size=65536
-Dmic_sv -twav /dev/null

Recording WAVE '/dev/null' : Signed 32 bit Little Endian, Rate 48000 Hz,
Stereo

Soft volume PCM

Control: Boost Capture Volume

min_dB: -3

max_dB: 50

resolution: 256

Its setup is:

  stream       : CAPTURE

  access       : RW_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

Slave: Route conversion PCM

  Transformation table:

    0 <- 0

    1 <- 0

Its setup is:

  stream       : CAPTURE

  access       : MMAP_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

Slave: Mmap emulation PCM

Its setup is:

  stream       : CAPTURE

  access       : MMAP_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

Slave: Hardware PCM card 1 'mems-mic' device 0 subdevice 0

Its setup is:

  stream       : CAPTURE

  access       : RW_INTERLEAVED

  format       : S32_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 32

  buffer_size  : 65536

  period_size  : 16384

  period_time  : 341333

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 16384

  period_event : 0

  start_threshold  : 1073741824

  stop_threshold   : 65536

  silence_threshold: 0

  silence_size : 0

  boundary     : 1073741824

  appl_ptr     : 0

  hw_ptr       : 0

^CAborted by signal Interrupt...

On Fri, Feb 17, 2017 at 5:38 PM, christina zou <[hidden email]>
wrote:

> Hi Carl (and all),
>
> Well, I can't remove the -acodec pcm_s32le option. If I just run:
>
> ffmpeg -f alsa -i mic_sv temp.wav
>
> '[alsa @ 0x243b3f0] cannot set sample format 0x10000 2 (Invalid argument)
> mic_sv: Input/output error'
>
> > Next step will be to copy the options used for arecord.
> I already made sure the arecord and ffmpeg PCM options are identical. I
> have just written a custom ALSA hook ('michooks') in ffmpeg that dumps all
> the PCM settings. Here is the result:
>
> 1. arecord -v -r48000 -c2 -fS32_LE --period-size=16384 --buffer-size=65536 -Dmic_sv -twav /dev/null
>
> Uses 5% CPU. Console output:  http://vpaste.net/CPk3A
>
> 2. ALSA_CONFIG_PATH=/usr/share/alsa/alsa.conf:./dumpasoundrc ffmpeg -f alsa -acodec pcm_s32le -i michooks -f  null -
>
> Uses 95% CPU. Console output: http://vpaste.net/xSvae
>
> You can see that I've configured arecord/FFMPEG to have identical settings (buffer sizes, period sizes, etc.)
>
>
> Any thoughts? Thank you,
>
> Christina
>
> On Fri, Feb 17, 2017 at 3:43 AM, Carl Eugen Hoyos <[hidden email]>
> wrote:
>
>> 2017-02-17 12:19 GMT+01:00 christina zou <[hidden email]>:
>> > Hi Carl,
>> >
>> > Thanks for the quick reply!!
>> >
>> > My mic natively records in 32bit LE format. I thought -acodec
>> > pcm_s32le was merely supplying the input format?
>>
>> You are right and it seems to work here but since you are reporting an
>> issue I would suggest to try with default values first.
>>
>> Carl Eugen
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>>
>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Moritz Barsnick
On Fri, Feb 17, 2017 at 20:56:25 -0800, christina zou wrote:
> 2. My ALSA bitrate is shown as 3072 kbps. This seems high - I only have a
> Pi Zero. Is this a value I can manually set?

Why is that high and why should a Pi not be able to handle a standard
audio stream? 32 bits per sample, 48000 samples per second, two
channels, that makes exactly 3072000 bits per second. There's nothing
that can (or should) be done about that, that's how uncompressed audio
works.

If you can get your ALSA device to output less bts per sample, or less
samples per second, you can reduce that rate, but I still don't
understand why.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

christina zou
Hi,

You're right. The 3Mbps speed is as expected.

However, this still doesn't explain why my FFmpeg command requires 95% of
my device's CPU to record raw audio audio, when the equivalent Arecord
command takes 5% of my CPU.

Again, here are my two commands:

arecord -v -r48000 -c2 -fS32_LE --period-size=16384
--buffer-size=65536 -Dmic_sv -twav /dev/null

ffmpeg -f alsa -acodec pcm_s32le -i mic_sv -c copy -f null -





On Sat, Feb 18, 2017 at 12:38 PM, Moritz Barsnick <[hidden email]> wrote:

> On Fri, Feb 17, 2017 at 20:56:25 -0800, christina zou wrote:
> > 2. My ALSA bitrate is shown as 3072 kbps. This seems high - I only have a
> > Pi Zero. Is this a value I can manually set?
>
> Why is that high and why should a Pi not be able to handle a standard
> audio stream? 32 bits per sample, 48000 samples per second, two
> channels, that makes exactly 3072000 bits per second. There's nothing
> that can (or should) be done about that, that's how uncompressed audio
> works.
>
> If you can get your ALSA device to output less bts per sample, or less
> samples per second, you can reduce that rate, but I still don't
> understand why.
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Bug in FFMPEG Alsa?

Nicolas George
In reply to this post by Phil Rhodes
Le nonidi 29 pluviôse, an CCXXV, Phil Rhodes a écrit :
> Don't worry about it - it isn't very important, and Carl has no formal
> authority to tell you what to do.

Replying to the troll, for once.

Carl Eugen has no formal authority on anybody on the list. But he, like
anybody else, has the authority of withholding his help.

Since he is one of the most helpful persons on this list, especially
since he is the one who endeavours to help even the hopelessly clueless
that nobody else gives a damn about, alienating him is really not a good
idea.

I myself make extensive use of that right of not helping obnoxious
people.

The first someone top-posts, I tell them "Please remember that
top-posting is forbidden on this list; if you do not know what it means,
look it up.". If there is a second time, I just stop replying to them,
exactly as in this thread.

Well, I am not a monster, if they forget once or twice later and
apologize, they deserve a second chance. But if they just ignore the
demand, too bad for them.

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
12