Subtitles Out of Sync after Transcoding

I transcode all of my downloads to a lower bitrate and from MKV to MP4. I’ve got things setup so that the subtitles are extracted from the MKV and saved as external SRT files.

However, I’ve noticed that all of the SRTs are out of sync with the MP4, whereas the sync is fine in the original MKV files.

I’d use the Subtitle Offset feature to correct this, but, oddly, the timing varies from file to file, though the text always appears after the audio. It’s +2 seconds in some, +3 or +4 in others.

I’m using the 2.5.4 Beta and my profile looks like this:

[MP4 Transcode All]
Description=Medium MP4 (H.264/AAC) conversion.
order=handbrake
handbrake-general=–loose-anamorphic --verbose=2 -f mp4 -O
handbrake-video=–start-at duration:0 -e x264 -b 950 -x cabac=0:ref=2:bframes=0:weightp=0:8x8dct=0:trellis=0:subq=6:me=hex:b-adapt=0:threads=auto
handbrake-audio=-E faac -R auto -B 64 -D 0 -a 1,2,3,4,5
handbrake-audioac3=-E faac -R auto -B 64 -D 0 -a 1,2,3,4,5
handbrake-ext=.mp4
handbrake-audiodelay=skip
PreConversionCommercialRemover=true
AutoDeinterlace=false
CustomCommandPath=C:\Windows\System32\cmd.exe
CustomCommandParameters="/c ““C:\Program Files\MCEBuddy2x\mp4box\mp4box.exe” “%convertedfile%” -lang 1=eng -lang 2=eng”
CustomCommandHangPeriod=100
CustomCommandCritical=true
CustomCommandUISession=false
CustomCommandShowWindow=false

Looking at this problem a bit deeper, I’ve noticed that the runtime of the files are different. The transcoded MP4s are anywhere from two to seven seconds shorter than the original MKVs and the truncation is happening at the start of the conversion.

When I manually transcode the files in Xmedia-Recode, the durations are the same and the subs are in sync.

This is a common issue with some recordings depending on the formation of the GOP structure while it was recorded. This topic will explain it better along with the solution:

Thanks! I ended up toying around with stuff and figured out that checking “Skip Remuxing Files” brought things back in order.

As an aside, I wasn’t removing commercials or editing the video in any other way. The transcodes are straight conversions – MKV > MP4, x264 > x264, AC3 > AAC.

And, the subtitle shift varies from file to file, so it’s impossible to set a standard offset.

1 Like

I know this has been sorted but I had a similar problem which was solved by using ffmpeg rather than handbrake.

1 Like