wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes Xuggler and subtitles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Xuggler and subtitles" Watch "Xuggler and subtitles" New topic
Author

Xuggler and subtitles

Jean-francois Le Bas
Greenhorn

Joined: Aug 16, 2012
Posts: 10
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

Joined: Jan 28, 2003
Posts: 4181
    
  21

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)


Steve
Jean-francois Le Bas
Greenhorn

Joined: Aug 16, 2012
Posts: 10
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

Joined: Jun 11, 2013
Posts: 1
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

Joined: Aug 16, 2012
Posts: 10
Jean-francois Le Bas wrote:
packet.getDuration()

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Xuggler and subtitles