Videos trimmed by Quicktime fail to play properly
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: 0.34.1
- macOS Version: 12.4
- Source of the mpv binary or bundle: stolendata
- If known which version of mpv introduced the problem: unknown
- Possible screenshot or video of visual glitches
The visual glitch is that shortly after playback starts the video freezes for a while before continuing to play. One aspect of the problem can be seen in this screenshot taken before playback has started by using the --pause option. Notice the current playback position timestamp in the on screen controller is negative:

Shouldn't this option, which is enabled by default, have insured the start time is 0?:
--rebase-start-time=<yes|no>
Whether to move the file start time to 00:00:00 (default: yes). This is less awkward for files which start at a random timestamp, such as transport streams. On the other hand, if there are timestamp resets, the resulting behavior can be rather weird. For this reason, and in case you are actually interested in the real timestamps, this behavior can be disabled with no.
Reproduction steps
Merely play the linked video in the sample files section below. The video will start playing without audio. Then the video will freeze. At that point the audio will start playing. Eventually video playback will resume.
The origin of this issue is IINA issue https://github.com/iina/iina/issues/3848. The reporter of that issue has been using Quicktime on a Mac to trim videos. The resulting videos play fine using Quicktime or VLC, but exhibit the undesirable behavior when starting playback if played under IINA or mpv.
The playback behavior experienced in this issue matches the behavior reported in issue https://github.com/mpv-player/mpv/issues/8876. However that issue concerns videos cut by FFmpeg running under Linux and as pointed out in that issue there are other ways to cut files using FFmpeg, for example using the avoid_negative_ts option. This issue with videos trimmed by Quicktime is more of a problem as Quicktime does not provide Mac users any options on how videos are trimmed.
As in https://github.com/mpv-player/mpv/issues/8876 mpv is reporting A/V desynchronization when playing the file created by Quicktime:
[ 21.895][w][cplayer] Audio/Video desynchronisation detected! Possible reasons include too slow
To create a video that demonstrates this problem:
- Pick a video that has large gaps between I-frames
- Open the video on a Mac with using Quicktime
- Use the Quicktime trim feature to trim away some of the start of the video
- Save the trimmed video
- Play the trimmed video using mpv looking for glitches when playback begins
How severe the playback glitch is depends upon where the video is cut in relation to I-frames.
Expected behavior
Mac users trimming a file using Quicktime expect the resulting file will play without glitches using IINA, mpv, Quicktime or VLC.
Actual behavior
The video starts playing without audio. Then the video freezes and the audio starts playing. Eventually the video resumes playing.
Log file
The log file was generated by running mpv like so:
low-batt@gag quicktime-issue$ /Applications/mpv.app/Contents/MacOS/mpv -no-config -v -v --log-file=low-batt-mpv-quicktime-trim-issue.log --pause --script-opts=osc-visibility=always low-batt-mpv-quicktime-trim-issue.mp4
Sample files
This is the video low-batt-mpv-quicktime-trim-issue.mp4 created by using the Quicktime trim function.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the linked sample file using the reported mpv command and inspect the linked verbose log. Read the handling around --rebase-start-time and the reported audio/video desynchronisation, then compare playback with the QuickTime-trimmed file. Done means the sample starts with synchronized audio and video without the freeze.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, macos
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100