This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Xuggler and subtitles  RSS feed

 
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
 
Bartender
Posts: 4179
22
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...


 
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()

 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!