• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Xuggler and subtitles

 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xuggler (or Xuggle) is a great Audio/Video library for Java based on FFMpeg (so it can open almost everything existing on the planet)

As it is great, it has not a lot of documentation, specially for subtitles.

i was able to come with a bit of code that is supposed to read subtitles from a file

the only problem is that the text read is without the timecodes or the subtitle numbers as there is in SRT files:

i have this :


instead of this :


so this a problem and i really don't see where it comes from!

here is the code of the function I used:




Addendum:
To run the code you will need the Xuggler library available here : Xuggler 5.4
if the compiler says something about slf4j you will need that library too : slf4j
and here is a test file with a subtitle in it : title01_track3.mks

thanks for everything

Jeff
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jean-francois Le Bas wrote:As it is great, it has not a lot of documentation


That quote seems a little backwards to me: any tool should be well documented. If it is not well documented then it would make it less likely for me to call it great.

But back to your question: it looks like you get the subtitles from an IPacket, and it looks like IPacket has methods for getting timestamps - so maybe that is where you get the time codes? As for the subtitle numbers, not sure, but maybe the first IPacket will be subtitle 1, the second IPacket 2, etc... that is pretty naive of me but that is because I don't know the format, I just took a quick peak at the IPacket API (found on the Xuggler website)
 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your answer

you were right about timestamps
packet.getFormattedTimeStamp() give me 00:00:15,740
you were also right about the fact that each packet is a subtitle

the only problem is to get the subtitle end time. i tried :
packet.getConvergenceDuration()
packet.getCurrentRefCount()
packet.getDts()
packet.getDuration()
packet.getMaxSize()
packet.getMyCPtr()
packet.getPosition()
packet.getPts()
packet.getSize()
packet.getStreamIndex()
packet.getTimeStamp()
packet.getTimeBase().getDouble()

none of them gave me the duration or end timecode

if you have any idea...


 
Hristo Hristov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I do hope that you found the huge mistake in what you said - you have a method called getDuration()
 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jean-francois Le Bas wrote:
packet.getDuration()

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic