Skip to content

Fix/workaround inflated video duration (Safari only)#1317

Merged
gregorydlogan merged 1 commit into
opencast:r/19.xfrom
owi92:safari-zone
May 12, 2026
Merged

Fix/workaround inflated video duration (Safari only)#1317
gregorydlogan merged 1 commit into
opencast:r/19.xfrom
owi92:safari-zone

Conversation

@owi92
Copy link
Copy Markdown
Contributor

@owi92 owi92 commented Apr 30, 2026

Safari has an annoying bug where recordings without audio tracks will produce mp4s with broken duration metadata. This results in videos that are roughly double the correct duration.
Adding a fake silent audio track helps Safari to recognize the correct duration by cross checking both tracks.

However this fix comes with the downside that non-audio recordings now have that fake audio track baked in, as it can't be easily removed without reprocessing. My guess is that this is fine, but it would obviously be nicer if that weren't the case.

I don't like this workaround, it's weird. At least it is scoped purely to Safari, and from what I can tell it is the simplest solution for this issue. I have looked at other web-based recording tools in Safari to see how they deal with this, but they either

  • (a) don't support Safari at all, or
  • (b) also appear to be featuring a silent audio track

The ones that are open source are in the first category, proprietary ones in the second, so unfortunately I couldn't look at their code.

@github-actions github-actions Bot added the status:conflicts Conflicts with another pull request or issue label May 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@owi92 owi92 changed the base branch from develop to r/19.x May 5, 2026 15:50
@github-actions github-actions Bot removed the status:conflicts Conflicts with another pull request or issue label May 5, 2026
Safari has an annoying bug where recordings without audiotracks
will produce mp4s with broken duration metadata, which results
in videos that are roughly double the correct duration.
Adding a fake silent audio track helps Safari to recognize the
correct duration by cross checking both tracks.

However this fix comes with the downside that non-audio recordings
now have that faux audio track baked in, as it can't be easily removed
without remuxing the recording. My guess is that this is fine,
but it would obviously be nicer if that weren't the case.
@snoesberger
Copy link
Copy Markdown

I tested this fix on my Mac with Safari and can confirm that the length of a recording without audio is correct again.

Btw. afterwards, you can deselect the empty audio track in the editor's track selection and publish the recording without the empty audio track.

@gregorydlogan gregorydlogan self-assigned this May 12, 2026
@gregorydlogan gregorydlogan merged commit ba1b9ac into opencast:r/19.x May 12, 2026
2 checks passed
@LukasKalbertodt
Copy link
Copy Markdown
Member

@gregorydlogan did you intend to merge this? Afaik there was no code review yet. I'm just confused as you never merged Studio PRs, except your own management PRs.

I did look over the code and it looks fine to me (even tho I didn't deeply verify everything). So we can keep it as is. Just wondering if you accidentally pressed "merge" on the wrong PR.

@gregorydlogan
Copy link
Copy Markdown
Member

Nope, I meant to.

I looked over the code, confirmed it worked on my machine, and Sascha confirmed it works on the mac. I'm by no means an expert in Typescript, but I've done enough at this point to spot when I don't know things. This looked good enough to me.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants