Extract / Rip subtitles from mp4 files

Forum Forums New users New Users and General Questions Extract / Rip subtitles from mp4 files

  • This topic has 6 replies, 3 voices, and was last updated Nov 22-11:10 am by andfree.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #45509
    Member
    andfree

      Hi, everybody. Is there any way to extract / rip the subtitles from mp4 files with embodied subtitles? I want to read the subs, but I don’t want to watch the video. Thanks.

      #45510
      Member
      Xecure
        Helpful
        Up
        0
        ::

        A web search of extract subtitles mp4 linux found this answer:

        https://superuser.com/questions/393762/how-to-extract-subtitles-from-mp4-and-mkv-movies/1185673#1185673

        Here is a solution for virtually any file format that is supported by ffmpeg (even remote files are supported):

        ffmpeg -i video.mp4 subtitle.srt

        Here video.mp4 is source local or remote video file name, and subtitle.srt is output subtitle file name. It is important to specify file extension for output, since ffmpeg detects what exactly you want to extract by it. That is, you can specify .mp3 file extension in order to extract mp3 audio from video file, or just set another video container in order to convert between formats.

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

        #45511
        Forum Admin
        SamK
          Helpful
          Up
          0
          ::

          I want to read the subs, but I don’t want to watch the video.

          There are numerous examples and sources of information on the web.
          A cursory search turned up the following (amongst many others):

          FFmpeg Wiki
          https://trac.ffmpeg.org/wiki/ExtractSubtitles

          superuser accepted example
          https://superuser.com/questions/1459573/unable-to-extract-subtitles-into-txt-file-with-ffmpeg

          Note
          Xecure replied while I was posting. Pretty much the same idea but these give greater detail and more background info to help you troubleshoot.

          #45512
          Member
          andfree
            Helpful
            Up
            0
            ::

            Thanks for your reply.

            $ ffmpeg -i video.mp4 subtitle.srt
            ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
              built with gcc 8 (Debian 8.3.0-6)
              configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --arch=i386 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --ignore-tests='hapenc-hap-none,hapenc-hapa-none,hapenc-hapq-none' --enable-shared
              WARNING: library configuration mismatch
              avcodec     configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --arch=i386 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --ignore-tests='hapenc-hap-none,hapenc-hapa-none,hapenc-hapq-none' --enable-shared --enable-version3 --disable-doc --disable-programs --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
              libavutil      56. 22.100 / 56. 22.100
              libavcodec     58. 35.100 / 58. 35.100
              libavformat    58. 20.100 / 58. 20.100
              libavdevice    58.  5.100 / 58.  5.100
              libavfilter     7. 40.101 /  7. 40.101
              libavresample   4.  0.  0 /  4.  0.  0
              libswscale      5.  3.100 /  5.  3.100
              libswresample   3.  3.100 /  3.  3.100
              libpostproc    55.  3.100 / 55.  3.100
            Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
              Metadata:
                major_brand     : mp42
                minor_version   : 0
                compatible_brands: isommp42
                creation_time   : 2020-11-19T17:17:43.000000Z
              Duration: 00:22:29.68, start: 0.000000, bitrate: 353 kb/s
                Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360 [SAR 1:1 DAR 16:9], 254 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
                Metadata:
                  creation_time   : 2020-11-19T17:17:43.000000Z
                  handler_name    : ISO Media file produced by Google Inc. Created on: 11/19/2020.
                Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
                Metadata:
                  creation_time   : 2020-11-19T17:17:43.000000Z
                  handler_name    : ISO Media file produced by Google Inc. Created on: 11/19/2020.
            Output #0, srt, to 'subtitle.srt':
            Output file #0 does not contain any stream
            • This reply was modified 2 years, 5 months ago by andfree.
            #45514
            Member
            andfree
              Helpful
              Up
              0
              ::

              Xecure replied while I was posting.

              And SamK replied while I was posting! Thanks for your reply, too.

              A web search of extract subtitles mp4 linux found this answer (…)

              There are numerous examples and sources of information on the web.
              A cursory search turned up the following (amongst many others):
              (…)

              Unfortunately, this surplus of information was the reason I posted my question, hoping that someone might knew something reliable.

              #45515
              Forum Admin
              SamK
                Helpful
                Up
                0
                ::

                …hoping that someone might knew something reliable.

                FFmpeg is an excellent, reliable tool. Like all software it can only do what it is directed to do.

                As you point out there is plenty of information available detailing how to do what you ask. That alone indicates it is probable there is no universal answer i.e. one that works for every different case. You have more work to do to construct the command line for your particular case. Unless of course someone knows differently…

                #45519
                Member
                andfree
                  Helpful
                  Up
                  0
                  ::

                  OK, I’ll try harder with FFmpeg.

                  For the moment, I tried to replace “video.mp4” with “/home/dragon/video.mp4”:
                  $ ffmpeg -i /home/dragon/video.mp4
                  (…)
                  At least one output file must be specified

                  (Edit: Of course, I forgot the last part of the command. Using “/home/dragon/video.mp4” instead of “video.mp4” doesn’t seem to make any difference.)

                  • This reply was modified 2 years, 5 months ago by andfree.
                  • This reply was modified 2 years, 5 months ago by andfree.
                  • This reply was modified 2 years, 5 months ago by andfree.
                Viewing 7 posts - 1 through 7 (of 7 total)
                • You must be logged in to reply to this topic.