Page 1 of 1
Extracting subtitles in libvlc using ffmpeg or libmatroska
Posted: 31 Jul 2013 07:01
by samithawijedasa
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.
Re: Extracting subtitles in libvlc using ffmpeg or libmatros
Posted: 31 Jul 2013 16:32
by Jean-Baptiste Kempf
What do you want to extract? The text?
Re: Extracting subtitles in libvlc using ffmpeg or libmatros
Posted: 31 Jul 2013 16:45
by samithawijedasa
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?
Re: Extracting subtitles in libvlc using ffmpeg or libmatros
Posted: 31 Jul 2013 19:53
by Jean-Baptiste Kempf
Then you need to get access to freetype or do a similar plugin than freetype.
Re: Extracting subtitles in libvlc using ffmpeg or libmatros
Posted: 31 Jul 2013 23:49
by samithawijedasa
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?
Re: Extracting subtitles in libvlc using ffmpeg or libmatroska
Posted: 16 Sep 2018 21:11
by shockeme
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...
Re: Extracting subtitles in libvlc using ffmpeg or libmatros
Posted: 18 Sep 2018 16:33
by mfkl
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