Audio sync issue with mismatched track lengths
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Version
Media3 1.2.0
More version details
No response
Devices that reproduce the issue
All
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
If I have a list of video files that have mismatched track duration's. Ex: Video track is 3000ms but audio track is 3030ms.
Then pass that to Transformer, the audio will eventually desync from the video. I have tried to fix this by using MediaExtractor to extract the duration of the audio and video track. Then take the shortest of those two durations, and pass that into the MediaItem.setClippingConfiguration().
This helps reduce the audio lag, but it still gets out of sync.
I will be emailing a zip file containing an Android application where you can reduce this.
Once you run the app there are three different clipping options:
- None
- Shortest Track
- This will do what I mentioned above and take the shortest of the two tracks
- Custom
- This allows you to set a custom
endPositionMsfor theClippingConfiguration
- This allows you to set a custom
I have the third option, because once clipped to 1000ms, there is no sync issue whatsoever. So in my testing I tried lopping off more and more milliseconds to see what the minimum number of milliseconds I needed to trim to keep it in sync. But that ended up losing too many frames.
Expected result
The exported video file's audio and video should be synced.
Actual result
The audio slowly drifts out of sync, and by the end of the video the audio is drastically out of sync.
Media
I will be emailing a reproduction project, which contains all the assets and a application to test it.
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Contributor guide
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.
Assessment
This issue has not been assessed yet.