[FFmpeg-devel] Bug? ffmpeg adding an extra frame when muxing together a sequence of frames and audio

Mark Visser mjmvisser at gmail.com
Fri Feb 28 17:24:42 CET 2014


With master from https://github.com/FFmpeg/FFmpeg.

(Sample frames and audio have been uploaded to
upload.ffmpeg.org/incoming/ffmpeg-extra-frames).

I've tried this with:
- audio codecs: pcm_s16le, aac
- video codecs: MPNG/MJPEG/MP4
- containers: mov, mp4, matroska
- using -t 1.0, using -shortest

1. pcm_s16le/MPNG/-shortest

$ ffmpeg -y -probesize 500000 -f image2 -r 25 -i colorbars.%04d.png -i
100Hz_44100Hz_16bit_05sec.wav -shortest -c:v png -c:a pcm_s16le -q:v 1 -2
-f mov colorbars.mov

Duration: 00:00:01.02, start: 0.000000, bitrate: 17114 kb/s

2. aac/MPNG/-shortest

$ ffmpeg -y -probesize 500000 -f image2 -r 25 -i colorbars.%04d.png -i
100Hz_44100Hz_16bit_05sec.wav -shortest -c:v png -c:a aac -q:v 1 -strict -2
-f mov colorbars.mov

Duration: 00:00:01.05, start: 0.023220, bitrate: 16172 kb/s

3. pcm_s16le/MPNG/-t 1.000

$ ffmpeg -y -probesize 500000 -f image2 -r 25 -i colorbars.%04d.png -i
100Hz_44100Hz_16bit_05sec.wav -t 1.000 -c:v png -c:a pcm_s16le -q:v 1 -f
mov colorbars.mov

  Duration: 00:00:01.00, start: 0.000000, bitrate: 17475 kb/s

4. aac/MPNG/-t 1.000

$ ffmpeg -y -probesize 500000 -f image2 -r 25 -i colorbars.%04d.png -i
100Hz_44100Hz_16bit_05sec.wav -t 1.000 -c:v png -c:a aac -strict -2 -q:v 1
-f mov colorbars.mov

  Duration: 00:00:01.02, start: 0.023220, bitrate: 16501 kb/s

I see similar results regardless of the container format. I suspect there
are two things at work here:
 - "-shortest" is adding an extra 0.5 frame
 - aac is adding an extra 0.5 frame and adding an offset to start

I suspect the "-shortest" issue is a bug. However, is the aac
offset/extension a problem? I'm not sure exactly how "start" is
interpreted. My prime concern is generating valid output files of the
correct length. Some players show black or white at the very end of the
file, which I'd like to avoid.

Should I file either or both of these as bugs?

thanks,
-Mark

ffmpeg version preamble:

ffmpeg version N-60960-gf3eef02 Copyright (c) 2000-2014 the FFmpeg
developers
  built on Feb 28 2014 10:31:20 with gcc 4.4.7 (GCC) 20120313 (Red Hat
4.4.7-4)
  configuration: --prefix=/prod/tools/common/ffmpeg-git --enable-shared
--enable-libvpx --enable-gpl --enable-version3 --enable-libx264
--enable-filter=drawtext --enable-libfreetype
--extra-cflags='-I/prod/tools/common/x264/include
-I/prod/tools/common/libvpx/include' --extra-ldflags='-L/usr/lib64
-L/prod/tools/common/x264/lib -L/prod/tools/common/libvpx/lib
-Wl,-rpath,/prod/tools/common/ffmpeg-git/lib
-Wl,-rpath,/prod/tools/common/x264/lib
-Wl,-rpath,/prod/tools/common/libvpx/lib'
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100


More information about the ffmpeg-devel mailing list