Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRT subs position tags #4306

Closed
ghost opened this issue May 28, 2018 · 7 comments
Closed

SRT subs position tags #4306

ghost opened this issue May 28, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented May 28, 2018

### Issue description
It doesn't recognize the position of the subtitles. I don't know if its possible just ignore and not show the tag, or position in the correct place.

Link to test content

Image of subs

Version of ExoPlayer being used

Plex android app embedded.

@ojw28
Copy link
Contributor

ojw28 commented May 29, 2018

According to this thread positional tags like {\an8} aren't actually part of the SRT format, although some tools do appear to support such tags.

It's really hard for us to support subtitle formats that aren't properly specified, and in particular where undocumented additions have been made, as appears to be the case here. I'm going to class this as an enhancement rather than a bug, since the tags aren't really part of SRT, and mark it as low priority. We would accept a pull request into the dev-v2 branch to either ignore such tags or handle them properly, so please feel free to send such a request if you're sufficiently motivated to fix this yourself. Thanks!

@szaboa
Copy link
Contributor

szaboa commented Jul 13, 2018

After a quick research, I got the same conclusion as mentioned above, those tags are not part of the SRT format. People started to borrow these tags from other places over time and step by step the players started to support them. These tags are taken from ASS (https://www.matroska.org/technical/specs/subtitles/ssa.html). I will try to add support for these \an tags, as my first contribution to ExoPlayer. What do you think @ojw28 ?

@ojw28
Copy link
Contributor

ojw28 commented Jul 13, 2018

That would be great! A few things to keep in mind to help us merge any changes with minimal effort:

  1. I would not envisage you needing to change anything in Cue, SubtitlePainter or SubtitleView to achieve this. Cue already supports positioning that's hopefully flexible for what you need to do, and the UI classes already make use of it. If you find yourself needing to edit those classes, I'd suggest we discuss that before you go too far :).
  2. Given the tags aren't part of the format, please make sure you're handling of them is really robust (i.e. does not crash if the tag isn't exactly as expected). We can't really have loads of confidence that they'll be formatted correctly, given they've not been properly defined :).

Thanks!

@szaboa
Copy link
Contributor

szaboa commented Jul 14, 2018

Sure thing!
Just started to working on it, I will do the pull-request once is done, thank you :)

@szaboa
Copy link
Contributor

szaboa commented Jul 15, 2018

@ojw28
I am about to extend com.google.android.exoplayer2.text.subrip.SubripDecoderTest, but it seems all the tests are failing for me:

WARNING: No manifest file found at ./src/test/AndroidManifest.xml.
Falling back to the Android OS resources only.
To remove this warning, annotate your test class with @Config(manifest=Config.NONE).
No such manifest file: ./src/test/AndroidManifest.xml

java.io.FileNotFoundException: Asset file subrip/typical_negative_timestamps not found

	at org.robolectric.shadows.ShadowAssetManager.findAssetFile(ShadowAssetManager.java:348)
	at org.robolectric.shadows.ShadowAssetManager.open(ShadowAssetManager.java:322)
	at android.content.res.AssetManager.open(AssetManager.java)
	at com.google.android.exoplayer2.testutil.TestUtil.getInputStream(TestUtil.java:142)
	at com.google.android.exoplayer2.testutil.TestUtil.getByteArray(TestUtil.java:138)
	at com.google.android.exoplayer2.text.subrip.SubripDecoderTest.testDecodeTypicalNegativeTimestamps(SubripDecoderTest.java:117)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:568)
	at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:253)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:130)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:42)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:84)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)

This is a known issue or what am I missing? :)

@ojw28
Copy link
Contributor

ojw28 commented Jul 16, 2018

That's an Android Studio bug, where it doesn't set the working directory properly. After you first try and run the tests (and they fail), you'll see it as the thing that's selected to run in the drop-down (by default near the top right of the Android Studio UI). Click the drop-down and select "Edit Configuration". You should see a "Working directory" configuration property for the tests. Click the icon at the far right of that box, and select "MODULE_DIR", then click OK. Re-run the tests and they should work correctly.

szaboa added a commit to szaboa/ExoPlayer that referenced this issue Jul 24, 2018
@szaboa
Copy link
Contributor

szaboa commented Jul 24, 2018

@ojw28, It seems I am ready with this one, here is the pull request:

New one: #4582

#4569 Closed this, because the pull request was made from dev-2 and not a feature branch

szaboa added a commit to szaboa/ExoPlayer that referenced this issue Sep 21, 2018
szaboa added a commit to szaboa/ExoPlayer that referenced this issue Oct 1, 2018
szaboa added a commit to szaboa/ExoPlayer that referenced this issue Oct 1, 2018
szaboa added a commit to szaboa/ExoPlayer that referenced this issue Oct 2, 2018
…signments, setting Cue's textAlignment to def value - null
ojw28 added a commit that referenced this issue Oct 3, 2018
#4306 - Extract tags from SubRip subtitles, add support for alignment
@ojw28 ojw28 closed this as completed Oct 4, 2018
ojw28 added a commit that referenced this issue Oct 20, 2018
#4306 - Extract tags from SubRip subtitles, add support for alignment
@google google locked and limited conversation to collaborators May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants