Opened 15 months ago

Last modified 15 months ago

#10606 new defect

ffplay ignores relative audio delay tag

Reported by: Ulf Zibis Owned by:
Priority: normal Component: ffplay
Version: 6.0 Keywords: audio
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Ulf Zibis)

Summary of the bug:
How to reproduce:

$ ffmpeg -ss 27.83 -t 1:30 -i Ton_fr.mkv -c:a copy Ton_fr_cut.mkv
ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu2.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, matroska,webm, from 'Ton_fr.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 02:14:57.56, start: 0.000000, bitrate: 2853 kb/s
  Stream #0:0: Video: h264 (High 4:4:4 Predictive), gbrp(pc, gbr/unknown/unknown, progressive), 210x110 [SAR 1:1 DAR 21:11], 25 fps, 25 tbr, 1k tbn
    Metadata:
      DURATION        : 02:14:57,480000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 02:14:57,557000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x5586cbc62ac0] using SAR=1/1
[libx264 @ 0x5586cbc62ac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x5586cbc62ac0] profile High 4:4:4 Predictive, level 1.1, 4:4:4, 8-bit
[libx264 @ 0x5586cbc62ac0] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'Ton_fr_cut.mkv':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv444p(tv, progressive), 210x110 [SAR 1:1 DAR 21:11], q=2-31, 25 fps, 1k tbn
    Metadata:
      DURATION        : 02:14:57,480000000
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 02:14:57,557000000
frame= 2250 fps=385 q=-1.0 Lsize=    2361kB time=00:01:30.01 bitrate= 214.8kbits/s speed=15.4x    
video:654kB audio:1660kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.018668%
[libx264 @ 0x5586cbc62ac0] frame I:64    Avg QP:21.90  size:  2203
[libx264 @ 0x5586cbc62ac0] frame P:859   Avg QP:22.24  size:   452
[libx264 @ 0x5586cbc62ac0] frame B:1327  Avg QP:23.85  size:   105
[libx264 @ 0x5586cbc62ac0] consecutive B-frames: 16.6% 10.2% 12.4% 60.8%
[libx264 @ 0x5586cbc62ac0] mb I  I16..4: 11.7% 66.7% 21.6%
[libx264 @ 0x5586cbc62ac0] mb P  I16..4:  2.7%  4.1%  1.3%  P16..4: 17.8% 11.6%  7.0%  0.0%  0.0%    skip:55.4%
[libx264 @ 0x5586cbc62ac0] mb B  I16..4:  0.1%  0.5%  0.1%  B16..8: 17.4%  2.3%  0.5%  direct: 1.1%  skip:78.1%  L0:40.7% L1:51.1% BI: 8.2%
[libx264 @ 0x5586cbc62ac0] 8x8 transform intra:58.8% inter:62.1%
[libx264 @ 0x5586cbc62ac0] coded y,u,v intra: 43.6% 37.8% 36.4% inter: 6.4% 2.3% 1.7%
[libx264 @ 0x5586cbc62ac0] i16 v,h,dc,p: 63% 17%  9% 12%
[libx264 @ 0x5586cbc62ac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 20% 27%  4%  5%  4%  6%  4%  5%
[libx264 @ 0x5586cbc62ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 19% 18%  4%  5%  4%  6%  4%  5%
[libx264 @ 0x5586cbc62ac0] Weighted P-Frames: Y:12.6% UV:3.1%
[libx264 @ 0x5586cbc62ac0] ref P L0: 60.7% 15.1% 15.2%  8.0%  0.9%
[libx264 @ 0x5586cbc62ac0] ref B L0: 84.0% 12.6%  3.4%
[libx264 @ 0x5586cbc62ac0] ref B L1: 95.9%  4.1%
[libx264 @ 0x5586cbc62ac0] kb/s:59.44

ffplay outputs the audio at the beginning of the video with ~7 sec. delay, but from 00:00:23 to end, the sync is correct.

$ ffplay Ton_fr_cut.mkv
ffplay version 5.1.1-1ubuntu2.1 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu2.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[matroska,webm @ 0x7fe3d4000c80] Could not find codec parameters for stream 0 (Video: h264, none(tv, progressive), 210x110): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'Ton_fr_cut.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:01:37.83, start: 0.000000, bitrate: 197 kb/s
  Stream #0:0: Video: h264, none(tv, progressive), 210x110, SAR 1:1 DAR 21:11, 25 fps, 25 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc59.37.100 libx264
      DURATION        : 00:01:37.819000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 00:01:37.834000000
  37.48 A-V: -0.022 fd=   0 aq=   21KB vq=    3KB sq=    0B f=132/0   

With the mpv media player as alternative the sync between audio and video is correct from the beginning.

The audio delay is confirmed by mediainfo:

$ mediainfo Ton_fr_cut.mkv
[.....]
Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 1 min 37 s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -7 s 819 ms
Default                                  : No
Forced                                   : No

I'm too wondering about:

  • I used -t 1:30, but the result is 1:37.
  • ffmpeg states a duration of 02:14:57 for the output:

The input file was created by simplescreenrecorder which uses FFmpeg in behind. I used the libx264rgb encoder with bit rate 0 and options "crf=0,preset=ultrafast".

Attachments (1)

Ton_fr_cut.mkv (2.3 MB ) - added by Ulf Zibis 15 months ago.

Change History (4)

by Ulf Zibis, 15 months ago

Attachment: Ton_fr_cut.mkv added

comment:1 by Ulf Zibis, 15 months ago

Description: modified (diff)

comment:2 by Ulf Zibis, 15 months ago

Version: unspecified6.0

comment:3 by Ulf Zibis, 15 months ago

The issue also occures with version 6.0

$ ffplay Ton_fr_cut.mkv
ffplay version 6.0-0ubuntu1~22.04.sav3 Copyright (c) 2003-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav3' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-amf --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-avisynth --enable-libilbc --enable-libjxl --enable-librist --enable-vapoursynth --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc --enable-libsvtav1 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav3' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-amf --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-avisynth --enable-libilbc --enable-libjxl --enable-librist --enable-vapoursynth --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc --enable-libsvtav1 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libshaderc --enable-liblensfun --enable-libsmbclient
  avfilter    configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav3' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-amf --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-avisynth --enable-libilbc --enable-libjxl --enable-librist --enable-vapoursynth --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc --enable-libsvtav1 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libshaderc --enable-liblensfun --enable-libsmbclient
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[matroska,webm @ 0x7f4478000c80] Could not find codec parameters for stream 0 (Video: h264, none(tv, progressive), 210x110): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'Ton_fr_cut.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:01:37.83, start: 0.000000, bitrate: 197 kb/s
  Stream #0:0: Video: h264, none(tv, progressive), 210x110, SAR 1:1 DAR 21:11, 25 fps, 25 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc59.37.100 libx264
      DURATION        : 00:01:37.819000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 00:01:37.834000000
 108.76 A-V: -0.006 fd=   1 aq=    0KB vq=    0KB sq=    0B f=342/0   
Note: See TracTickets for help on using tickets.