Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8586 closed defect (invalid)

mpegts seeking failure

Reported by: ronag Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

We have noticed that some mpegts files FFmpeg fails to properly seek. Even though the file itself when read sequentially (without seeking) seems to work fine.

Desktop$ ffmpeg -ss 16.919999837875366 -i N4SGWtf5_~9R23.ts -frames:v 1 foo.webp -y
ffmpeg version N-97026-gea46b45e9c-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 42.101 / 56. 42.101
  libavcodec     58. 76.100 / 58. 76.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[aac @ 0x7f89e5017800] Assuming an incorrectly encoded 7.1 channel layout instead of a spec-compliant 7.1(wide) layout, use -strict 1 to decode according to the specification instead.
Input #0, mpegts, from 'N4SGWtf5_~9R23.ts':
  Duration: 00:00:20.01, start: 64000.040000, bitrate: 5810 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, 50 fps, 50 tbr, 90k tbn, 100 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 7.1, fltp, 310 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> webp (libwebp))
Press [q] to stop, [?] for help
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805600] reference picture missing during reorder
    Last message repeated 3 times
[h264 @ 0x7f89e6805600] Missing reference picture, default is 0
[h264 @ 0x7f89e6805600] decode_slice_header error
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6805c00] reference picture missing during reorder
    Last message repeated 1 times
[h264 @ 0x7f89e6805c00] Missing reference picture, default is 0
    Last message repeated 1 times
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
[h264 @ 0x7f89e6806200] reference picture missing during reorder
[h264 @ 0x7f89e6806200] Missing reference picture, default is 2
Output #0, webp, to 'foo.webp':
  Metadata:
    encoder         : Lavf58.42.100
    Stream #0:0: Video: webp (libwebp), yuv420p, 1280x720, q=2-31, 200 kb/s, 50 fps, 1k tbn, 50 tbc
    Metadata:
      encoder         : Lavc58.76.100 libwebp
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

Change History (9)

comment:2 by Carl Eugen Hoyos, 5 years ago

Why do you think there is a bug that can be fixed in FFmpeg?

comment:3 by ronag, 5 years ago

I supposed that mpegts files should be seekable in FFmpeg? In this specific case for whatever reason an otherwise working file is not possible to seek using FFmpeg.

It can seek to certain places but not others, e.g. the same command above will succeed without errors when instead using "-ss 2".

It looks like ffmpeg doesn't seek to a keyframe and then decode + skip until the correct frame like it does with other container formats. Just guessing... or maybe there is a technical reason specific to mpegts which makes this not possible?

comment:4 by ronag, 5 years ago

With further research it seems that the last key frame is at 15 seconds, seeking anything beyond that fails. The file is encoded with libx264 -tune zerolatency so bframes should be disabled... not sure what is going on

comment:5 by Carl Eugen Hoyos, 5 years ago

Resolution: invalid
Status: newclosed

I don't think there is an issue that can be fixed.

comment:6 by Balling, 5 years ago

Does it play good in Windows 10 player (from Microsoft store, Movies & TV)? See https://www.microsoft.com/en-us/p/movies-tv/9wzdncrfj3p2?activetab=pivot:overviewtab
Actually I have the same problem that looks like a duplicate of #7950

Last edited 5 years ago by Balling (previous) (diff)

comment:7 by Jesper Ek, 5 years ago

Resolution: invalid
Status: closedreopened

cehoyos, with all do respect, I think you're wrong.

Looks more like a duplicate of #4868 and #5093 to me

This is very easy to recreate:

ffmpeg -f lavfi -i testsrc=duration=5 -c:v libx264 out.ts
ffmpeg -ss 1 -i out.ts -f null -

comment:8 by Carl Eugen Hoyos, 5 years ago

Resolution: invalid
Status: reopenedclosed

Why are you reopening this ticket if it is a duplicate?

We both agree that there is no keyframe after 16.9 seconds, this cannot be fixed.

comment:9 by Jesper Ek, 5 years ago

Here's another issue #1607

So the reason it's failing is because it's falling back to the generic ff_gen_search, which doesn't respect keyframe searching when AVSEEK_FLAG_ANY flag is unset.

What do you mean it cannot be fixed? Are you saying that you cannot use the previous keyframe and decode the next frames based on that keyframe? I think what you mean is that it's difficult to seek to the keyframe since there's no index, it's definitely possible.

Note: See TracTickets for help on using tickets.