[Issue]: ASS subtitles embedded in MKV files sometimes don't display (due to ffmpeg bug) #4643

Closed
opened 2026-02-07 01:02:16 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @timangus on GitHub (Feb 18, 2023).

Please describe your bug

Jellyfin uses ffmpeg to extract embedded subtitles from their containers. In the case of ASS/SSA encoded subtitles in an MKV container, this results in a corrupt subtitle file that has a null character in its output, before the [Events] section of the file. (Presumably) Jellyfin interprets this null as the end of the string and ignores the rest of the file and thus the subtitles themselves, so they're never displayed. In any case, with the ffmpeg patch below applied, everything works fine.

I've tracked this down to be files that are encoded using Handbrake, which is a large fraction of files in my n=1 survey. It's arguable whether Handbrake is at fault here, but nevertheless the way ffmpeg deals with the problem is not great, so I've submitted a patch to the ffmpeg list, but despite my prompting (on the list itself and IRC) it does not seem to be of interest to the developers. I don't know the situation with Jellyfin and whether its included ffmpeg has patches applied, but if it does that is a potential route to getting this fixed in Jellyfin at least.

The patch is here: http://ffmpeg.org/pipermail/ffmpeg-devel/2023-January/306017.html
I've also entered a bug in ffmpeg trac here: https://trac.ffmpeg.org/ticket/10203 (I believe you can vote on bugs ;) )

Jellyfin Version

10.8.0

if other:

No response

Environment

- OS: All
- Virtualization: None
- Clients: Present on all clients I tried, but irrelevant in any case
- Browser: N/A
- FFmpeg Version: Whatever is included with latest (10.8.9 at time of submission)
- Playback Method: N/A
- Hardware Acceleration: N/A
- Plugins: None
- Reverse Proxy: None
- Base URL: N/A
- Networking: N/A
- Storage: Local

Jellyfin logs

No response

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @timangus on GitHub (Feb 18, 2023). ### Please describe your bug Jellyfin uses ffmpeg to extract embedded subtitles from their containers. In the case of ASS/SSA encoded subtitles in an MKV container, this results in a corrupt subtitle file that has a null character in its output, before the [Events] section of the file. (Presumably) Jellyfin interprets this null as the end of the string and ignores the rest of the file and thus the subtitles themselves, so they're never displayed. In any case, with the ffmpeg patch below applied, everything works fine. I've tracked this down to be files that are encoded using Handbrake, which is a large fraction of files in my n=1 survey. It's arguable whether Handbrake is at fault here, but nevertheless the way ffmpeg deals with the problem is not great, so I've submitted a patch to the ffmpeg list, but despite my prompting (on the list itself and IRC) it does not seem to be of interest to the developers. I don't know the situation with Jellyfin and whether its included ffmpeg has patches applied, but if it does that is a potential route to getting this fixed in Jellyfin at least. The patch is here: http://ffmpeg.org/pipermail/ffmpeg-devel/2023-January/306017.html I've also entered a bug in ffmpeg trac here: https://trac.ffmpeg.org/ticket/10203 (I believe you can vote on bugs ;) ) ### Jellyfin Version 10.8.0 ### if other: _No response_ ### Environment ```markdown - OS: All - Virtualization: None - Clients: Present on all clients I tried, but irrelevant in any case - Browser: N/A - FFmpeg Version: Whatever is included with latest (10.8.9 at time of submission) - Playback Method: N/A - Hardware Acceleration: N/A - Plugins: None - Reverse Proxy: None - Base URL: N/A - Networking: N/A - Storage: Local ``` ### Jellyfin logs _No response_ ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here _No response_ ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
OVERLORD added the bug label 2026-02-07 01:02:16 +03:00
Author
Owner

@Snipy2k4 commented on GitHub (Feb 18, 2023):

I also noticed that films with ASS/SSA subtitles created with Handbrake have problems.

A workaround is to extract the subs with MKVToolNix GUI and gMKVExtractGUI and implement them again. Then it also works with Jellyfin as usual.

That's how I currently solved it for myself.

It was a bit of work but oh well...

@Snipy2k4 commented on GitHub (Feb 18, 2023): I also noticed that films with ASS/SSA subtitles created with Handbrake have problems. A workaround is to extract the subs with MKVToolNix GUI and gMKVExtractGUI and implement them again. Then it also works with Jellyfin as usual. That's how I currently solved it for myself. It was a bit of work but oh well...
Author
Owner

@nyanmisaka commented on GitHub (Feb 18, 2023):

image

I can reproduce the issue. The patch will be included in our next jellyfin-ffmpeg release.

Thanks for your contribution! This may take longer to be noticed by upstream.

@nyanmisaka commented on GitHub (Feb 18, 2023): ![image](https://user-images.githubusercontent.com/14953024/219865774-14f476b0-b972-488e-96cd-d0015932c0b2.png) I can reproduce the issue. The patch will be included in our next `jellyfin-ffmpeg` release. Thanks for your contribution! This may take longer to be noticed by upstream.
Author
Owner

@Snipy2k4 commented on GitHub (Feb 18, 2023):

I have now extracted most of the files that had ASS/SSA subtitles as described above and re-entered them. (with MKVToolNix GUI and gMKVExtractGUI)

This is how it currently works with Jellyfin.

When the patch comes, will my actions have a negative impact on functionality? That was 2 weeks of work to do with every series and every film...

@Snipy2k4 commented on GitHub (Feb 18, 2023): I have now extracted most of the files that had ASS/SSA subtitles as described above and re-entered them. (with MKVToolNix GUI and gMKVExtractGUI) This is how it currently works with Jellyfin. When the patch comes, will my actions have a negative impact on functionality? That was 2 weeks of work to do with every series and every film...
Author
Owner

@timangus commented on GitHub (Feb 18, 2023):

When the patch comes, will my actions have a negative impact on functionality? That was 2 weeks of work to do with every series and every film...

Nah, shouldn't make any difference; basically it now treats "ABCDEF...\0" as if the \0 wasn't there, so if your string is already "ABCDEF..." it won't do anything.

@timangus commented on GitHub (Feb 18, 2023): > When the patch comes, will my actions have a negative impact on functionality? That was 2 weeks of work to do with every series and every film... Nah, shouldn't make any difference; basically it now treats "ABCDEF...\0" as if the \0 wasn't there, so if your string is already "ABCDEF..." it won't do anything.
Author
Owner

@timangus commented on GitHub (Apr 10, 2023):

FYI, this now appears to have been addressed upstream:
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=5f92a192315fc9349e7c9bdc923666f79d5c5e8d

@timangus commented on GitHub (Apr 10, 2023): FYI, this now appears to have been addressed upstream: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=5f92a192315fc9349e7c9bdc923666f79d5c5e8d
Author
Owner

@nyanmisaka commented on GitHub (Apr 10, 2023):

Great! Then we don't need to patch the ffmpeg in the future release.

@nyanmisaka commented on GitHub (Apr 10, 2023): Great! Then we don't need to patch the ffmpeg in the future release.
Author
Owner

@Snipy2k4 commented on GitHub (Apr 10, 2023):

I don't understand that, who fixes it then?!

@Snipy2k4 commented on GitHub (Apr 10, 2023): I don't understand that, who fixes it then?!
Author
Owner

@Aghast-Buddhist commented on GitHub (Oct 2, 2023):

Hello,

I am affected by this issue.

Is there a fix or a workaround?

Thank you

@Aghast-Buddhist commented on GitHub (Oct 2, 2023): Hello, I am affected by this issue. Is there a fix or a workaround? Thank you
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#4643