Based on Apple sample code, but modified in order to parse .srt subtitles, set language attribute and be used inside your project instead of being a command line tool.

JAQSubtitlesTextReader parses the .srt file:

JAQSubtitleIntegrator gets the input, the subtitle filepath and the language and writes on the output the input file with the subtitle integrated: