>>301090685
The best way is to host a HTTP server somewhere, then hardcode subs onto an h264 mp4 file and make it available there. 
Then use the direct HTTP link in the player. 
VPS works well for this.
As for encoding; handbrake work and is easy but if you want CLI:
ffmpeg -i '/tmp/test.mkv' -acodec copy -filter_complex subtitles="/tmp/test.mkv":si=0 -y -f mp4 -movflags +faststart -vcodec libx264 -profile:v main "/tmp/test.mp4"

Takes the file test.mkv, uses the subs from test.mkv (the first set of subs (si=0), choose si 0, 1, 2... for the 1st, 2nd, 3rd sub track in the mkv.) and outputs it to test.mp4