Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing discrepancy with bd:// playback after seeking #15679

Open
6 tasks done
llm96 opened this issue Jan 11, 2025 · 3 comments
Open
6 tasks done

Timing discrepancy with bd:// playback after seeking #15679

llm96 opened this issue Jan 11, 2025 · 3 comments

Comments

@llm96
Copy link

llm96 commented Jan 11, 2025

mpv Information

mpv v0.39.0-615-gca211b5b Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on Jan 11 2025 00:10:20
libplacebo version: v7.350.0 (v7.349.0-30-g056b852-dirty)
FFmpeg version: N-118281-gb76053d8b
FFmpeg library versions:
   libavcodec      61.31.100
   libavdevice     61.4.100
   libavfilter     10.6.101
   libavformat     61.9.105
   libavutil       59.55.100
   libswresample   5.4.100
   libswscale      8.13.100

Other Information

- Windows version: Microsoft Windows NT 10.0.26100.0/26100.1457
- GPU model, driver and version: NVIDIA GeForce RTX 3080, DCH, 560.94
- Source of mpv: https://github.com/shinchiro/mpv-winbuild-cmake/releases/tag/20250111
- Latest known working version: N/A (earliest tested was v0.30.0)
- Issue started after the following happened: N/A

Reproduction Steps

I'm trying to play some Blu-ray discs with external subtitles. Works as expected when played from start to finish, but seeking ahead appears to shift the timing, resulting in the subtitles playing too quickly.

(BAD) open from disc, seek ahead to ending credits

# log: output-bd-seek-cli-bad.txt
mpv bd://12/E:/ --no-config --start=00:09:45.00 --sub-file=[...]

(OK) open from disc, play to completion without seeking

# log: output-bd-no-seek-ok.txt
mpv bd://12/E:/ --no-config --sub-file=[...]

(OK) open from local .m2ts file, seek ahead to the same time

# log: output-m2ts-seek-ok.txt
mpv 00070.m2ts --no-config --start=00:09:45.00 --sub-file=[...]

Expected Behavior

After seeking ahead, playing for a few seconds, then pausing on a specific frame, the current time in the OSD should match up across all instances and the subtitles should remain in sync.

Actual Behavior

When playing from disc with the bd:// URL, the time has now drifted ahead (00:09:49.333 vs. 00:09:48.505) and the subtitles are playing too early. This happens regardless of whether the seek was done with --start= or manually from the OSD.

However, if the video was played from disc up to this point without seeking ahead, the time will match the local .m2ts file and the subtitles will remain in sync as expected.

output-bd-seek-cli-bad.txt output-bd-no-seek-ok.txt output-m2ts-seek-ok.txt
bd seek ahead bad timestamp bd no seek correct timestamp m2ts seek ahead correct timestamp

Log File

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.
@llm96 llm96 added the os:win label Jan 11, 2025
@llm96
Copy link
Author

llm96 commented Jan 13, 2025

Did a bit more testing after seeing this comment here. Tried opening with lavf://bluray:e: instead, and this both fixes the out-of-sync subtitles issue mentioned above, but also fixes the visual artifacts that would consistently appear after seeking.

I'm very happy with it as a workaround, but the loss of chapters is a little unfortunate.

Logs for reference:

@llm96
Copy link
Author

llm96 commented Jan 13, 2025

I think I spoke too soon. The playlist I initially had success with only had one file, but those with more than one appear to report the duration incorrectly. I don't suppose there's a way to use the duration from bd:// when using lavf://?

Sorry if this is report is getting a bit sidetracked, since this is probably an FFmpeg bug... unless I'm just missing an option or something. The second file in the playlist is close to the bad duration, but when the player opens it still plays the first file.

playlist from another disc with two files - mpv reports the correct duration when using bd://

[bd] idx:   5 duration: 00:26:27 (playlist: 00008.mpls)

trimmed report from BDInfo showing the two files in the playlist

PLAYLIST REPORT:

Name:           00008.MPLS
Length:         00:26:27.586 (h:m:s.ms)
Size:           4,622,764,032 bytes
Total Bitrate:  23.29 Mbps

FILES:

Name            Time In         Length          Size            Total Bitrate   
--------------- -------------   -------------   -------------   -------------   
00008.M2TS      0:00:00.000     0:24:12.451     4,517,652,480   24,884 kbps     
00017.M2TS      0:24:12.451     0:02:15.135     105,111,552      6,225 kbps  

playing in mpv w/ lavf, incorrect duration (00:02:12)

>mpv lavf://bluray:d: --stream-lavf-o=playlist=8
[ffmpeg/demuxer] mpegts: start time for stream 3 is not set in estimate_timings_from_pts
[ffmpeg/demuxer] mpegts: start time for stream 4 is not set in estimate_timings_from_pts
[ffmpeg/demuxer] mpegts: stream 1 : no PTS found at end of file, duration not set
[ffmpeg/demuxer] mpegts: stream 2 : no PTS found at end of file, duration not set
src/libbluray/bluray.c:300: 00008.m2ts: no timestamp for SPN 0 (got 0). clip 27000000-92360295.
[ffmpeg/demuxer] mpegts: Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
[ffmpeg/demuxer] Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[ffmpeg/demuxer] mpegts: Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
[ffmpeg/demuxer] Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
● Video  --vid=1  (h264 1920x1080 23.976 fps)
● Audio  --aid=1  (dts 2ch 48000 Hz)
○ Audio  --aid=2  (dts 2ch 48000 Hz)
○ Subs   --sid=1  (hdmv_pgs_subtitle)
○ Subs   --sid=2  (hdmv_pgs_subtitle)
[vo/gpu/d3d11] Using a software adapter
AO: [wasapi] 44100Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
(Paused) AV: 00:00:01 / 00:02:12 (1%) A-V:  0.000 Cache: 30s/72MB

same duration & warnings with ffprobe

>ffprobe -playlist 8 bluray:d:
ffprobe version 7.1-full_build-www.gyan.dev Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 14.2.0 (Rev1, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libopenjpeg --enable-libquirc --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-libqrencode --enable-librav1e --enable-libsvtav1 --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-liblc3 --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[bluray @ 000001f798e36500] 9 usable playlists:
[mpegts @ 000001f798e1f500] start time for stream 3 is not set in estimate_timings_from_pts
[mpegts @ 000001f798e1f500] start time for stream 4 is not set in estimate_timings_from_pts
[mpegts @ 000001f798e1f500] stream 1 : no PTS found at end of file, duration not set
[mpegts @ 000001f798e1f500] stream 2 : no PTS found at end of file, duration not set
../src/libbluray/bluray.c:299: 00008.m2ts: no timestamp for SPN 0 (got 0). clip 27000000-92360295.
[mpegts @ 000001f798e1f500] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 000001f798e1f500] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'bluray:d:':
  Duration: 00:02:12.80, start: 600.000000, bitrate: 278481 kb/s
  Program 1
  Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn
  Stream #0:1[0x1100]: Audio: dts (dca) (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, stereo, s32p (24 bit)
  Stream #0:2[0x1101]: Audio: dts (dca) (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, stereo, s32p (24 bit)
  Stream #0:3[0x1200]: Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)
  Stream #0:4[0x1201]: Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090)

@Dudemanguy
Copy link
Member

IIRC, seeking with discs in general is pretty broken. Maybe one day I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants