Opened 11 years ago

Last modified 11 years ago

#2504 new defect

Audio glitches and distortion when recording alsa

Reported by: Jean-Pierre Owned by:
Priority: normal Component: avdevice
Version: git-master Keywords: alsa
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: I try to record from integrated audio card input line/micro and get distortions.
How to reproduce:

$ ffmpeg -debug 1 -vn -f alsa -ac 2 -channel_layout stereo -i hw:0,0 -c:a pcm_s16le /Store3/Test/pcm_`date +%m%d_%H%M`.wav
ffmpeg version N-52061-g8137ea3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 13 2013 21:10:51 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration: --prefix=/opt/ffmpeg-opt/usr --enable-shared --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64 --optflags='-O2 -g' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --disable-libv4l2 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --build-suffix=1 --disable-doc --enable-runtime-cpudetect
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 53.101 /  3. 53.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
 matched as AVOption 'debug' with argument '1'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '2'.
Reading option '-channel_layout' ... matched as option 'channel_layout' (set channel layout) with argument 'stereo'.
Reading option '-i' ... matched as input file with argument 'hw:0,0'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'pcm_s16le'.
Reading option '/Store3/Test/pcm_0426_1018.wav' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file hw:0,0.
Applying option vn (disable video) with argument 1.
Applying option f (force format) with argument alsa.
Applying option ac (set number of audio channels) with argument 2.
Applying option channel_layout (set channel layout) with argument stereo.
Successfully parsed a group of options.
Opening an input file: hw:0,0.
[alsa @ 0x20f7720] All info found
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1366967936.157276, bitrate: 1536 kb/s
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output file /Store3/Test/pcm_0426_1018.wav.
Applying option c:a (codec name) with argument pcm_s16le.
Successfully parsed a group of options.
Opening an output file: /Store3/Test/pcm_0426_1018.wav.
Successfully opened the file.
[graph 0 input from stream 0:0 @ 0x20e8280] Setting 'time_base' to value '1/48000'
[graph 0 input from stream 0:0 @ 0x20e8280] Setting 'sample_rate' to value '48000'
[graph 0 input from stream 0:0 @ 0x20e8280] Setting 'sample_fmt' to value 's16'
[graph 0 input from stream 0:0 @ 0x20e8280] Setting 'channel_layout' to value '0x3'
[graph 0 input from stream 0:0 @ 0x20e8280] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[audio format for output stream 0:0 @ 0x20effc0] Setting 'sample_fmts' to value 's16'
[AVFilterGraph @ 0x20f7320] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
Output #0, wav, to '/Store3/Test/pcm_0426_1018.wav':
  Metadata:
    ISFT            : Lavf55.2.100
    Stream #0:0, 0, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=    1076kB time=00:00:05.73 bitrate=1536.1kbits/s    
video:0kB audio:1076kB subtitle:0 global headers:0kB muxing overhead 0.007263%
31021 frames successfully decoded, 0 decoding errors
Statistics: 4 seeks, 31024 writeouts

Result: very bad audio, distortion
Same result with

$ ffmpeg -debug 1 -vn -f alsa -ac 2 -channel_layout stereo -i hw:0,0 -ar 44100 -ab 320k -c:a mp3 /Store3/Test/mp3_`date +%m%d_%H%M`.mp3

Result: very bad audio, distortion

$ ffplay -debug 1 -f alsa -ac 2 -i hw:0,0

Result: statics after almost every bip.

More tests with other applications:
Audacity
With Alsa, input: default then pulse then ALC892 (hw:0,0)
Result: with these 3 different parameters, audio is perfect.

recordmydesktop
input: DEFAULT
result: audio is perfect.

gnome-sound-recorder 2.29.91
Record from input: Capture
format flac, ogg, pm3
Result: with these 3 different formats, audio is perfect.

arecord
arecord -f cd -t wav out.wav
Result: audio is perfect.

VLC
input hw:0,0
Result: static after every bip.

Attachments (9)

test_bip.mp3 (1.5 MB ) - added by Jean-Pierre 11 years ago.
Input file played in a mp3 player
pcm_0426_1018.wav (1.1 MB ) - added by Jean-Pierre 11 years ago.
Recorded with ffmpeg codec pcm (example 1)
mp3_0426_1019.mp3 (243.9 KB ) - added by Jean-Pierre 11 years ago.
Recorded with ffmpeg codec mp3 (example 2)
gnomerecord.flac (397.0 KB ) - added by Jean-Pierre 11 years ago.
Recorded with gnome record codec pcm (good quality)
out2.wav (1.5 MB ) - added by Jean-Pierre 11 years ago.
ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0,0 out2.wav => Still bad
outffmpeg1.wav (1.9 MB ) - added by Jean-Pierre 11 years ago.
outffmpeg2.wav (1.9 MB ) - added by Jean-Pierre 11 years ago.
outarecord.wav (2.1 MB ) - added by Jean-Pierre 11 years ago.
perfect record like direct connection to player with headphones
outvlc.wav (1.9 MB ) - added by Jean-Pierre 11 years ago.
Tics with VLC

Change History (117)

by Jean-Pierre, 11 years ago

Attachment: test_bip.mp3 added

Input file played in a mp3 player

by Jean-Pierre, 11 years ago

Attachment: pcm_0426_1018.wav added

Recorded with ffmpeg codec pcm (example 1)

by Jean-Pierre, 11 years ago

Attachment: mp3_0426_1019.mp3 added

Recorded with ffmpeg codec mp3 (example 2)

by Jean-Pierre, 11 years ago

Attachment: gnomerecord.flac added

Recorded with gnome record codec pcm (good quality)

comment:1 by Carl Eugen Hoyos, 11 years ago

What does ffmpeg say about the wav file recorded with arecord?

in reply to:  1 ; comment:2 by Jean-Pierre, 11 years ago

Replying to cehoyos:

What does ffmpeg say about the wav file recorded with arecord?

Sorry, could you tell me what do you mean? What I have do do?
Thanks

in reply to:  2 comment:3 by Jean-Pierre, 11 years ago

Replying to MrNice:

Replying to cehoyos:

What does ffmpeg say about the wav file recorded with arecord?

Sorry, could you tell me what do you mean? What I have do do?
Thanks

If you mean that
$ arecord -f cd -t wav out.wav
Recording WAVE '/Store3/Test/out.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Aborted by signal Interrupt...

then

$ ffprobe out.wav
ffprobe version N-52061-g8137ea3 Copyright (c) 2007-2013 the FFmpeg developers

built on Apr 13 2013 21:10:51 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
configuration: --prefix=/opt/ffmpeg-opt/usr --enable-shared --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64 --optflags='-O2 -g' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --disable-libv4l2 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --build-suffix=1 --disable-doc --enable-runtime-cpudetect
libavutil 52. 26.100 / 52. 26.100
libavcodec 55. 2.100 / 55. 2.100
libavformat 55. 2.100 / 55. 2.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 53.101 / 3. 53.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

[wav @ 0x95e160] max_analyze_duration 5000000 reached at 5015510 microseconds
Input #0, wav, from 'out.wav':

Duration: 00:00:19.50, bitrate: 1411 kb/s

Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s

Hope this will help

Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:4 by Carl Eugen Hoyos, 11 years ago

Does the following sound better?
$ ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0,0 out.wav

comment:5 by Jean-Pierre, 11 years ago

$ ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0,0 out2.wav
ffmpeg version N-52061-g8137ea3 Copyright (c) 2000-2013 the FFmpeg developers

built on Apr 13 2013 21:10:51 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
configuration: --prefix=/opt/ffmpeg-opt/usr --enable-shared --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64 --optflags='-O2 -g' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --disable-libv4l2 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --build-suffix=1 --disable-doc --enable-runtime-cpudetect
libavutil 52. 26.100 / 52. 26.100
libavcodec 55. 2.100 / 55. 2.100
libavformat 55. 2.100 / 55. 2.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 53.101 / 3. 53.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':

