mpv-player / mpv-player/mpv

On audio timestamp reset, subs become out of sync and parts of the video are skipped

Open
#11,024 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Important Information

Provide following Information:

  • mpv version: git
  • Linux
  • FFmpeg version: 5.1
Reproduction steps

I'm trying to play a video from Hidive. I got the m3u8 url and manually downloaded the subtitles and put it in a place mpv could reach. That is I'm accessing a remote stream with local subtitles. However, when I run mpv I notice that the the subtitles are about 5s off and I start ~5s into the real video (so I skipped 5s of content).
It turns out that Hidive videos start with their logo and after their ~5s logo ends the actual video starts playing. And when the logo ends, the audio timestamp gets reset. Given the correlation, I'm assuming the reset is causing my problem.

The workaround I've been using is to just manually offset the subtitles. With this the reset of the video is watchable. However, this obviously is obviously a dirty hack and ignores the problem of the skipped content and causes a problem if the modified subs are used when the video already fully downloaded

Expected behavior

After the logo finishes, the real video is played from the beginning

Actual behavior

After the logo finishes, we start ~5s into the video starts and the subs are about ~5s off.

I'm not sure if this behavior is ever useful, but having a flag to disable it would be sufficient for my usecase

Log file

mpv.log
Here is the non verbose output:

 (+) Video --vid=1 (h264 854x480 23.976fps) (1540 kbps)
 (+) Audio --aid=1 (aac 2ch 44100Hz) (1540 kbps)
 (+) Subs  --sid=1 '0000.vtt' (webvtt) (external)
AO: [alsa] 48000Hz stereo 2ch float
VO: [gpu] 854x480 => 854x480 yuv420p
AV: 00:00:00 / 00:24:17 (0%) A-V:  0.000 Cache: 4.6s/266KB
[ffmpeg] https: Cannot reuse HTTP connection for different host: static.hidive.com:-1 != video.hidive.com:-1
[ffmpeg/demuxer] hls: keepalive request failed for 'crypto+https://video.hidive.com/content/AZD/HLS/HLS480p/AZD_s01e006_hv_or_na_ja_xx_HLS480p_4x3_00_i00000.ts?Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHBzOi8vdmlkZW8uaGlkaXZlLmNvbS9jb250ZW50L0FaRC9ITFMvKi9BWkRfczAxZTAwNl9odl9vcl9uYV9qYV94eCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NzE0MDE4OTZ9LCJJcEFkZHJlc3MiOnsiQVdTOlNvdXJjZUlwIjoiMjQuNC43LjE3Ni8zMiJ9LCJEYXRlR3JlYXRlclRoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTY3MTM5NDM5Nn19fV19&Signature=Plu0DSvlgmHCAIiaSUVeIkie8Jq8H39nHoR7DrKVOmG-6rwks4HQbSvOQvP5CxkJMnxeVVm8s3Styd36I5nODklZpyGtDY2UfeSk8R2AsnLSqEEPp9CwvcwEoCBqltDiU-Z~URIQarakZbVkBhUhU2IxCYEAGL3LLvxsbQ2kQ0Iu3VytYzGxiU7F8xoU8rwKwTR4K8riavm8tzByxBrtQHW~fQEar3mtT5u0oYFWcqDtE3etWfqdcu9uKTdunHIWS3CVJkAwfcXG1M2VK3AOGO7NqCfAVSmdXVaJbUNJ0MJOFLYYL3GFavSu-A8ymc5wHwgqBh001MjB-9uCeUwQ2Q__&Key-Pair-Id=KH8YN22TJF8FN' with error: 'Invalid argument' when opening url, retrying with new connection
AV: 00:00:00 / 00:24:17 (0%) A-V:  0.000 Cache: 4.5s/259KB
[ffmpeg/demuxer] mpegts: Packet corrupt (stream = 1, dts = 572697).
[ffmpeg/demuxer] hls: Packet corrupt (stream = 1, dts = 568943).
AV: 00:00:04 / 00:24:17 (0%) A-V:  0.001 Cache: 180s/17MB
Invalid audio PTS: 5.108390 -> 0.000000
Reset playback due to audio timestamp reset.
[ffmpeg/video] h264: co located POCs unavailable
(...) AV: 00:00:00 / 00:24:17 (0%) A-V:  0.000 Cache: 187s/17MB
VO: [gpu] 720x480 => 720x540 yuv420p

I originally ran mpv with the --merge-files option for unrelated reasons. However removing it didn't affect the issue at hand

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the attached mpv.log and the messages "Invalid audio PTS" and "Reset playback due to audio timestamp reset." Reproduce the Hidive stream with its external VTT subtitles and trace the audio timestamp reset handling. Done means playback starts at the real beginning after the logo, subtitles remain synchronized, and no content is skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
audio-video-rtc, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.