Opened 6 years ago

Closed 4 years ago

#3332 closed defect (fixed)

amovie+afade on MPEG-PS fades at wrong timestamp

Reported by: MarkZV Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: afade
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

MPEG-PS audio that is read with amovie and faded out with afade fades out at the wrong timestamp.

# Create MPEG-PS containing 45 s of audio
ffmpeg -f lavfi -i sine=b=4 -t 45 sine.mpg
# fade out after 10 seconds
ffplay -f lavfi amovie=sine.mpg,afade=t=out:st=10:d=1

This should fade out the audio after 10 seconds, but it actually fades out after about 2 seconds. Similarly, with st=30 it should fade out after 30 seconds but it actually fades out after about 6 or 7 seconds.

$ ffmpeg -f lavfi -i sine=b=4 -t 45 sine.mpg
ffmpeg version N-59995-g4014b40 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 19 2014 22:18:54 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --mandir=/opt/local/share/man --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libfdk-aac --enable-libfaac
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 48.101 / 55. 48.101
  libavformat    55. 25.100 / 55. 25.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  1.100 /  4.  1.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'sine=b=4':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, mpeg, to 'sine.mpg':
  Metadata:
    encoder         : Lavf55.25.100
    Stream #0:0: Audio: mp2, 44100 Hz, mono, s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> mp2)
Press [q] to stop, [?] for help
size=     712kB time=00:00:44.99 bitrate= 129.6kbits/s
video:0kB audio:703kB subtitle:0 global headers:0kB muxing overhead 1.242114%
$ ffplay -f lavfi amovie=sine.mpg,afade=t=out:st=10:d=1
ffplay version N-59995-g4014b40 Copyright (c) 2003-2014 the FFmpeg developers
  built on Jan 19 2014 22:18:54 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --mandir=/opt/local/share/man --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libfdk-aac --enable-libfaac
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 48.101 / 55. 48.101
  libavformat    55. 25.100 / 55. 25.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  1.100 /  4.  1.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'amovie=sine.mpg,afade=t=out:st=10:d=1':0/0
  Duration: N/A, start: 0.500000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
   5.77 M-A:  0.000 fd=   0 aq=   11KB vq=    0KB sq=    0B f=0/0
$

Change History (4)

comment:1 Changed 6 years ago by cehoyos

Is this only reproducible with ffplay or also with ffmpeg?

comment:2 follow-up: Changed 6 years ago by MarkZV

It can be reproduced with ffmpeg. Of course you need to play the output to hear the problem, so using ffplay just saves a step.

$ ffmpeg -f lavfi -i amovie=sine.mpg,afade=t=out:st=10:d=1 out.wav
ffmpeg version N-59995-g4014b40 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 19 2014 22:18:54 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --mandir=/opt/local/share/man --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libfdk-aac --enable-libfaac
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 48.101 / 55. 48.101
  libavformat    55. 25.100 / 55. 25.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  1.100 /  4.  1.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'amovie=sine.mpg,afade=t=out:st=10:d=1':
  Duration: N/A, start: 0.500000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf55.25.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 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
size=    3877kB time=00:00:45.00 bitrate= 705.6kbits/s    
video:0kB audio:3877kB subtitle:0 global headers:0kB muxing overhead 0.002015%
$ 

Then play out.wav with your favorite player.

comment:3 in reply to: ↑ 2 Changed 6 years ago by cehoyos

  • Keywords afade added
  • Reproduced by developer set
  • Status changed from new to open

Replying to MarkZV:

Of course you need to play the output to hear the problem, so using ffplay just saves a step.

Since ffplay depends on an external library that is known to contain bugs, it is generally not a good idea to prefer it over ffmpeg for testing or to report a problem. This is also mentioned on http://ffmpeg.org/bugreports.html

comment:4 Changed 4 years ago by richardpl

  • Component changed from undetermined to avfilter
  • Resolution set to fixed
  • Status changed from open to closed

This have been fixed, probably in 9c168f9a224048b19e62fa5e1a05e897554e43b8.

Note: See TracTickets for help on using tickets.