Extract subtitles from movie

505

Solution 1

If your video happens to be in mp4 format then for example MP4Box can be used to demux (extract) the different types of streams (video, audio, subtitles) from it. This works only if subtitles are not actually "burned" on the video image (easy test - can you turn them off in your player? If yes then all should be well).

Solution 2

If you have the command line ffmpeg installed you can use:

ffmpeg -hide_banner -i Movie.mkv -map 0:s:0 subs.srt

Mapping depends on the subtitle track you want. if its the second one then use:

-map 0:s:1

Works with mp4 too.

Solution 3

On the other hand if your subtitles (or anyone else's who happens to read your question from now on for that matter =) are hardcoded i.e., embedded in your video file, which is often the case with AVI files for instance. It's also possible to extract them but you will need to proceed with OCR (Optical Character Recognition). SubRip for instance, there are others. The extraction that way takes much more time, because of the numerous computations involved by OCR (several filters must be applied to extract any "useful information", timecodes, ... then it's simple OCR as each frame may be processed as a picture) and the results depend of your video (are the subtitles outlined ? how readable/legible is the font used to display them ? are they displayed directly on the video or is there some stationary background ? ...)

Solution 4

For mp4 files I use MyMp4BoxGui from http://www.videohelp.com/tools/My-MP4Box-GUI. This is a Windows tool which will separate the different tracks in an MP4 file including subtitle tracks, if present.

  • Launch MyMp4BoxGui.
  • Click Demux tab.
  • Click "Open" button and select mp4 file.
    • Will show video, audio file and "timed text" (subtitles) if present.
  • Click checkbox for timed text item.
  • Click "Demux" button.
    • Will process mp4 file to .srt in mp4 file directory.

Unfortunately, many video files (esp. DVDs) store subtitles as bitimages. Extracting these as text for a .srt file requires an OCR process. Google SubRip for one solution.

If you're dealing with a video which is a movie, you might be better off not trying to extract subtitles from your video files. Instead go to a site like http://subscene.com/ and download a srt file in the desired language for your video. If there is more than one subtitle file, you'll have to try them until you find one that best syncs with your file. Or use a program like Subtitle_edit, to tweak the sub file.

Share:
505

Related videos on Youtube

hashem yousefi
Author by

hashem yousefi

Updated on September 18, 2022

Comments

  • hashem yousefi
    hashem yousefi almost 2 years

    My wsdl file is:

    <wsdl:definitions name="Service1" targetNamespace="http://tempuri.org/"><wsdl:types><xsd:schema targetNamespace="http://tempuri.org/Imports"><xsd:import schemaLocation="http://localhost:14560/?xsd=xsd0" namespace="http://tempuri.org/"/><xsd:import schemaLocation="http://localhost:14560/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/></xsd:schema></wsdl:types><wsdl:message name="IService1_GetData_InputMessage"><wsdl:part name="parameters" element="tns:GetData"/></wsdl:message><wsdl:message name="IService1_GetData_OutputMessage"><wsdl:part name="parameters" element="tns:GetDataResponse"/></wsdl:message><wsdl:message name="IService1_IsPortOpen_InputMessage"><wsdl:part name="parameters" element="tns:IsPortOpen"/></wsdl:message><wsdl:message name="IService1_IsPortOpen_OutputMessage"><wsdl:part name="parameters" element="tns:IsPortOpenResponse"/></wsdl:message><wsdl:message name="IService1_OpenPort_InputMessage"><wsdl:part name="parameters" element="tns:OpenPort"/></wsdl:message><wsdl:message name="IService1_OpenPort_OutputMessage"><wsdl:part name="parameters" element="tns:OpenPortResponse"/></wsdl:message><wsdl:message name="IService1_ClosePort_InputMessage"><wsdl:part name="parameters" element="tns:ClosePort"/></wsdl:message><wsdl:message name="IService1_ClosePort_OutputMessage"><wsdl:part name="parameters" element="tns:ClosePortResponse"/></wsdl:message><wsdl:message name="IService1_OpenSocket_InputMessage"><wsdl:part name="parameters" element="tns:OpenSocket"/></wsdl:message><wsdl:message name="IService1_OpenSocket_OutputMessage"><wsdl:part name="parameters" element="tns:OpenSocketResponse"/></wsdl:message><wsdl:message name="IService1_CloseSocket_InputMessage"><wsdl:part name="parameters" element="tns:CloseSocket"/></wsdl:message><wsdl:message name="IService1_CloseSocket_OutputMessage"><wsdl:part name="parameters" element="tns:CloseSocketResponse"/></wsdl:message><wsdl:message name="IService1_SendToCOM_InputMessage"><wsdl:part name="parameters" element="tns:SendToCOM"/></wsdl:message><wsdl:message name="IService1_SendToCOM_OutputMessage"><wsdl:part name="parameters" element="tns:SendToCOMResponse"/></wsdl:message><wsdl:message name="IService1_SendToSocket_InputMessage"><wsdl:part name="parameters" element="tns:SendToSocket"/></wsdl:message><wsdl:message name="IService1_SendToSocket_OutputMessage"><wsdl:part name="parameters" element="tns:SendToSocketResponse"/></wsdl:message><wsdl:message name="IService1_SetPort_InputMessage"><wsdl:part name="parameters" element="tns:SetPort"/></wsdl:message><wsdl:message name="IService1_SetPort_OutputMessage"><wsdl:part name="parameters" element="tns:SetPortResponse"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieveState_InputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieveState"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieveState_OutputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieveStateResponse"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieve_InputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieve"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieve_OutputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieveResponse"/></wsdl:message><wsdl:message name="IService1_GetXmlError_InputMessage"><wsdl:part name="parameters" element="tns:GetXmlError"/></wsdl:message><wsdl:message name="IService1_GetXmlError_OutputMessage"><wsdl:part name="parameters" element="tns:GetXmlErrorResponse"/></wsdl:message><wsdl:message name="IService1_SetConfirmFlag_InputMessage"><wsdl:part name="parameters" element="tns:SetConfirmFlag"/></wsdl:message><wsdl:message name="IService1_SetConfirmFlag_OutputMessage"><wsdl:part name="parameters" element="tns:SetConfirmFlagResponse"/></wsdl:message><wsdl:message name="IService1_SetPrintFlag_InputMessage"><wsdl:part name="parameters" element="tns:SetPrintFlag"/></wsdl:message><wsdl:message name="IService1_SetPrintFlag_OutputMessage"><wsdl:part name="parameters" element="tns:SetPrintFlagResponse"/></wsdl:message><wsdl:portType name="IService1"><wsdl:operation name="GetData"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetData" message="tns:IService1_GetData_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetDataResponse" message="tns:IService1_GetData_OutputMessage"/></wsdl:operation><wsdl:operation name="IsPortOpen"><wsdl:input wsaw:Action="http://tempuri.org/IService1/IsPortOpen" message="tns:IService1_IsPortOpen_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/IsPortOpenResponse" message="tns:IService1_IsPortOpen_OutputMessage"/></wsdl:operation><wsdl:operation name="OpenPort"><wsdl:input wsaw:Action="http://tempuri.org/IService1/OpenPort" message="tns:IService1_OpenPort_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/OpenPortResponse" message="tns:IService1_OpenPort_OutputMessage"/></wsdl:operation><wsdl:operation name="ClosePort"><wsdl:input wsaw:Action="http://tempuri.org/IService1/ClosePort" message="tns:IService1_ClosePort_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/ClosePortResponse" message="tns:IService1_ClosePort_OutputMessage"/></wsdl:operation><wsdl:operation name="OpenSocket"><wsdl:input wsaw:Action="http://tempuri.org/IService1/OpenSocket" message="tns:IService1_OpenSocket_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/OpenSocketResponse" message="tns:IService1_OpenSocket_OutputMessage"/></wsdl:operation><wsdl:operation name="CloseSocket"><wsdl:input wsaw:Action="http://tempuri.org/IService1/CloseSocket" message="tns:IService1_CloseSocket_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/CloseSocketResponse" message="tns:IService1_CloseSocket_OutputMessage"/></wsdl:operation><wsdl:operation name="SendToCOM"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SendToCOM" message="tns:IService1_SendToCOM_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SendToCOMResponse" message="tns:IService1_SendToCOM_OutputMessage"/></wsdl:operation><wsdl:operation name="SendToSocket"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SendToSocket" message="tns:IService1_SendToSocket_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SendToSocketResponse" message="tns:IService1_SendToSocket_OutputMessage"/></wsdl:operation><wsdl:operation name="SetPort"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SetPort" message="tns:IService1_SetPort_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SetPortResponse" message="tns:IService1_SetPort_OutputMessage"/></wsdl:operation><wsdl:operation name="GetXmlRecieveState"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetXmlRecieveState" message="tns:IService1_GetXmlRecieveState_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetXmlRecieveStateResponse" message="tns:IService1_GetXmlRecieveState_OutputMessage"/></wsdl:operation><wsdl:operation name="GetXmlRecieve"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetXmlRecieve" message="tns:IService1_GetXmlRecieve_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetXmlRecieveResponse" message="tns:IService1_GetXmlRecieve_OutputMessage"/></wsdl:operation><wsdl:operation name="GetXmlError"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetXmlError" message="tns:IService1_GetXmlError_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetXmlErrorResponse" message="tns:IService1_GetXmlError_OutputMessage"/></wsdl:operation><wsdl:operation name="SetConfirmFlag"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SetConfirmFlag" message="tns:IService1_SetConfirmFlag_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SetConfirmFlagResponse" message="tns:IService1_SetConfirmFlag_OutputMessage"/></wsdl:operation><wsdl:operation name="SetPrintFlag"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SetPrintFlag" message="tns:IService1_SetPrintFlag_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SetPrintFlagResponse" message="tns:IService1_SetPrintFlag_OutputMessage"/></wsdl:operation></wsdl:portType><wsdl:service name="Service1"/></wsdl:definitions>

    Error is :

    Service {http://tempuri.org/}Service1 does not contain any usable ports

    And service is WCF service and run at http://localhost:14560


    And when i create stub class with axis2 have null pointer exception error. problem is wsdl parsing.

    • Shekhar
      Shekhar over 12 years
      Don't have much idea about video formats but I guess the only way you can extract the subtitles is if the video is in a container format along with the subtitles. I might be totally off track but you could try googling along these lines.
    • haimg
      haimg over 12 years
      You of course realize that some subtitles are burned-in, e.g. they are part of the picture and there is no way to extract them? Are you sure this is not your case?
    • Open the way
      Open the way over 12 years
      Yes, i know that
    • jmattheis
      jmattheis almost 8 years
      Please format your wsdl file, impossible to read that.
    • hashem yousefi
      hashem yousefi almost 8 years
      but to how i can format my wsdl file? thankss
    • sashwat
      sashwat almost 8 years
      Use any tool that can format an XML file
    • Per Nordquist
      Per Nordquist almost 3 years
      Guess this is for you if you want commandline :-) Superb answer in thread Extracting Subtitles from mkv file
  • Rainer
    Rainer over 12 years
    I have used MP4box via a GUI, both of which are Windows only. A quick look at the command line documentation here shows that possibly -srt command line option should do the trick "-srt TrackID : dumps text track to SRT format." Do find out the TrackID the "-info : prints some file information. File can be an IsoMedia file or any file supported by MP4Box for import." would be my first guess.
  • hashem yousefi
    hashem yousefi almost 8 years
    tnx. Altova xmlspy said the xml is valid but when i import wsdl to soupui it said no interface found at file.
  • Ariel
    Ariel almost 6 years
    You may need to strip XML tags from the output file. At least I had to.