Opened 7 weeks ago

#10925 new defect

Regression in showinfo filter, SAR does not update if it changes mid-video

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

Description

Summary of the bug:

In videos where the sample aspect ratio changes mid-video, the showinfo filter in previous versions of ffmpeg would correctly update the SAR output to reflect this. In recent versions, the SAR is permanently set to what appears to be the SAR of the first frame, and does not update.

How to reproduce:

Using an old version of ffmpeg shows that between frame 23 and 24 the SAR changes from 24/17 to 32/17:

% ffmpeg -y -i /nas/media/Transcoded/60019_20240108013600_3.ts -vf showinfo -c:v rawvideo -f rawvideo /dev/null
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mpegts @ 0x559addbe9700] start time for stream 2 is not set in estimate_timings_from_pts
Input #0, mpegts, from '/nas/media/Transcoded/60019_20240108013600_3.ts':
  Duration: 00:00:04.81, start: 1.400000, bitrate: 1096 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 544x576 [SAR 24:17 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 128 kb/s
    Stream #0:2[0x102](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[Parsed_showinfo_0 @ 0x559addcb0980] config in time_base: 1/90000, frame_rate: 25/1
[Parsed_showinfo_0 @ 0x559addcb0980] config out time_base: 0/0, frame_rate: 0/0
[Parsed_showinfo_0 @ 0x559addcb0980] n:   0 pts:      0 pts_time:0       pos:    29892 fmt:yuv420p sar:24/17 s:544x576 i:T iskey:1 type:I checksum:C6429662 plane_checksum:[21028474 73D808F7 73D808F7] mean:[16 128 128] stdev:[0.0 0.0 0.0]
.
.
.
[Parsed_showinfo_0 @ 0x559addcb0980] n:  23 pts:  82800 pts_time:0.92    pos:   158484 fmt:yuv420p sar:24/17 s:544x576 i:P iskey:0 type:B checksum:C6429662 plane_checksum:[21028474 73D808F7 73D808F7] mean:[16 128 128] stdev:[0.0 0.0 0.0]
[Parsed_showinfo_0 @ 0x559addcb0980] n:  24 pts:  90000 pts_time:1       pos:   164124 fmt:yuv420p sar:32/17 s:544x576 i:P iskey:1 type:I checksum:C72C2262 plane_checksum:[07E1C4C0 E491F499 453168EB] mean:[163 49 172] stdev:[23.9 11.1 8.5]
.
.
.
[Parsed_showinfo_0 @ 0x559addcb0980] n:  76 pts: 280800 pts_time:3.12    pos:   648600 fmt:yuv420p sar:32/17 s:544x576 i:P iskey:0 type:P checksum:91FEE149 plane_checksum:[BFD9F415 9500F295 BE02FA81] mean:[128 78 161] stdev:[46.0 33.8 17.6]

With the latest snapshot downloaded and compiled from git the SAR remains at 24/17:

~/compile/ffmpeg7/build/bin/ffmpeg -y -i /nas/media/Transcoded/60019_20240108013600_3.ts -vf showinfo -c:v rawvideo -f rawvideo /dev/null
ffmpeg version N-114281-gdfcf5f828d Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
  configuration: --prefix=/home/myth/compile/ffmpeg7/build --pkg-config-flags=--static --extra-cflags=-I/home/myth/compile/ffmpeg7/build/include --extra-ldflags=-L/home/myth/compile/ffmpeg7/build/lib --extra-libs='-lpthread -lm' --bindir=/home/myth/compile/ffmpeg7/build/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      59.  2.100 / 59.  2.100
  libavcodec     61.  1.101 / 61.  1.101
  libavformat    61.  0.100 / 61.  0.100
  libavdevice    61.  0.100 / 61.  0.100
  libavfilter    10.  0.100 / 10.  0.100
  libswscale      8.  0.100 /  8.  0.100
  libswresample   5.  0.100 /  5.  0.100
  libpostproc    58.  0.100 / 58.  0.100
[mpegts @ 0x55cd56c27dc0] start time for stream 2 is not set in estimate_timings_from_pts
Input #0, mpegts, from '/nas/media/Transcoded/60019_20240108013600_3.ts':
  Duration: 00:00:04.81, start: 1.400000, bitrate: 1096 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 544x576 [SAR 24:17 DAR 4:3], 25 fps, 25 tbr, 90k tbn
      Side data:
        cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1[0x101](eng): Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 128 kb/s
  Stream #0:2[0x102](eng): Subtitle: dvb_subtitle (dvbsub) ([6][0][0][0] / 0x0006)
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[Parsed_showinfo_0 @ 0x7f26500032c0] config in time_base: 1/90000, frame_rate: 25/1
[Parsed_showinfo_0 @ 0x7f26500032c0] config out time_base: 0/0, frame_rate: 0/0
[Parsed_showinfo_0 @ 0x7f26500032c0] n:   0 pts:      0 pts_time:0       duration:   3600 duration_time:0.04    fmt:yuv420p cl:left sar:24/17 s:544x576 i:T iskey:1 type:I checksum:C6429662 plane_checksum:[21028474 73D808F7 73D808F7] mean:[16 128 128] stdev:[0.0 0.0 0.0]
.
.
.
[Parsed_showinfo_0 @ 0x7f26500032c0] n:  23 pts:  82800 pts_time:0.92    duration:   3600 duration_time:0.04    fmt:yuv420p cl:left sar:24/17 s:544x576 i:P iskey:0 type:B checksum:C6429662 plane_checksum:[21028474 73D808F7 73D808F7] mean:[16 128 128] stdev:[0.0 0.0 0.0]
[Parsed_showinfo_0 @ 0x7f26500032c0] n:  24 pts:  90000 pts_time:1       duration:   3600 duration_time:0.04    fmt:yuv420p cl:left sar:24/17 s:544x576 i:P iskey:1 type:I checksum:C72C2262 plane_checksum:[07E1C4C0 E491F499 453168EB] mean:[163 49 172] stdev:[23.9 11.1 8.5]
.
.
.
[Parsed_showinfo_0 @ 0x7f26500032c0] n:  76 pts: 280800 pts_time:3.12    duration:   3600 duration_time:0.04    fmt:yuv420p cl:left sar:24/17 s:544x576 i:P iskey:0 type:P checksum:91FEE149 plane_checksum:[BFD9F415 9500F295 BE02FA81] mean:[128 78 161] stdev:[46.0 33.8 17.6]

ffprobe does however show the change correctly:

/home/myth/compile/ffmpeg7/build/bin/ffprobe -of csv=p=0 -select_streams v -show_entries frame=pts_time,sample_aspect_ratio /nas/media/Transcoded/60019_20240108013600_3.ts 
ffprobe version N-114281-gdfcf5f828d Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
  configuration: --prefix=/home/myth/compile/ffmpeg7/build --pkg-config-flags=--static --extra-cflags=-I/home/myth/compile/ffmpeg7/build/include --extra-ldflags=-L/home/myth/compile/ffmpeg7/build/lib --extra-libs='-lpthread -lm' --bindir=/home/myth/compile/ffmpeg7/build/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      59.  2.100 / 59.  2.100
  libavcodec     61.  1.101 / 61.  1.101
  libavformat    61.  0.100 / 61.  0.100
  libavdevice    61.  0.100 / 61.  0.100
  libavfilter    10.  0.100 / 10.  0.100
  libswscale      8.  0.100 /  8.  0.100
  libswresample   5.  0.100 /  5.  0.100
  libpostproc    58.  0.100 / 58.  0.100
[mpegts @ 0x555c060effc0] start time for stream 2 is not set in estimate_timings_from_pts
Input #0, mpegts, from '/nas/media/Transcoded/60019_20240108013600_3.ts':
  Duration: 00:00:04.81, start: 1.400000, bitrate: 1096 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 544x576 [SAR 24:17 DAR 4:3], 25 fps, 25 tbr, 90k tbn
      Side data:
        cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1[0x101](eng): Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 128 kb/s
  Stream #0:2[0x102](eng): Subtitle: dvb_subtitle (dvbsub) ([6][0][0][0] / 0x0006)
3.047844,24:17,
3.087844,24:17,
.
.
.
3.967844,24:17,
4.047844,32:17,
.
.
.
6.167844,32:17,

A very small sample file is attached to this ticket.

Attachments (1)

60019_20240108013600_3.ts (643.5 KB ) - added by Tom 7 weeks ago.
mpeg2 ts file with changing sample aspect ratio

Download all attachments as: .zip

Change History (1)

by Tom, 7 weeks ago

Attachment: 60019_20240108013600_3.ts added

mpeg2 ts file with changing sample aspect ratio

Note: See TracTickets for help on using tickets.