Extracting subtitles in libvlc using ffmpeg or libmatroska

This forum is about all development around libVLC.
samithawijedasa
Blank Cone
Blank Cone
Posts: 21
Joined: 11 Jul 2013 22:52

Extracting subtitles in libvlc using ffmpeg or libmatroska

Postby samithawijedasa » 31 Jul 2013 07:01

Hi,

I have a .mkv video file with soft subtitles. I can extract subtitles from this file into a separate file using mkvextract successfully. But, my requirement is to access and manipulate the subtitles while the video is being played by the custom Qt + libvlc player I developed.

Is there a way to implement a call back so I can access the subtitles while the video is being played? Modifying ffmpeg subtitle.c (for an ffmpeg demuxer supported video file with soft subtitles, in that case, not necessary a .mkv file) or using libmatroska.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Extracting subtitles in libvlc using ffmpeg or libmatros

Postby Jean-Baptiste Kempf » 31 Jul 2013 16:32

What do you want to extract? The text?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

samithawijedasa
Blank Cone
Blank Cone
Posts: 21
Joined: 11 Jul 2013 22:52

Re: Extracting subtitles in libvlc using ffmpeg or libmatros

Postby samithawijedasa » 31 Jul 2013 16:45

What do you want to extract? The text?

Hi,

Yes indeed, the text. We are just passing simple text along with the video. As an example following type of text will appear along with the video in the subtitle form, i.e., whether or not a horn is being pressed and so on.

Horn 0
Break 1
Bell 0

So I need to access this details and draw a grapgh along with the time. According to the log created vlc -vvv it is using decoder module "subsdec" when I played the mkv file I have. So would it be possible to modify this?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Extracting subtitles in libvlc using ffmpeg or libmatros

Postby Jean-Baptiste Kempf » 31 Jul 2013 19:53

Then you need to get access to freetype or do a similar plugin than freetype.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

samithawijedasa
Blank Cone
Blank Cone
Posts: 21
Joined: 11 Jul 2013 22:52

Re: Extracting subtitles in libvlc using ffmpeg or libmatros

Postby samithawijedasa » 31 Jul 2013 23:49

Then you need to get access to freetype or do a similar plugin than freetype.
Hi,

subsdec.c is indeed the file that is being used as the subtitle type is 'subt'. I modified the "static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )" function in this file to dump the subtitles while the video is played to the command prompt and recompiled vlc. So now it dumps the subtitle text to the command prompt while the video is playing.

Now my concern is can I implement a callback so I can call it in my media player application so I can direct this output to a Qt window or a text box?

shockeme
New Cone
New Cone
Posts: 1
Joined: 16 Sep 2018 21:10

Re: Extracting subtitles in libvlc using ffmpeg or libmatroska

Postby shockeme » 16 Sep 2018 21:11

Do you have the source code where you dumped the subtitles to the commandline? I am trying to do something similar where I extract the subtitles and want to put them into a file. I haven't seen a plug in or library to be able to do this, so I have to write my own...

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: Extracting subtitles in libvlc using ffmpeg or libmatros

Postby mfkl » 18 Sep 2018 16:33

can I implement a callback so I can call it in my media player application so I can direct this output to a Qt window or a text box?
Do share your findings if you can
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 41 guests