Duration: N/A, start: 1366995077.632556, bitrate: 1411 kb/s

Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s

Output #0, wav, to '/Store3/Test/out2.wav':

Metadata:

ISFT : Lavf55.2.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s

Stream mapping:

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

Press [q] to stop, ? for help
size= 1557kB time=00:00:09.03 bitrate=1411.3kbits/s
video:0kB audio:1557kB subtitle:0 global headers:0kB muxing overhead 0.005017%

by Jean-Pierre, 11 years ago

Attachment: out2.wav added

ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0,0 out2.wav => Still bad

comment:6 by Jean-Pierre, 11 years ago

Hi,

Do you need more info, more test?
Do you know what is the culprit?
Do you know a workaround?

Many thanks

comment:7 by Jean-Pierre, 11 years ago

More tests.

With the command
ffmpeg -debug 1 -vn -f alsa -ac 2 -channel_layout stereo -i hw:0,0 /Store3/Test/x_date +%m%d_%H%M.???

with ??? = aac,ac3,eac3,flac,mp2,mp3,ogg,opus,ra,rm,wav,wma

All the recorded files have glitches and distortion.

Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:8 by Carl Eugen Hoyos, 11 years ago

Did you already test an old version of FFmpeg? Like for example 35fd812.

comment:9 by Jean-Pierre, 11 years ago

Is this version good for comparison?

]$ ffmpeg -debug 1 -vn -f alsa -i hw:0,0 /Store3/Test/x_`date +%m%d_%H%M`.flac
ffmpeg version 0.10.4 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 25 2012 15:45:46 with gcc 4.4.6 20120305 (Red Hat 4.4.6-4)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
[pcm_s16le @ 0x239b380] err{or,}_recognition separate: 1; 1
[pcm_s16le @ 0x239b380] err{or,}_recognition combined: 1; 10001
[alsa @ 0x2395000] All info found
[alsa @ 0x2395000] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1368958115.772355, bitrate: N/A
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[flac @ 0x2393120] err{or,}_recognition separate: 1; 1
[flac @ 0x2393120] err{or,}_recognition combined: 1; 10001
[flac @ 0x2393120]  compression: 5
[flac @ 0x2393120]  lpc type: Levinson-Durbin recursion with Welch window
[flac @ 0x2393120]  prediction order: 1, 8
[flac @ 0x2393120]  order method: estimate
[flac @ 0x2393120]  partition order: 0, 8
[flac @ 0x2393120]  block size: 4608
[flac @ 0x2393120]  lpc precision: 15
[pcm_s16le @ 0x239b380] err{or,}_recognition separate: 1; 10001
[pcm_s16le @ 0x239b380] err{or,}_recognition combined: 1; 10001
Output #0, flac, to '/Store3/Test/x_0519_1108.flac':
  Metadata:
    encoder         : Lavf53.32.100
    Stream #0:0, 0, 1/90000: Audio: flac, 48000 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> flac)
Press [q] to stop, [?] for help
size=    1164kB time=00:00:25.63 bitrate= 372.0kbits/s    
video:0kB audio:1156kB global headers:0kB muxing overhead 0.697357%

Same distortions with different codecs

Thanks to read me, I started to lose hope as nobody seems to have this bug and I had no answer.
If you need more tests just ask me.
Many thanks again.

comment:10 by Carl Eugen Hoyos, 11 years ago

Does it work with 35fd812?

Please always test wav output to rule out other problems.

comment:11 by Jean-Pierre, 11 years ago

Sorry, I don't master the package building. I have to ask a guy to do it with the 35fd812.
If you could provide me the direct link where to find this version I'll give him for more convenience.

comment:12 by Jean-Pierre, 11 years ago

Hi cehoyos,

The guy in charge of package/rebuild ask me to get a link to the 35fd812 version.
Hi can't find it.
Could you, please provide it?
Thanks.

comment:13 by Carl Eugen Hoyos, 11 years ago

$ git checkout 35fd812

comment:14 by Jean-Pierre, 11 years ago

Hi cehoyos,

I have an answer from the packager. He got an error for this branch:

h-errno -fno-signed-zeros      -fPIC -DPIC -c -o ffmpeg.o /media/home/symbianflo/rpmbuild/BUILD/ffmpeg/ffmpeg.c
make: *** No rule to make target `"/media/home/symbianflo/rpmbuild/BUILD/ffmpeg"/version.sh', needed by `version.h'.  Stop.
make: *** Waiting for unfinished jobs....
In file included from /media/home/symbianflo/rpmbuild/BUILD/ffmpeg/ffmpeg.c:37:
/media/home/symbianflo/rpmbuild/BUILD/ffmpeg/libavformat/framehook.h:25:2: warning: #warning VHOOK is deprecated. Please help finishing libavfilter instead of wasting your time writing new filters for this crappy filter system.
/media/home/symbianflo/rpmbuild/BUILD/ffmpeg/ffmpeg.c: In function 'output_packet':
/media/home/symbianflo/rpmbuild/BUILD/ffmpeg/ffmpeg.c:776: warning: dereferencing pointer 'picture2' does break strict-aliasing rules
/media/home/symbianflo/rpmbuild/BUILD/ffmpeg/ffmpeg.c:1306: note: initialized from here

This branch seems deprecated.
Do you have another branch I could try?

comment:15 by Carl Eugen Hoyos, 11 years ago

Please tell him to always run $ make distclean before building a package.

comment:16 by Carl Eugen Hoyos, 11 years ago

And while you are at it: Please test ./configure && make - some of the configure options you are using look suspicious to me.

comment:17 by Carl Eugen Hoyos, 11 years ago

Does the following work? Does it sound better?
$ ffmpeg -f alsa -i hw:0,0 out.wav

comment:18 by Jean-Pierre, 11 years ago

$ ffmpeg -f alsa -i hw:0,0 out.wav
ffmpeg version N-52061-g8137ea3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 13 2013 21:10:51 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration: --prefix=/opt/ffmpeg-opt/usr --enable-shared --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64 --optflags='-O2 -g' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --disable-libv4l2 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --build-suffix=1 --disable-doc --enable-runtime-cpudetect
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 53.101 /  3. 53.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1369063993.303548, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.2.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=    2011kB time=00:00:10.72 bitrate=1536.0kbits/s    
video:0kB audio:2011kB subtitle:0 global headers:0kB muxing overhead 0.003885%

