[FFmpeg-user] attempting to extract srt from mpg

Leo Butler leo.butler81 at googlemail.com
Wed Oct 20 03:41:18 EEST 2021


John Finlay via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

> I use CCExtractor at https://ccextractor.org/ for this purpose.
>
> John
>
> On 10/19/21 12:36 PM, Shupert, Jim via ffmpeg-user wrote:
>> Friends
>>
>> I have a  mpg that I wish to extract the captions as a file.srt.
>>
>> I have tried a few things I found on the web.
>> There does not seem to be a decreet stream for the captions , like a mkv might have.
>> But I do see captions when I play the file in mpv
>>
>> Below I have made  4 attempts



Here is an example with ffmpeg:

$ /usr/bin/ffmpeg -f lavfi -i \
'movie=4131_20150814180000.mpg[out0+subcc]' -t 00:01:00 -map s \
/tmp/4131_20150814180000.mpg.srt

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg
developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --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-libja\
ck --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 --enabl\
e-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-opencl
--enable-opengl --enable-\
sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883
--enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264
--enable-shared
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100
[mpegts @ 0x558f9643a9c0] PES packet size mismatch
Input #0, lavfi, from 'movie=4131_20150814180000.mpg[out0+subcc]':
Duration: N/A, start: 16071.108744, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Stream #0:1: Subtitle: eia_608
Output #0, srt, to '/tmp/4131_20150814180000.mpg.srt':
Metadata:
encoder         : Lavf58.29.100
Stream #0:0: Subtitle: subrip (srt)
Metadata:
encoder         : Lavc58.54.100 srt
Stream mapping:
Stream #0:1 -> #0:0 (eia_608 (cc_dec) -> subrip (srt))
Press [q] to stop, [?] for help
size=       2kB time=00:00:58.19 bitrate=   0.2kbits/s speed=6.59x
video:0kB audio:0kB subtitle:1kB other streams:0kB global headers:0kB muxing overhead: 45.037453%


mythtv-user at mythtv-server:/var/lib/mythtv/recordings$ cat /tmp/4131_20150814180000.mpg.srt
1
00:00:00,000 --> 00:00:32,900
<font face="Monospace">{\an7}\h\h\h\h- HI. I’M MURRAY FROM
"SESAME STREET," AND I’M LOOKING</font>

2
00:00:34,301 --> 00:00:35,803
<font face="Monospace">{\an7}FOR THE WORD ON THE STREET.</font>

3
00:00:35,869 --> 00:00:37,204
<font face="Monospace">{\an7}WHAT’S THE WORD ON THE STREET?</font>

4
00:00:37,271 --> 00:00:38,472
<font face="Monospace">{\an7}- PATIENCE.</font>

5
00:00:38,539 --> 00:00:40,274
<font face="Monospace">{\an7}- WHAT DOES THE
WORD PATIENCE MEAN?</font>

6
00:00:40,340 --> 00:00:42,976
<font face="Monospace">{\an7}- IT MEANS, LIKE, YOU CAN WAIT
FOR SOMETHING IN A CLAM WAY.</font>


etc.

Leo


More information about the ffmpeg-user mailing list