ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Add SAMI subtitle decoder

Open BROUDING opened this issue 6 years ago • 9 comments

I've searched here and there for history checkup.. and nothing showed up and no one asked... Why is showing SAMI not so popular issue?

Thanks for your precious time in advance.

BROUDING avatar May 10 '19 11:05 BROUDING

You can set the preferred subtitle language in the parameters of DefaultTrackSelector. The parameters builder has a method setPreferredTextLanguage which accepts language codes (e.g. "smi"). Note that this still requires that the media contains a text track for the preferred language.

tonihei avatar May 10 '19 11:05 tonihei

@tonihei Thanks for your time!

I thought that was actually choosing "language"... I'm not sure if you got my point actually, I'm trying to merge Mediasources before playing the media, so I was looking for proper MimeTypes like MimeTypes.TEXT_VTT.

private fun getVTTSubtitleMediaSource(subtitleUri:String, language:String): MediaSource { val vttFormat = Format.createTextSampleFormat("identifier", MimeTypes.TEXT_VTT, 0, language) return SingleSampleMediaSource.Factory(DefaultHttpDataSourceFactory("ua")).createMediaSource(Uri.parse( subtitleUri ), vttFormat, C.TIME_UNSET) }

Can you explain this perspective..? What can I do to achieve this?

BROUDING avatar May 10 '19 12:05 BROUDING

I'm not sure I fully understand the problem.

If you merge a subtitle MediaSource as in the example you just provided, the selection process is still the same as if that subtitle track has been part of the media all along. By default, no text track is selected unless it's marked as forced in the selectionFlags parameter of the Format. And you can specify a preferred language using the parameters to select a track of that language.

tonihei avatar May 10 '19 12:05 tonihei

I'm so sorry to confuse you. My question is about file extension smi Probably my bad english helped(not helped).

My clear question would be this MimeType for SUBTITLE_LINK.vtt would be MimeTypes.TEXT_VTT MimeType for SUBTITLE_LINK.srt would be MimeTypes.APPLICATION_SUBRIP

My question is, MimeType for SUBTITLE_LINK.smi would be ???

BROUDING avatar May 10 '19 12:05 BROUDING

Ah, I think I understand the problem now :)

You are not talking about the Sami language with "smi" language code, but about the Sami subtitle format with "smi" file extension. I wasn't aware that this format exists - sorry for the confusion.

In this case, the answer is that it is not possible to play that with the ExoPlayer at the moment, because we don't have a decoder for SAMI subtitles. If you are sufficiently motivated to write one, you can do that in the same style as the other subtitle decoders in this directory. We would also accept pull requests for high-quality code contributions.

I'll also mark this issue as an enhancement because we don't currently support this format.

tonihei avatar May 10 '19 12:05 tonihei

No- my english wasn't good enough to deliver what I was asking.

Thank you for the quick and clear answer, I clearly didn't even know existence of language Sami. My knowledge about subtitle is very short and personally I'm chasing by time a lot recently, So I'll need to tell my coworkers to only accept srt or vtt extensions for now.

Thank you so much and good luck with your project! ExoPlayer is such a great work with lots of effort by numerous people.

BROUDING avatar May 10 '19 13:05 BROUDING

Thanks, good to know. I'll also mark as "low priority" because this support has not been requested so far and we are unlikely to add it soon (unless someone provides a pull request).

tonihei avatar May 10 '19 13:05 tonihei

I request support sami subtitles, too. Most Koreans use sami subtitles.

realizm avatar May 18 '20 04:05 realizm

Good day! Is there any progress on the ticket?

thathorizon avatar Feb 19 '25 12:02 thathorizon