Same glitches and distortion. :-(

comment:19 by Carl Eugen Hoyos, 11 years ago

What about $ ffmpeg -f alsa -ac 1 -i hw:0,0 out.wav ?

comment:20 by Jean-Pierre, 11 years ago

$ ffmpeg -f alsa -ac 1 -i hw:0,0 out.wav
ffmpeg version N-52061-g8137ea3 Copyright (c) 2000-2013 the FFmpeg developers

built on Apr 13 2013 21:10:51 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
configuration: --prefix=/opt/ffmpeg-opt/usr --enable-shared --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64 --optflags='-O2 -g' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --disable-libv4l2 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --build-suffix=1 --disable-doc --enable-runtime-cpudetect
libavutil 52. 26.100 / 52. 26.100
libavcodec 55. 2.100 / 55. 2.100
libavformat 55. 2.100 / 55. 2.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 53.101 / 3. 53.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

[alsa @ 0x9fb320] cannot set channel count to 1 (Invalid argument)
hw:0,0: Input/output error

comment:21 by Jean-Pierre, 11 years ago

 ffmpeg -f alsa -ac 2 -i hw:0,0 out.wav

Same glitches and distortion.

Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:22 by Jean-Pierre, 11 years ago

ok , with make distclean this is the exit:
Code: [Select all] [Show/ hide]

Makefile:1: config.mak: No such file or directory
libavdevice/Makefile:1: libavdevice/../config.mak: No such file or directory
libavformat/Makefile:1: libavformat/../config.mak: No such file or directory
libavcodec/Makefile:1: libavcodec/../config.mak: No such file or directory
libavutil/Makefile:1: libavutil/../config.mak: No such file or directory
> vhook/watermark.d
> vhook/null.d
> vhook/fish.d
> libavutil/utils.d
> libavutil/tree.d
> libavutil/string.d
> libavutil/sha1.d
> libavutil/rc4.d
> libavutil/rational.d
> libavutil/random.d
> libavutil/mem.d
> libavutil/md5.d
> libavutil/mathematics.d
> libavutil/lzo.d
> libavutil/log.d
> libavutil/lls.d
> libavutil/lfg.d
> libavutil/intfloat_readwrite.d
> libavutil/fifo.d
> libavutil/des.d
> libavutil/crc.d
> libavutil/base64.d
> libavutil/aes.d
> libavutil/adler32.d
make: *** No rule to make target `libavutil/../config.mak'.  Stop.
make: *** Waiting for unfinished jobs....
error: Bad exit status from /media/home/symbianflo/rpmbuild/tmp/rpm-tmp.OjvEpM (%build)

If you want to check the spec file:
http://mrb.mandrivausers.ro/MRB/stella/testing/ffmpeg-opt-novfl-git.spec

and the build log with "make distclean":
http://mrb.mandrivausers.ro/MRB/stella/testing/ffmpeg-build

I am not good enough to look at that. I only idea I have is to find another working version to try.
Or if you can find an issue in the build spec...

comment:23 by Carl Eugen Hoyos, 11 years ago

Sorry for not testing this myself, the commit I mentioned is broken, the subsequent one f2f35d3 works!
Navigate to http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=f2f35d3;sf=tgz and accept the tarball for download, then execute the following commands:

$ tar xf ffmpeg-f2f35d3.tar.gz
$ cd ffmpeg-f2f35d3/
$ ./configure && make ffmpeg

The resulting file ffmpeg is a standalone executable that you do not have to install but can either run from the build directory or wherever you want to copy it.

comment:24 by Jean-Pierre, 11 years ago

Hi
My new test

$ ffmpeg -f alsa -ac 2 -i hw:0,0 out.wav
FFmpeg version UNKNOWN, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --prefix=/opt/ffmpeg-opt/usr --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64
  libavutil     49.14. 0 / 49.14. 0
  libavcodec    52.11. 0 / 52.11. 0
  libavformat   52.25. 0 / 52.25. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on May 21 2013 15:29:58, gcc: 4.4.7 20120313 (Red Hat 4.4.7-3)
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 46721.105014, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Output #0, wav, to 'out.wav':
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=    2516kB time=14.61 bitrate=1411.2kbits/s    
video:0kB audio:2516kB global headers:0kB muxing overhead 0.001708%

Now audio is good :-)
I tried with flac and mp3 as well, this is good.
I went further and run the command in the first post above.

ffmpeg-opt -debug 1 -vn -f alsa -ac 2 -channel_layout stereo -i hw:0,0 -c:a pcm_s16le /Store3/Test/pcm_`date +%m%d_%H%M`.wav
FFmpeg version UNKNOWN, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --prefix=/opt/ffmpeg-opt/usr --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64
  libavutil     49.14. 0 / 49.14. 0
  libavcodec    52.11. 0 / 52.11. 0
  libavformat   52.25. 0 / 52.25. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on May 21 2013 15:29:58, gcc: 4.4.7 20120313 (Red Hat 4.4.7-3)
Unable to parse option value "stereo": undefined constant or missing (
Invalid value 'stereo' for option 'channel_layout'

I'd guess you know why this error.
But we did a good step.
What next?

in reply to:  24 comment:25 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

$ ffmpeg -f alsa -ac 2 -i hw:0,0 out.wav
FFmpeg version UNKNOWN, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --prefix=/opt/ffmpeg-opt/usr --bindir=/opt/ffmpeg-opt/usr/bin --datadir=/opt/ffmpeg-opt/usr/share/ffmpeg-opt --incdir=/opt/ffmpeg-opt/usr/include/ffmpeg-opt --libdir=/opt/ffmpeg-opt/usr/lib64 --mandir=/opt/ffmpeg-opt/usr/share/man --shlibdir=/opt/ffmpeg-opt/usr/lib64 --arch=x86_64
  libavutil     49.14. 0 / 49.14. 0
  libavcodec    52.11. 0 / 52.11. 0
  libavformat   52.25. 0 / 52.25. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on May 21 2013 15:29:58, gcc: 4.4.7 20120313 (Red Hat 4.4.7-3)
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 46721.105014, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Output #0, wav, to 'out.wav':
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=    2516kB time=14.61 bitrate=1411.2kbits/s    
video:0kB audio:2516kB global headers:0kB muxing overhead 0.001708%

Now audio is good :-)

Then please use git bisect to find the change introducing the problem.
(And please do not waste time with other tests, I really don't think they make any sense if you want to solve the problem.)

git bisect sometimes doesn't work well with FFmpeg, I will help you if necessary.

comment:26 by Carl Eugen Hoyos, 11 years ago

Keywords: regression added
Priority: normalimportant
Version: unspecifiedgit-master

comment:27 by Carl Eugen Hoyos, 11 years ago

The following configure line should significantly speed up build time and make the bisecting easier (this time tested):
./configure --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters && make ffmpeg

Some versions will not link with above configure line, you will have to use ./configure && make ffmpeg for them.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:28 by Jean-Pierre, 11 years ago

Please find the answer from packager guy after your last post:


That's ok , those are the configure parameters , now I need a source to apply this configure --%_parameters against , is the same git as before? Or other ?Or nevermind ,it can be applied to all sources?

And also

--enable-protocol=file

I need to know if is mandatory , because I don't know what he understand by "protocol", or if he can give some literature about this "protocol" option.


Could you provide?

comment:29 by Carl Eugen Hoyos, 11 years ago

I don't think this is something your packager can do for you (except if he also does the tests), and I don't understand the questions. (Did you tell him this is for a git bisect?)
You don't have to use the configure line I provided - the tests can also be done with ./configure && make - I only provided it to allow you to speed the bisect (significantly) up.

comment:30 by Jean-Pierre, 11 years ago

Mainly, I am only a user, even I have networking and database skills, this is useless in this case.
I use Stella (remix of Centos) and I never did a build/compile.

The guy in charge of build/package has lot a experience and is very quick in his answers, but he can't do the tests.
I copy/past the posts you wrote, so he knows this is for git bisect.

Now you told that the same should do the tests and the build/compile. I am ready to try but I need a step by step process and I don't want to crash my install.
I'll forward you answer to him.

comment:31 by Carl Eugen Hoyos, 11 years ago

The following assumes you have a toolchain installed (gcc and make) and git, when I write mplayer out.wav you can use any program to test if out.wav plays fine or with distortions.
You should not be administrator and you should not install any of the binaries you build.
Instead of ./configure && make ffmpeg you can use above (long) configure line which speeds up compilation very significantly, but will sometimes fail linking, then just run ./configure && make ffmpeg
Instead of make ffmpeg, you can always use make -j16 ffmpeg depending on how many CPUs you have.
First checkout the FFmpeg sources:

$ git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

Change into the FFmpeg directory:

$ cd ffmpeg

Compile current FFmpeg to verify the problem:

$ ./configure && make ffmpeg

Record:

$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav

Test for distortions:

$ mplayer out.wav

(You should hear distortions)
Start the bisect:

$ make distclean && git bisect bad

(Say yes)
Checkout the presumably working version:

$ git checkout f2f35d3

Build:

$ ./configure && make ffmpeg

Record:

$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav

Test for distortions:

$ mplayer out.wav

(Should sound fine)
Tell git that it works:

$ make distclean && git bisect good

Now you start with the recursive process:

$ ./configure && make ffmpeg
$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
$ mplayer out.wav

If you hear distortions, you use:

$ make distclean && git bisect bad

If you did not hear distortions, tell git everything is fine:

$ make distclean && git bisect good

Unfortunately, git will sometimes try to let you test versions that do not contain FFmpeg, if git bisect skip does not help you, post here and I will support you.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:32 by Jean-Pierre, 11 years ago

Hi cehoyos,

I started your process. I installed git, gcc and yasm.
I run the 2 first steps then the big ./configure (comment: 27)
Everything OK
Now Record:

ffmpeg]$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
ffmpeg version N-53363-g1fded9b Copyright (c) 2000-2013 the FFmpeg developers
  built on May 23 2013 10:33:10 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration: --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters
  libavutil      52. 33.100 / 52. 33.100
  libavcodec     55. 10.101 / 55. 10.101
  libavformat    55.  7.100 / 55.  7.100
  libavdevice    55.  1.101 / 55.  1.101
  libavfilter     3. 69.100 /  3. 69.100
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Unknown input format: 'alsa'

alsa is not here.
What I have to do?

comment:33 by Carl Eugen Hoyos, 11 years ago

Try yum install alsa-lib-devel - I don't know if that is correct on your system, but configure's output tells you under indevs if alsa was found.
(I assumed your admin was compiling on your computer.)

comment:34 by Carl Eugen Hoyos, 11 years ago

I have just learned about a simplification.
After the initial checkout, before running git bisect bad for the first time, run the following from the ffmpeg directory:

$ tools/bisect-create
$ tools/ffbisect need ffmpeg

You can now always use tools/ffbisect good / tools/ffbisect bad instead of git bisect good / git bisect bad to further speed up the overall process (some revisions will be skipped automatically).

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:35 by Jean-Pierre, 11 years ago

I am not at this point yet.

I installed alsa-lib-devel but I get the same error.

Previously configure output told:

Enabled indevs:
fbdev			oss			v4l2
lavfi

I am stuck.

comment:36 by Carl Eugen Hoyos, 11 years ago

Google suggests:

$ yum install 'pkgconfig(alsa)'

comment:37 by Jean-Pierre, 11 years ago

# yum install 'pkgconfig(alsa)'
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.ox.ac.uk
 * elrepo: mirrors.coreix.net
 * epel: mirror.serverbeheren.nl
 * extras: centos.mirroring.pulsant.co.uk
 * nux-dextop: mirror.li.nux.ro
 * nux-libreoffice.org-rpms: mirror.li.nux.ro
 * updates: mirror.i3d.net
Setting up Install Process
Package alsa-lib-devel-1.0.22-3.el6.x86_64 already installed and latest version
Nothing to do

comment:38 by Carl Eugen Hoyos, 11 years ago

Please post the content of config.log from the line starting with check_lib2 alsa/asoundlib.h until the line starting with check_lib2 jack/jack.h

comment:39 by Jean-Pierre, 11 years ago

Just 1 line before as I saw an error

/tmp/ffconf.lA1F3Ezg.c:1:23: error: soundcard.h: No such file or directory
check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
check_func_headers alsa/asoundlib.h snd_pcm_htimestamp -lasound
check_ld cc -lasound
check_cc
BEGIN /tmp/ffconf.lA1F3Ezg.c
    1	#include <alsa/asoundlib.h>
    2	long check_snd_pcm_htimestamp(void) { return (long) snd_pcm_htimestamp; }
    3	int main(void) { return 0; }
END /tmp/ffconf.lA1F3Ezg.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -std=c99 -fomit-frame-pointer -pthread -c -o /tmp/ffconf.BRmH3SUu.o /tmp/ffconf.lA1F3Ezg.c
/tmp/ffconf.lA1F3Ezg.c:1:28: error: alsa/asoundlib.h: No such file or directory
/tmp/ffconf.lA1F3Ezg.c: In function 'check_snd_pcm_htimestamp':
/tmp/ffconf.lA1F3Ezg.c:2: error: 'snd_pcm_htimestamp' undeclared (first use in this function)
/tmp/ffconf.lA1F3Ezg.c:2: error: (Each undeclared identifier is reported only once
/tmp/ffconf.lA1F3Ezg.c:2: error: for each function it appears in.)
check_lib2 jack/jack.h jack_client_open -ljack

in reply to:  39 comment:40 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

/tmp/ffconf.lA1F3Ezg.c:1:28: error: alsa/asoundlib.h: No such file or directory

This page claims that alsa-lib-devel-1.0.22-3.el6.x86_64 (the package already installed on your system) contains /usr/include/alsa/asoundlib.h:
http://pkgs.org/centos-6-rhel-6/centos-rhel-x86_64/alsa-lib-devel-1.0.22-3.el6.x86_64.rpm.html

Can you verify if the header is there or not or uninstall and reinstall the package?

comment:41 by Jean-Pierre, 11 years ago

I did
cd /usr/include/alsa
then

 alsa]$ ls
alisp.h             hwdep.h         pcm.h         seqmid.h
asoundef.h          iatomic.h       pcm_ioplug.h  seq_midi_event.h
asoundlib.h         input.h         pcm_old.h     sound
conf.h              mixer_abst.h    pcm_plugin.h  timer.h
control_external.h  mixer.h         pcm_rate.h    version.h
control.h           output.h        rawmidi.h
error.h             pcm_external.h  seq_event.h
global.h            pcm_extplug.h   seq.h

asoundlib.h is here
I'll uninstall ans reinstall

comment:42 by Jean-Pierre, 11 years ago

Nothing better.

I did some reading on Internet.
Seems I have to restart from first step to compile(?), configure with alsa support
I restart

comment:43 by Jean-Pierre, 11 years ago

OK I did again the big .configure and run

ffmpeg]$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
ffmpeg version N-53363-g1fded9b Copyright (c) 2000-2013 the FFmpeg developers
  built on May 23 2013 13:04:41 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration: --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters
  libavutil      52. 33.100 / 52. 33.100
  libavcodec     55. 10.101 / 55. 10.101
  libavformat    55.  7.100 / 55.  7.100
  libavdevice    55.  1.101 / 55.  1.101
  libavfilter     3. 69.100 /  3. 69.100
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1369310797.781217, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.7.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)

Unfortunately, audio is distorted like the official install

in reply to:  43 comment:44 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

Unfortunately, audio is distorted like the official install

You mean:
Fortunately, the test did not reveal any problems in the initial tries (compiled by your admin), and you can start bisecting now as explained above.
Or do I misunderstand?

comment:45 by Jean-Pierre, 11 years ago

For some reason I thought that the version in the git was your I tested good.
So I carry on.

comment:46 by Jean-Pierre, 11 years ago

I forgot to do you comment 34 about simplification
I carry on with the command in comment 31
Running

in reply to:  45 comment:47 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

For some reason I thought that the version in the git was your I tested good.

If git head (that is what you tested) would work fine, there would be nothing to fix...

comment:48 by Jean-Pierre, 11 years ago

Second test after new ./configure has good audio
Did

$ make distclean && git bisect good

Run ./configure and got

make: *** No rule to make target `ffmpeg'.  Stop.
Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:49 by Carl Eugen Hoyos, 11 years ago

Please test e2cc331

$ make distclean
$ git checkout e2cc331
$ ./configure ...

comment:50 by Jean-Pierre, 11 years ago

Did

$ make distclean
$ git checkout e2cc331
$ ./configure ...

record => audio was bad

$ make distclean && git bisect bad
$ ./configure ...

got

collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

in reply to:  50 comment:51 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

$ ./configure ...

got

collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1

Did you use the long or the short configure line?
This problem can happen with the long line (that compiles much faster), in such a case, just use ./configure && make ffmpeg when you get the linking error (ld returned 1 exit status).

comment:52 by Jean-Pierre, 11 years ago

I did few recursive run (still bad audio) and now got

 ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
FFmpeg version git-00798e4, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat   52.30. 1 / 52.30. 1
  libavdevice   52. 1. 0 / 52. 1. 0
  built on May 23 2013 15:59:09, gcc: 4.4.7 20120313 (Red Hat 4.4.7-3)
Unknown input or output format: alsa
Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:53 by Carl Eugen Hoyos, 11 years ago

Please test 70ec53a

$ make distclean
$ git checkout 70ec53a
$ ./configure ...

comment:54 by Jean-Pierre, 11 years ago

I found the first good audio, I did

make distclean && git bisect good
rm -f  *.o *~ *.ho *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map 
rm -f  libavdevice/*.o libavdevice/*~ libavdevice/*.ho libavdevice/*.a libavdevice/*.lib libavdevice/*.so libavdevice/*.so.* libavdevice/*.dylib libavdevice/*.dll libavdevice/*.def libavdevice/*.dll.a libavdevice/*.exp libavdevice/*.map 
rm -f  libavformat/*.o libavformat/*~ libavformat/*.ho libavformat/*.a libavformat/*.lib libavformat/*.so libavformat/*.so.* libavformat/*.dylib libavformat/*.dll libavformat/*.def libavformat/*.dll.a libavformat/*.exp libavformat/*.map 
rm -f libavcodec/cabac-test libavcodec/dct-test libavcodec/eval-test libavcodec/fft-test libavcodec/h264-test libavcodec/rangecoder-test libavcodec/snow-test libavcodec/imgresample-test libavcodec/x86/cpuid-test libavcodec/motion-test libavcodec/apiexample libavcodec/*.o libavcodec/*~ libavcodec/*.ho libavcodec/*.a libavcodec/*.lib libavcodec/*.so libavcodec/*.so.* libavcodec/*.dylib libavcodec/*.dll libavcodec/*.def libavcodec/*.dll.a libavcodec/*.exp libavcodec/*.map libavcodec/alpha/*.o libavcodec/arm/*.o libavcodec/bfin/*.o libavcodec/mlib/*.o libavcodec/ppc/*.o libavcodec/ps2/*.o libavcodec/sh4/*.o libavcodec/sparc/*.o libavcodec/x86/*.o libavcodec/alpha/*~ libavcodec/arm/*~ libavcodec/bfin/*~ libavcodec/mlib/*~ libavcodec/ppc/*~ libavcodec/ps2/*~ libavcodec/sh4/*~ libavcodec/sparc/*~ libavcodec/x86/*~ libavcodec/alpha/*.ho libavcodec/arm/*.ho libavcodec/bfin/*.ho libavcodec/mlib/*.ho libavcodec/ppc/*.ho libavcodec/ps2/*.ho libavcodec/sh4/*.ho libavcodec/sparc/*.ho libavcodec/x86/*.ho
rm -f libavutil/adler32-test libavutil/aes-test libavutil/base64-test libavutil/crc-test libavutil/des-test libavutil/lls-test libavutil/md5-test libavutil/pca-test libavutil/random-test libavutil/sha1-test libavutil/softfloat-test libavutil/tree-test libavutil/*.o libavutil/*~ libavutil/*.ho libavutil/*.a libavutil/*.lib libavutil/*.so libavutil/*.so.* libavutil/*.dylib libavutil/*.dll libavutil/*.def libavutil/*.dll.a libavutil/*.exp libavutil/*.map libavutil/arm/*.o libavutil/bfin/*.o libavutil/sh4/*.o libavutil/x86/*.o libavutil/arm/*~ libavutil/bfin/*~ libavutil/sh4/*~ libavutil/x86/*~ libavutil/arm/*.ho libavutil/bfin/*.ho libavutil/sh4/*.ho libavutil/x86/*.ho
rm -rf tests/vsynth1 tests/vsynth2 tests/data tests/asynth1.sw tests/*~
rm -f ffmpeg ffplay ffserver ffmpeg_g ffplay_g ffserver_g output_example
rm -f doc/*.html doc/*.pod doc/*.1
rm -f tests/audiogen tests/videogen tests/rotozoom tests/seek_test tests/tiny_psnr
rm -f tools/cws2fws tools/pktdumper tools/qt-faststart tools/trasher
rm -f vhook/*.o vhook/*~ vhook/*.so vhook/*.dylib vhook/*.dll
rm -f  *.d *.pc 
rm -f  libavdevice/*.d libavdevice/*.pc 
rm -f  libavformat/*.d libavformat/*.pc 
rm -f  libavcodec/*.d libavcodec/*.pc libavcodec/alpha/*.d libavcodec/arm/*.d libavcodec/bfin/*.d libavcodec/mlib/*.d libavcodec/ppc/*.d libavcodec/ps2/*.d libavcodec/sh4/*.d libavcodec/sparc/*.d libavcodec/x86/*.d libavcodec/alpha/*.pc libavcodec/arm/*.pc libavcodec/bfin/*.pc libavcodec/mlib/*.pc libavcodec/ppc/*.pc libavcodec/ps2/*.pc libavcodec/sh4/*.pc libavcodec/sparc/*.pc libavcodec/x86/*.pc
rm -f  libavutil/*.d libavutil/*.pc libavutil/arm/*.d libavutil/bfin/*.d libavutil/sh4/*.d libavutil/x86/*.d libavutil/arm/*.pc libavutil/bfin/*.pc libavutil/sh4/*.pc libavutil/x86/*.pc
rm -f version.h config.* vhook/*.d
Bisecting: 449 revisions left to test after this (roughly 9 steps)
[cbf3cf19f3dec3a3788b15d31db9795de5e42ed9] Support "next parameter flags present" flag.

What next?

comment:55 by Carl Eugen Hoyos, 11 years ago

Just continue:

$ ./configure ...
$ ./ffmpeg -f alsa ...
$ mplayer out.wav
$ git bisect ...

git bisect will tell when you have found the commit introducing the regression.

comment:56 by Carl Eugen Hoyos, 11 years ago

We can (probably) speed this up if you want:
Please test 3cac2f1 and 743b389

comment:57 by Jean-Pierre, 11 years ago

Hi,

I am still working with git bisect, now for hours.
Is there a way to check where I am in the recursive loop.
I did not change for the other branch you gave me in you last comment: 56
Can you check and decide if the best is to carry on or to change to another branch?

Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:58 by Carl Eugen Hoyos, 11 years ago

You can probably speed the bisecting up if you want:
Please test 3cac2f1 and 743b389

comment:59 by Jean-Pierre, 11 years ago

Could you check if I can use this small script to speed the process? Thanks

#!/bin/bash

nbloop = 0

while true;
do
nbloop = nbloop + 1

./configure --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters && make ffmpeg

./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav -t 0:0:08

mplayer out.wav -loop 10

echo "loops num:" nbloop$

echo [g]ood or [b]ad sound? [e]xit [p]lay
read KB

case $KB in
g)
	make distclean && git bisect good
	echo GOOD;;

b)
	make distclean && git bisect bad
	echo BAD;;

p)
	mplayer out.wav -loop 4;;

e)
	exit;;
esac


done
Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:60 by Carl Eugen Hoyos, 11 years ago

Please run the following:

$ make distclean
$ git checkout 3cac2f1
$ ./configure --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters && make -j3 ffmpeg
$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav

Now test out.wav, I would expect it to play with distortions, if that is wrong (if it plays fine), just continue the bisect with make distclean && git bisect good
If - as I expect - out.wav plays with distortions:

$ make distclean && git bisect bad
$ git checkout 743b389
$ ./configure --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters && make -j3 ffmpeg
$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav

out.wav should play fine, if that is correct please finish with:

$ make distclean && git bisect good

git will then tell about the result of the test, run git bisect reset && git checkout master && git pull to get back to git head.

I suspect the following information will be needed:
The hardware that you are using to record alsa (that may be your mainboard or your sound card)
The driver used for the audio device
(This is likely a driver bug but i may be wrong, above information will help to find out.)

comment:61 by Jean-Pierre, 11 years ago

You are right, first record was bad, second was good.
No need to enter hardware info.

$ git bisect reset && git checkout master && git pull
Previous HEAD position was 743b389... rtpmap is case-insensitive, see comment from Luca in "[PATCH] rtsp.c: keep-alive" thread.
Switched to branch 'master'
Already on 'master'
remote: Counting objects: 274, done.
remote: Compressing objects: 100% (187/187), done.
remote: Total 187 (delta 145), reused 0 (delta 0)
Receiving objects: 100% (187/187), 49.67 KiB, done.
Resolving deltas: 100% (145/145), completed with 65 local objects.
From git://source.ffmpeg.org/ffmpeg
   1fded9b..a4d3757  master     -> origin/master
Updating 1fded9b..a4d3757
Fast-forward
 Changelog                                          |    1 +
 Makefile                                           |    2 +-
 {libavcodec => compat}/w32pthreads.h               |   14 +-
 doc/APIchanges                                     |    4 +
 doc/Doxyfile                                       |    2 +-
 doc/filters.texi                                   |    4 +-
 doc/general.texi                                   |    3 +-
 libavcodec/Makefile                                |    2 +-
 libavcodec/allcodecs.c                             |    2 +-
 libavcodec/avcodec.h                               |   17 ++
 libavcodec/codec_desc.c                            |    2 +-
 libavcodec/escape124.c                             |    8 +-
 libavcodec/escape130.c                             |    5 +-
 libavcodec/frame_thread_encoder.c                  |    2 +-
 libavcodec/fraps.c                                 |    1 +
 libavcodec/h264.c                                  |   12 +-
 libavcodec/h264.h                                  |    1 +
 libavcodec/h264_parser.c                           |   57 +++++++
 libavcodec/libaacplus.c                            |   24 ++--
 libavcodec/libfaac.c                               |   17 ++-
 libavcodec/mpegvideo.h                             |    2 +-
 libavcodec/pthread.c                               |    2 +-
 libavcodec/s302menc.c                              |  177 ++++++++++++++++++++
 libavcodec/version.h                               |    4 +-
 libavcodec/vp8.h                                   |    2 +-
 libavcodec/wavpack.c                               |  173 ++++++++++----------
 libavfilter/version.h                              |    2 +-
 libavfilter/vsrc_testsrc.c                         |   40 ++---
 libavformat/mtv.c                                  |    6 +-
 libavformat/network.c                              |    2 +-
 libavutil/opencl.c                                 |   28 ++--
 libpostproc/postprocess_template.c                 |   42 +++---
 tests/Makefile                                     |    1 +
 tests/fate/lossless-audio.mak                      |    3 -
 tests/fate/monkeysaudio.mak                        |   20 +++
 ...less-monkeysaudio => lossless-monkeysaudio-399} |    0
 tools/patcheck                                     |    2 +-
 37 files changed, 485 insertions(+), 201 deletions(-)
 rename {libavcodec => compat}/w32pthreads.h (96%)
 create mode 100644 libavcodec/s302menc.c
 create mode 100644 tests/fate/monkeysaudio.mak
 rename tests/ref/fate/{lossless-monkeysaudio => lossless-monkeysaudio-399} (100%)

What are your comments?

in reply to:  61 comment:62 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

You are right, first record was bad, second was good.

Regression since 3cac2f1.

This is likely an alsa driver bug, please test the following:

$ arecord -N -f cd -t wav out.wav

If out.wav plays with distortions, nonblocking mode does not work on your device with your driver.
Your alsa driver version - 1.0.22 - is a little old, perhaps there is an update?

comment:63 by Jean-Pierre, 11 years ago

With arecord audio in perfect, even better than with ffmpeg.
My source is a loop of bip every second. With ffmpeg every 10 or 15 bips I have a little "tic" like a static. With arecord nothing like that.

I tried with VLC not recording but streaming from my audio card. After every bip I have a "tic" about 0.5 second after.
I'll ask for the driver.

But what I have to do now to fix that?

in reply to:  63 comment:64 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

With arecord audio in perfect, even better than with ffmpeg.

Just to avoid confusions:
Could you clarify that you tested the command line I posted in comment:62 and there are no distortions in the output file out.wav?

comment:65 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavdevice

comment:66 by Jean-Pierre, 11 years ago

I did it again, copy/past of each command from comment 62 one after the other.
after git checkout 3cac2f1, record was bad. No comment.
after git checkout 743b389, record was what I could consider good even it's not perfect. Listen attached outffmpeg.wav:
The first bip is longer, this is when the player loops => this is ok
Just before the 4th bip there is a tic, same before the 6th, 11st 19th, and more

For comparison I recorded with the command you gave previously;
arecord -N -f cd -t wav out.wav
This is perfect. Listen attached outarecord.wav

I use a headphones to listen.

Edit I can't attach the files, I do it again

Last edited 11 years ago by Jean-Pierre (previous) (diff)

by Jean-Pierre, 11 years ago

Attachment: outffmpeg1.wav added

by Jean-Pierre, 11 years ago

Attachment: outffmpeg2.wav added

by Jean-Pierre, 11 years ago

Attachment: outarecord.wav added

perfect record like direct connection to player with headphones

comment:67 by Jean-Pierre, 11 years ago

Listen attached files
after git checkout 743b389, record was what I could consider good even it's not perfect.
outffmpeg1.wav
tics just before bip 2 and bip 8

outffmpeg2.wav
tics just before bip 2 and bip 4

outarecord.wav
Perfect record no tic, exactly the same quality as direct headphone to player

comment:68 by Jean-Pierre, 11 years ago

Please compare with vlc record.
Tic between every bip.

by Jean-Pierre, 11 years ago

Attachment: outvlc.wav added

Tics with VLC

comment:69 by Jean-Pierre, 11 years ago

Do you need more git loops to find exactly where is the bug?
What I have to do now?

comment:70 by Carl Eugen Hoyos, 11 years ago

Did you already post which hardware you are using for recording and which driver version?
Sorry if I missed it.

comment:71 by Jean-Pierre, 11 years ago

I didn't, so:
Motherboard: ASRock 970 Extreme4
Audio device
product: SBx00 Azalia (Intel HDA) [1002:4383]
vendor: Hynix Semiconductor (Hyundai Electronics)
configuration:

driver: snd_hda_intel
latency: 32

OS: Linux Stella 6.4 (remix of Centos 6.4)
Kernel Linux 2.6.32-358.6.2.el6.x86_64
Gnome 2.28.2
Driver:
ALSA alsa-lib-1.0.22-3.el6(x86_64)

Do you need more info?
Could you sum-up your conclusion, please.

comment:72 by Carl Eugen Hoyos, 11 years ago

Summary: Audio glitches and distortion when recording and direct playAudio glitches and distortion when recording alsa

comment:73 by Carl Eugen Hoyos, 11 years ago

The conclusion is that - as you found out - this is a regression since 3cac2f1 for you.
You can disable the non-blocking mode by removing flags = SND_PCM_NONBLOCK; from line 193 in libavdevice/alsa-audio-common.c but since it is unlikely that there is a bug in FFmpeg (that is what another developer explained to me), I would suggest to test with updated (alsa) drivers, or, if this is possible, with another system that uses the same mainboard.

Some random ideas are to boot from a (recent) live CD and use one of the static binaries from http://ffmpeg.org/download.html - I don't know if they have alsa support though - or to switch harddisk and quickly install something more recent.

comment:74 by Jean-Pierre, 11 years ago

I have read that there is 2 parts of the ALSA driver. One is a kernel module the other is a library.
Where is this flag to remove?
What new version part do you want I try, module or lib?
I need these answers to choose another distribution I'll install in a empty HDD to test in the same computer.

comment:75 by Jean-Pierre, 11 years ago

I installed Ubuntu13.04 in a spare HD and I have run the basic command:

First versions:
!Kernel Information
!!------------------
Kernel release: 3.8.0-19-generic
Operating System: GNU/Linux
Architecture: x86_64
Processor: x86_64
SMP Enabled: Yes

!!ALSA Version
!!------------
Driver version: k3.8.0-19-generic
Library version: 1.0.25
Utilities version: 1.0.25

Second test:

$ ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
ffmpeg version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
  built on Mar 30 2013 22:20:06 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[alsa @ 0x114ab20] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 2575.326973, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    encoder         : Lavf53.21.1
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
^Csize=    3251kB time=17.34 bitrate=1536.0kbits/s    
video:0kB audio:3251kB global headers:0kB muxing overhead 0.001382%
Received signal 2: terminating.

I played with aplay and there is the distortion. Still bad.
Does this confirm your thought?
Alsa is now 1.0.25 instead of 1.0.22

What I have to do now to help to fix the bug?
Yes I need the bug to be fixed as I need to run ffmpeg to capture video and audio.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:76 by Carl Eugen Hoyos, 11 years ago

(Unrelated: On your Ubuntu installation, you did not test FFmpeg...)

My only remaining advice is to remove flags = SND_PCM_NONBLOCK; from line 193 in libavdevice/alsa-audio-common.c. Please report if this also fixes ticket #2478.
Since the non-blocking mode works for everybody else (with very different hardware and drivers), it is not very likely that there is a bug in FFmpeg and if there is a bug, it is unlikely that we will be able to fix it.
Were you able to test on different (but identical) hardware?

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:77 by Jean-Pierre, 11 years ago

As I stated previously, I am not skilled in development.
So, in my Stella OS, I found libavdevice/alsa-audio-common.c file in /home/username/ffmpeg/libadevice/.
I opened it with gedit, but there are only 186 lines in this file and no SND_PCM_NONBLOCK text.

I'll check in Ubuntu OS (other HDD).

Unfortunately, I can't test with another motherboard, I have only one.

in reply to:  77 comment:78 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

So, in my Stella OS, I found libavdevice/alsa-audio-common.c file in /home/username/ffmpeg/libadevice/.
I opened it with gedit, but there are only 186 lines in this file and no SND_PCM_NONBLOCK text.

I suspect you are still bisecting, use something like the following to end it:

$ make distclean
$ git bisect reset
$ git checkout master
$ git pull

comment:79 by Jean-Pierre, 11 years ago

# make distclean
make: *** No rule to make target `distclean'.  Stop.
# git bisect reset
fatal: Not a git repository (or any of the parent directories): .git
# git checkout master
fatal: Not a git repository (or any of the parent directories): .git
git pull
fatal: Not a git repository (or any of the parent directories): .git

I found many alsa-audio-common.c files on Internet with only 186 lines like mine.
So, are you sure for this file?

comment:80 by Carl Eugen Hoyos, 11 years ago

$ cd ffmpeg
$ make distclean
$ git bisect reset
$ git checkout master
$ git pull

libavdevice/alsa-audio-common.c currently has 345 lines.

comment:81 by Jean-Pierre, 11 years ago

Sorry for my ignorance, I forgot to change directory.
I did it and removed the line 193 and saved the file.

$ ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
ffmpeg version 0.10.4 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 25 2012 15:45:46 with gcc 4.4.6 20120305 (Red Hat 4.4.6-4)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
[alsa @ 0x17dc000] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1370900485.195499, bitrate: N/A
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    encoder         : Lavf53.32.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=    1517kB time=00:00:08.08 bitrate=1536.0kbits/s    
video:0kB audio:1517kB global headers:0kB muxing overhead 0.002962%

Distortions are still here, not good.
EDit: I am with Stella OS.

Last edited 11 years ago by Jean-Pierre (previous) (diff)

in reply to:  81 comment:82 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

ffmpeg version 0.10.4 Copyright (c) 2000-2012 the FFmpeg developers

This doesn't seem correct.

comment:83 by Jean-Pierre, 11 years ago

Well spotted!
I had ffmpeg installed and removed it.
Now I do

./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
bash: ./ffmpeg: No such file or directory

I think I should redo git like I did previously. Could you tell me from where?

Last edited 11 years ago by Jean-Pierre (previous) (diff)

comment:84 by Jean-Pierre, 11 years ago

FYI

$ ls
arch.mak                compat            doc              ffserver.c     libavutil      Makefile        README
autoffmpeg.sh           configure         ffmpeg.c         INSTALL        libpostproc    outarecord.wav  RELEASE
Changelog               COPYING.GPLv2     ffmpeg_filter.c  libavcodec     library.mak    outffmpeg1.wav  tests
cmdutils.c              COPYING.GPLv3     ffmpeg.h         libavdevice    libswresample  outffmpeg2.wav  tools
cmdutils_common_opts.h  COPYING.LGPLv2.1  ffmpeg_opt.c     libavfilter    libswscale     outvlc.wav      version.sh
cmdutils.h              COPYING.LGPLv3    ffplay.c         libavformat    LICENSE        out.wav
common.mak              CREDITS           ffprobe.c        libavresample  MAINTAINERS    presets

comment:85 by Carl Eugen Hoyos, 11 years ago

Please use ./configure && make to build ffmpeg.

comment:86 by Jean-Pierre, 11 years ago

Rebuitd done. I am on Stella OS.
Test:

$ ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
bash: ffmpeg: command not found
[jp@loja ffmpeg]$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav
ffmpeg version N-53955-gd3e89f2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 11 2013 15:29:15 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration: 
  libavutil      52. 35.100 / 52. 35.100
  libavcodec     55. 15.100 / 55. 15.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 75.101 /  3. 75.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1370961028.761392, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.8.102
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=    6368kB time=00:00:33.96 bitrate=1536.0kbits/s    
video:0kB audio:6368kB subtitle:0 global headers:0kB muxing overhead 0.001227%

Quality is better but sound have what I call "tics" after some "bips". See comments 66/67
https://ffmpeg.org/trac/ffmpeg/ticket/2504#comment:66

I tried again with arecord -N -f cd -t wav out.wav: This is perfect, no "tic" at all. Do it use different driver?

Last edited 11 years ago by Jean-Pierre (previous) (diff)

in reply to:  86 comment:87 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

Quality is better but sound have what I call "tics" after some "bips".

The same as with 743b389 ?

comment:88 by Jean-Pierre, 11 years ago

Yes, like I wrote in the comment 67

comment:89 by Carl Eugen Hoyos, 11 years ago

What about ticket #2478? Do the messages disappear when using the blocking mode?

comment:90 by Jean-Pierre, 11 years ago

I did 2 tests in the thread https://ffmpeg.org/trac/ffmpeg/ticket/2478#comment:10

If you want another command please, write it, I'll execute it.

comment:91 by Jean-Pierre, 11 years ago

Hi cehoyos,
I am still waiting for your answer and to go further.

comment:92 by Carl Eugen Hoyos, 11 years ago

You did the bisecting under the assumption that f2f35d3 works fine (you said so in comment:24) and the result of the bisecting was that it (still) works fine with 743b389 (see comment:61).
If both are bad, there is no regression afaict, if f2f35d3 works fine but 743b389 does not, then I suggest you start bisecting between these two.

comment:93 by Jean-Pierre, 11 years ago

I try to bisec again but I get this error:

git checkout f2f35d3
error: You have local changes to 'libavdevice/alsa-audio-common.c'; cannot switch branches.

Do you want I let it without the line 193 "flags = SND_PCM_NONBLOCK"
or do you want I add it back?
Let me know how to switch branch.

comment:94 by Carl Eugen Hoyos, 11 years ago

The following is one possibility to undo your local changes:

$ git diff | patch -p1 -R

comment:95 by Jean-Pierre, 11 years ago

I am running the bisec and did more than 100 loops.
I use the scrip

#!/bin/bash
# Enter previous loops quantity
let loopnb=100

while true;
do
let loopnb+=1

./configure --disable-protocols --disable-decoders --disable-encoders --disable-demuxers --disable-muxers --disable-outdevs --disable-bsfs --disable-parsers --enable-protocol=file --enable-decoder=pcm_s16le --enable-encoder=pcm_s16le --enable-muxer=wav --disable-filters && make ffmpeg

./ffmpeg -f alsa -ac 2 -i hw:0,0 -y out.wav -t 0:0:10

mplayer out.wav -loop 10

echo "loops num:" $loopnb
echo [g]ood or [b]ad sound? [e]xit [p]lay
read KB

case $KB in
g)
	make distclean && git bisect good
	echo GOOD;;
b)
	make distclean && git bisect bad
	echo BAD;;
p)
	mplayer out.wav -loop 4
	echo;;
e)
	exit;;
esac

done

I can count the loop number but I can't see the bisecting progress.
1) Could you let me know what command I could add in the loop to check there is a change between every test.
2) Do you know how many loops there are between f2f35d3 and 743b389. I started from f2f35d3 and I assume I'll reach 743b389, so I hope I am going in the good way.
3) Are there other steps (I don't know the name; What do you call "f2f35d3/743b389/3cac2f1"?) between f2f35d3 and 743b389?

Last edited 11 years ago by Jean-Pierre (previous) (diff)

in reply to:  95 comment:96 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

I am running the bisec and did more than 100 loops.

Generally, everything >15 seems incorrect, but in this specific case, only ten steps are necessary (there are less than 210 versions between 743b389 and f2f35d3).

Why didn't you follow the original path that we worked on above?
First test the versions that we selected to make sure nothing went wrong (if the first mplayer doesn't sound good or the second doesn't sound bad, the bisecting will not help):

$ make distclean
$ git bisect reset
$ git checkout master
$ git bisect start
$ git checkout 743b389
$ ./configure ...
$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y -t 10 out.wav
$ mplayer out.wav
$ make distclean && git bisect good
$ git checkout f2f35d3
$ ./configure ...
$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y -t 10 out.wav
$ mplayer out.wav
$ make distclean && git bisect bad

Then start bisecting:

$ ./configure ...
$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y -t 10 out.wav
$ ./mplayer out.wav
$ git bisect good/bad

If you use the "long" configure line, this should not take more than 15 minutes, with ./configure && make, it depends on your hardware.

Are you aware that you can speed up compilation time depending on the number of CPUs installed?
./configure ... && make -j16 ffmpeg

comment:97 by Jean-Pierre, 11 years ago

Sorry again, but I don't really understand what I am doing, so I need help.
I will follow your commands step by steps so, please help me step by step.
I stop my script with "make distclean && git bisect good"
and from you commands

$ make distclean
Makefile:1: config.mak: No such file or directory
libavdevice/Makefile:1: libavdevice/../config.mak: No such file or directory
libavformat/Makefile:1: libavformat/../config.mak: No such file or directory
libavcodec/Makefile:1: libavcodec/../config.mak: No such file or directory
libavutil/Makefile:1: libavutil/../config.mak: No such file or directory
> vhook/watermark.d
> vhook/null.d
> vhook/fish.d
> libavutil/utils.d
> libavutil/tree.d
> libavutil/string.d
> libavutil/sha1.d
> libavutil/rc4.d
> libavutil/rational.d
> libavutil/random.d
> libavutil/mem.d
> libavutil/md5.d
> libavutil/mathematics.d
> libavutil/lzo.d
> libavutil/log.d
> libavutil/lls.d
> libavutil/lfg.d
> libavutil/intfloat_readwrite.d
> libavutil/fifo.d
> libavutil/des.d
> libavutil/crc.d
> libavutil/base64.d
> libavutil/aes.d
> libavutil/adler32.d
make: *** No rule to make target `libavutil/../config.mak'.  Stop.

What should I do to fix?

in reply to:  97 comment:98 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

What should I do to fix?

Nothing, just continue with the next command (I couldn't know if you had run make distclean before or not).

comment:99 by Jean-Pierre, 11 years ago

I did the first part of your comment 95 without bisecting.
With git checkout 743b389 audio is good
and with git checkout f2f35d3 audio is good as well.
But I'd like to be very accurate. When I say good it is the way I wrote in the comment 66
"...record was what I could consider good even it's not perfect." 1 or 2 tics per minute.
I didn't get the distortion I had at the beginning.
Is it correct? I think I should have one with the distortion.

If you think it's necessary, I can step back to restart on good. Just let me know. I have some time.
I want to find this bug anyway.
And thanks a million for your patience.

in reply to:  99 comment:100 by Carl Eugen Hoyos, 11 years ago

Replying to MrNice:

With git checkout 743b389 audio is good

Sorry, but you will have to decide if 743b389 is good (comment:24 and comment:99) or bad (comment:66 and some later ones). If it is good, I suggest you remove "flags = SND_PCM_NONBLOCK" from the source of later versions (this is the only change in the commit right after 743b389.

comment:101 by Jean-Pierre, 11 years ago

I did

$ make distclean
$ git bisect reset
$ git checkout master
$ git pull

then added # before "flags = SND_PCM_NONBLOCK" in line 193.
How to rebuild and test the new conf?

comment:102 by Carl Eugen Hoyos, 11 years ago

See comment:85 but note that C comments start with //.

comment:103 by Jean-Pierre, 11 years ago

I did the change saved it and $ ./configure && make.

$ ./ffmpeg -f alsa -ac 2 -i hw:0,0 -y -t 120 out.wav
ffmpeg version N-54228-g42bd0cd Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 27 2013 15:15:45 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration: 
  libavutil      52. 37.101 / 52. 37.101
  libavcodec     55. 17.100 / 55. 17.100
  libavformat    55. 10.100 / 55. 10.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 1372346284.750455, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.10.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=    8352kB time=00:00:44.54 bitrate=1536.0kbits/s    
video:0kB audio:8352kB subtitle:0 global headers:0kB muxing overhead 0.000935%

I recorded 2x 120seconds files.
First has 31 tics, second has 26 tics, this is more than previously, but no distortion.
I did records with music and there are lot of tics, almost like a vinyl record.
This is not linked to the output level of the player nor the input level of the sound preference.
This looks link to the density of the sound if I cut suddenly the player, 4 or 5 tics occur in the half second after in the silence.
If you want a sample let me know.
This in not acceptable but this is not the bug I had when I open the thread. Maybe there is 2 different bugs.

Sorry but I will have to re-start few steps back, maybe at the beginning.
Do you agree to lead me?
I hope I don't spend too much of your time.

comment:104 by Carl Eugen Hoyos, 11 years ago

First, to make sure we do not misunderstand each other:

  • 743b389 works well
  • 3cac2f1 sounds bad
  • If you remove AVFMT_FLAG_NONBLOCK from a current version, it sounds better than without removing it but worse than 743b389

(If one of above statements is not correct, then please correct me and ignore the following.)

If you are interested in fixing this issue, I suggest you do a git bisect between 3cac2f1 and current git head, but this time removing (out-commenting) AVFMT_FLAG_NONBLOCK before typing "configure ..." for each test (you have to undo the changes before you type "git bisect good/bad")

comment:105 by Jean-Pierre, 11 years ago

I did more tests with recorded music.
What I called good when I tried with the bips input is in fact not good at all when real music is recorded.
So all 743b389 AND f2f35d3 AND 3cac2f1 are bad when listening. 3cac2f1 is the worst.
All are not acceptable.
I doubled checked with arecord witch is perfect.

I apologise for the time consuming I did.
I'd propose to "forget" all we did (I'll remember what you taught me) and re-start at the beginning from new bases.
If it's a good way, give me, let say, 5 "git checkout" numbers, spread from the last release to old release, I'll test them in the same way (your example comment 96) and give you the quality result.

Sorry again for the inconvenience.

Last edited 11 years ago by Jean-Pierre (previous) (diff)

in reply to:  105 comment:106 by Carl Eugen Hoyos, 11 years ago

Keywords: alsa added; regression removed
Priority: importantnormal

Replying to MrNice:

f2f35d3 is bad

This is the oldest version that supports alsa recording, if it does not work correctly, this is - apparently - not a regression.

comment:107 by Jean-Pierre, 11 years ago

Does that mean there is a bug from the beginning?
Now, what can I do to go further?

I hope this will be fixed as I need it to transfer from S-VHS to computer file.

comment:108 by Jean-Pierre, 11 years ago

Any help?

Note: See TracTickets for help on using tickets.