[FFmpeg-user] subtitles come to early in a transport stream (ts) file

Laine llee040 at sbcglobal.net
Sun Oct 8 01:32:30 EEST 2023


> On Oct 7, 2023, at 8:09 AM, Karl Heinz Lopin <karlheinz at lopin.de> wrote:
> 
> I have recorded a TV-movie with my SAT-recorder on harddisk. The movie is in french and has subtitles in several languages. I cutted the ts-file and removed all subtitles except german wit tsdoctor. Sometimes later I noticed that the subtitles come about four seconds too early. Unfortunately I had deleted the original file until then.
> 
> ffprobe shows the following output:
> 
> ```none
> ffprobe version 6.0-essentials_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
>  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
> ...
> Input #0, mpegts, from 'inputfile.ts':
>  Duration: 01:35:06.88, start: 54851.766678, bitrate: 3407 kb/s
>  Program 6915
>  Stream #0:0[0x267]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn
>    Side data:
>      cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 1835008 vbv_delay: N/A
>  Stream #0:1[0x27b](fra): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
>  Stream #0:2[0x3a9](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
> ```
> 
> I can imagine that this problem could be solved with ffmpeg, but don't know how and I didn't found anything that would help me.


I would consider extracting the subtitles, removing them from the video and audio movie file, then using a subtitle editor to properly align them and remux. Unfortunately, I only work with .srt, but here is what I use to extract the subtitle stream:

ffmpeg-i inputfile -map 0:s:0 -f srt subtitle.srt

L. Lee




More information about the ffmpeg-user mailing list