Extract subtitles from an mp4 video

Cassia99 -  
hypothetix Posted messages 194 Registration date   Status Member Last intervention   -

Hello!

I have a question regarding an mp4 video. I need to transcribe its subtitles, but I would first like to see if it's possible to extract them from the video. Unfortunately, the original subtitle file is lost. I'm reaching out to you because I don't even know if what I'm asking is possible. I tried EaseUS Video Editor because I understood it could do this kind of manipulation, but it doesn't seem to be able to open mp4 files. Could someone shed some light on this for me?

Thank you and have a great day!

4 answers

  1. hypothetix Posted messages 194 Registration date   Status Member Last intervention   68
     

    Hello,

    For the embedded subtitles in the video
    There is https://sourceforge.net/projects/videosubfinder/
    (seen on https://korben.info/extraire-sous-titre-video.html)


    Correlation between games and international strategies:
    The Chinese play Go, the Russians play chess, the Americans play poker, and the Europeans play tic-tac-toe.

    2
    1. Cassia99
       

      Thank you all for your help! Unfortunately, the subtitles were not included in the codec information, but VideoSubFinder was very helpful. I couldn't extract a text file with the subtitles, but I have a text file with the timestamps, two large images that contain all the subtitles in the form of strips, and a whole series of strips in jpg format, each containing a subtitle and titled with its timestamp (which will allow me to verify).

      0
      1. hypothetix Posted messages 194 Registration date   Status Member Last intervention   68 > Cassia99
         

        The next step is to convert your images to text using OCR

        Optical Character Recognition

        You can try here:

        https://www.freeconvert.com/convert/image-to-text

        There are often corrections to be made depending on the quality of the images.

        Good luck

        0
  2. ziggourat Posted messages 24643 Registration date   Status Contributor Last intervention   5 340
     

    Hello,

    If the subtitles are embedded in the video, then it will not be possible to extract them.

    If they are separate, see the response from jee pee above ;-)

    Best regards


    1
  3. jee pee Posted messages 9444 Registration date   Status Moderator Last intervention   9 981
     

    Hello,

    I have never tried to do this. We should start by studying the video streams to see if it actually contains separate streams.

    For example, with VLC under Tools/Codec Information, you can see in 5, 6, and 7, the subtitles for the hearing impaired, in French and German.

    Because there are several possibilities. The video may contain teletext type subtitles, an old text format, DVB subtitles that are images, or subtitles embedded in the video stream. The latter are impossible to extract.

    Since DVB subtitles are images, the extraction software to create a .srt will need to include an OCR function to recognize the characters and turn the image into text.


    0
    1. Cassia99
       

      Great, thank you very much for this quick and very detailed response! I'll take a look at that right away.

      0
  4. jee pee Posted messages 9444 Registration date   Status Moderator Last intervention   9 981
     

    By looking at https://trac.ffmpeg.org/wiki/ExtractSubtitles
    and https://linuxfr.org/users/mac_is_mac/journaux/extraire-les-sous-titres-des-enregistrements-de-la-tnt-hd
    I explored the possibilities on this subject with FFmpeg. It's a command-line tool, quite complex, as there are dozens of settings. I use it to extract an mp3 from a video, replace the audio of a video, merge videos, change the types of streams, ...

    If the subtitles are in text format, a simple
    ffmpeg.exe -i sugar.mp4 -map 0:5 sugar.srt is enough, and you get a text file

     00:01:12,080 --> 00:01:14,480 <font size="0">{\an7}<font size="9">My name is Damon Gameau.</font></font> 2 00:01:14,960 --> 00:01:16,600 <font size="0">{\an7}<font size="9">Here's my home.</font></font> 3 00:01:17,240 --> 00:01:19,720 <font size="0">{\an7}<font size="9">A time-lapse of my wife's pregnancy.</font></font> 4 00:01:20,160 --> 00:01:21,720 <font size="0">{\an7}<font size="9">Here, three months are left.</font></font> 5 00:01:22,520 --> 00:01:24,920 <font size="0">{\an7}<font size="9">And here’s a photo of me at age 10.</font></font>

    For an image-based subtitle, you need to extract the stream, but I only managed to do it on the hearing-impaired stream (#0:5) of my file, not the French or German streams:
    ffmpeg.exe -i foudre.ts -map 0:5 -scodec copy foudre_5.ts

    and then use SubtitleEdit which seems to be an interesting OCR, it stops on an unrecognized character, asks for its transcription, and thus learns to translate the characters it recognizes poorly: SubtitleEdit.exe foudre_5.ts , and here’s the srt

     1 00:00:01,480 --> 00:00:02,815 Music of Christmas 2 00:00:03,080 --> 00:00:11,080 <i>...</i> 3 00:00:12,800 --> 00:00:15,375 -It's not corruption, it's ... 4 00:00:15,680 --> 00:00:17,415 a plan we keep 5 00:00:17,720 --> 00:00:19,375 so that Bellingham 6 00:00:19,680 --> 00:00:21,735 remains an essential promoter. 7 00:00:22,000 --> 00:00:23,695 -I'm not comfortable. 

    This remains an exploration of the possibilities of different software, and one must be willing to do numerous trials and tests. With the link from @hypothetix, you also have a solution to see if the subtitles are directly in the video stream.


    0