Is it possible to get subtitles from popular video file formats (*.mp4, *.mkv, *.avi etc.) using some library or API to third-party software? Preferable language is Java, but this is not a requirement.
Asked
Active
Viewed 2,489 times
1 Answers
0
Recently I am study on ffmpeg you can find some information from here. As far as I know ffmpeg can extract the subtitles as a txt stream of a video file. But I not sure if it difficult to use ffmpeg to meet your requirement. I just take a look at the file ffplay.c which you can find in the ffmpeg open source codes. I found some codes as follows
switch(avctx->codec_type){
case avmedia_type_audio:
is->last_audio_stream = stream_index;
if(audio_codec_name)
codec = avcodec_find_decoder_by_name(audio_codec_name);
break;
case avmedia_type_subtitle:
is->last_subtitle_stream = stream_index;
if(subtitle_codec_name)
codec = avcodec_find_decoder_by_name(subtitle_codec_name);
break;
case avmedia_type_video:
is->last_video_stream = stream_index;
if(video_codec_name)
codec = avcodec_find_decoder_by_name(video_codec_name);
break;
}
and grep 'subtitle' in the file ffplay.c, you'll find more information.
Hope it helps, hope ffmpeg do the help.

Alan
- 469
- 10
- 26