I want to convert MKV audio from DTS to MP3 and split the file at the same time. The problem is: I need an external .srt but when I split it, the second file is desynced from video.


ffmpeg -ss 01:00:00 -i videoIN.mkv -ss 01:00:00 -i videoIN.srt -map 0 \
-vcodec copy -acodec libmp3lame videoOUT.mkv -map 1 -c copy videoOUT.srt

The result is perfectly playable but the subs are slightly desynced, probably because the video is cut at the nearest keyframe but subs are cut exactly.

Using accurate seek (-ss before output file) produce a synced sub but the video is unplayable by my stand-alone media player, probably because it starts without a keyframe.

How can i cut the .srt at the nearest keyframe with ffmpeg?

ffmpeg version 2.5.3-tessus Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan 10 2015 01:19:50 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --cc=/usr/bin/clang --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libsoxr --enable-libwavpack --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --disable-indev=x11grab_xcb --enable-runtime-cpudetect
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'

You can sync your srt file with Subtitle Edit. That's a free software.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.