Opened 11 years ago

Last modified 10 years ago

#2832 open defect

ffmpeg produces broken audio with -async 1

Reported by: Alex Sukhanov Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: async
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I uploaded audio_glitch_input.flv to upload.ffmpeg.org/incoming

ffmpeg -nostats -nostdin -probesize 5000000\

-i ./audio_glitch_input.flv -map_metadata -1 -pass 1\
-shortest -apad 512 -b:a 64000 -ac 1 -ar 22050 -async 1 -compression_level 0 -acodec libmp3lame -sn\
-f flv -y audio_glitch_output.flv

ffmpeg version git-2013-05-15-1a36c75 Copyright (c) 2000-2013 the FFmpeg developers

built on May 14 2013 19:05:26 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libx264 --enable-libfaac --enable-libmp3lame --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
libavutil 52. 31.100 / 52. 31.100
libavcodec 55. 9.100 / 55. 9.100
libavformat 55. 7.100 / 55. 7.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 67.100 / 3. 67.100
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Change History (12)

comment:1 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegundetermined

Is the problem also reproducible with the following command?
$ ffmpeg -i audio_glitch_input.flv out.wav

comment:2 by Alex Sukhanov, 11 years ago

$ ffmpeg -i audio_glitch_input.flv out.wav

Generates playable file.

comment:3 by Carl Eugen Hoyos, 11 years ago

Please provide the minimal command line that allows to reproduce the problem (is -pass 1 needed? -ar 22050? -ac 1)) together with the complete, uncut console output.

If the problem is reproducible without an external library (libmp3lame), please don't use it, it makes reproducing the problem more difficult.

comment:4 by Alex Sukhanov, 11 years ago

I simplified commandline which I could reproduce the problem with:

ffmpeg -i audio_glitch_input.flv -async 1 -f flv -y out.flv

Console output:

ffmpeg version git-2013-05-15-1a36c75 Copyright (c) 2000-2013 the FFmpeg developers

built on May 14 2013 19:05:26 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libx264 --enable-libfaac --enable-libmp3lame --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
libavutil 52. 31.100 / 52. 31.100
libavcodec 55. 9.100 / 55. 9.100
libavformat 55. 7.100 / 55. 7.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 67.100 / 3. 67.100
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

[flv @ 0x369b880] max_analyze_duration 5000000 reached at 5018000 microseconds
Input #0, flv, from 'audio_glitch_input.flv':

Duration: 00:02:46.84, start: 0.000000, bitrate: 322 kb/s

Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 192 kb/s

-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
Output #0, flv, to 'out.flv':

Metadata:

encoder : Lavf55.7.100
Stream #0:0: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, mono, s16p

Stream mapping:

Stream #0:0 -> #0:0 (mp3 -> libmp3lame)

Press [q] to stop, ? for help
Trying to remove 1152 samples, but the queue is emptys
size= 1405kB time=00:02:46.97 bitrate= 68.9kbits/s
video:0kB audio:1305kB subtitle:0 global headers:0kB muxing overhead 7.672720%

comment:5 by Carl Eugen Hoyos, 11 years ago

Does it sound different if you encode to mp3?
Why are you using -async 1 ?

comment:6 by Alex Sukhanov, 11 years ago

No, if I encode to mp3 I still can hear this glitch:

ffmpeg -i audio_glitch_input.flv -async 1 -f mp3 -y out.flv

Why are you using -async 1 ?

I'm not ready to answer right now: ffmpeg commandline which we use was formed not by me, let me ask it.

But what's wrong with "async 1"?

Thank you

in reply to:  6 comment:7 by Carl Eugen Hoyos, 11 years ago

Replying to asukhanov:

But what's wrong with "async 1"?

The option is generally used to fix A/V desync when reencoding some media files.
Since your stream is audio-only I am not sure why it should be used.
I am not saying there is no bug though.

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

comment:8 by Alex Sukhanov, 11 years ago

Since your stream is audio-only I am not sure why it should be used.

I simplified my stream, source file had both video and audio tracks, but I found that it's possible to reproduce the problem using audio only file.

Thanks

comment:9 by boean, 10 years ago

/usr/local/bin/ffmpeg -i /idoukou_convert/original/music/2013/587_1385436228.wav -acodec libmp3lame -ac 2 -ar 44100 -ab 320k -y 1.mp3

Output #0, mp3, to '1.mp3':

Metadata:

TSSE : Lavf55.19.104
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p, 320 kb/s

Stream mapping:

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

Press [q] to stop, ? for help
[libmp3lame @ 0x9579740] Trying to remove 1152 samples, but the queue is empty

Last message repeated 1079 times

[libmp3lame @ 0x9579740] Trying to remove 1152 samples, but the queue is empty

Last message repeated 205 times

[libmp3lame @ 0x9579740] Trying to remove 1152 samples, but the queue is empty
av_interleaved_write_frame(): Immediate exit requested

comment:10 by Carl Eugen Hoyos, 10 years ago

Not a regression.
The output file sounds completely broken, works fine without -async 1.

$ ffmpeg -i audio_glitch_input.flv -async 1 out.wav
ffmpeg version N-58755-gaf7562a Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec  5 2013 23:36:29 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 56.100 / 52. 56.100
  libavcodec     55. 45.100 / 55. 45.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, flv, from 'audio_glitch_input.flv':
  Duration: 00:02:46.84, start: 0.000000, bitrate: 322 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 192 kb/s
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 -> pcm_s16le)
Press [q] to stop, [?] for help
size=   14380kB time=00:02:46.94 bitrate= 705.6kbits/s
video:0kB audio:14380kB subtitle:0 global headers:0kB muxing overhead 0.000543%

comment:11 by Carl Eugen Hoyos, 10 years ago

Keywords: async added
Status: newopen
Version: unspecifiedgit-master

comment:12 by Carl Eugen Hoyos, 10 years ago

Summary: ffmpeg produces audio with glitchffmpeg produces broken audio with -async 1
Note: See TracTickets for help on using tickets.