[FFmpeg-user] Converting DTS (timestamps) in mpegts to HH:MM:SS:FF

Kieran O Leary kieran.o.leary at gmail.com
Tue Jun 16 11:01:26 EEST 2020


Hi,

I'm working with HDV tape transfers in the moment and dealing with m2t
transport streams. I've found that using ffmpeg -report -loglevel debug -i
input -f null - has been great at catching corrupt frames that I can
investigate in playback software.
I just realised that this can be done even quicker and it looks like the
same corruption is detected when using -c copy. However, the report I get
in the terminal just uses dts values - is there a way to convert these dts
values to a frame number or preferably a HH:MM:SS:FF value? is it related
to the tbn/tbc value? Either in ffmpeg or even some scriptable way.

For example, one of the errors displays like this:
[mpegts @ 00000165bdcd34c0] Packet corrupt (stream = 1, dts = 332636400)
and I can tell from using -f null - that this corresponds to
approx 01:01:33.55 , but I can't find a way to get the dts value to relate
to that timestamp.


ffmpeg -i 2.m2t -c copy -f null -
ffmpeg version N-96643-g2942b00285-g2383021a7a+1 Copyright (c) 2000-2020
the FFmpeg developers
  built with gcc 9.2.0 (Rev2, Built by MSYS2 project)
  configuration:  --disable-autodetect --enable-amf --enable-bzlib
--enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv
--enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --enable-ffnvcodec
--enable-nvdec --enable-cuda-llvm --enable-libmp3lame --enable-libopus
--enable-libvorbis --enable-libx264 --enable-libdav1d --disable-debug
--enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype
--enable-libmfx --enable-libmysofa --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack
--enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine
--enable-gpl --enable-avisynth --enable-libxvid --enable-libaom
--enable-libopenmpt --enable-version3 --enable-openssl
--extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++
--extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --enable-nonfree
  libavutil      56. 39.100 / 56. 39.100
  libavcodec     58. 67.101 / 58. 67.101
  libavformat    58. 37.100 / 58. 37.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 74.100 /  7. 74.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[mpegts @ 00000180e65c24c0] PES packet size mismatch
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 1, dts = 437428800).
[mpegts @ 00000180e65c24c0] Could not find codec parameters for stream 2
(Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
[mpegts @ 00000180e65c24c0] Could not find codec parameters for stream 3
(Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
Input #0, mpegts, from '82.m2t':
  Duration: 01:20:57.08, start: 3.440000, bitrate: 26122 kb/s
  Program 100
    Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25
fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x814]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 384 kb/s
    Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0)
    Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1)
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.37.100
    Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 25000
kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
fltp, 384 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 0, dts = 5317200).
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 0, dts = 10821600).
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 0, dts =
116416800).322x
[mpegts @ 00000180e65c24c0] PES packet size mismatch
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 1, dts = 116398800).
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 0, dts =
332654400).341x
[mpegts @ 00000180e65c24c0] PES packet size mismatch
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 1, dts = 332636400).
[mpegts @ 00000180e65c24c0] PES packet size mismatch04 bitrate=N/A speed=
345x
[mpegts @ 00000180e65c24c0] Packet corrupt (stream = 1, dts = 437428800).
frame=121338 fps=8612 q=-1.0 Lsize=N/A time=01:20:57.04 bitrate=N/A speed=
345x
video:14811578kB audio:227500kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown

Best,

Kieran O'Leary
Irish Film Institute


More information about the ffmpeg-user mailing list