i already know that i should use AVFoundationto get the CGContextRef from .mp4 file;
and use like :
CATextLayer *subtitle1Text = [[CATextLayer alloc] init];
[subtitle1Text setFont:@"Helvetica-Bold"];
[subtitle1Text setFontSize:36];
[subtitle1Text setFrame:CGRectMake(0, 0, size.width, 400)];
[subtitle1Text setString:[self.subtitles objectAtIndex:idx]];
[subtitle1Text setAlignmentMode:kCAAlignmentCenter];
[subtitle1Text setForegroundColor:[[UIColor whiteColor] CGColor]];
[subtitle1Text drawInContext:context];
to make subtitles;
now the question is how can i get CGContextRef from .mp4 file?
i mean i've got the url of .mp4 file, but how can i add CATextLayer in the mp4?
You have to use AVFoundation framework in order to add text on video you can have a look into the following link for more detail. You have add the text layer on video layer and then have to export it.
Have a look into bellow sample code there is a way to add watermark you can create subtitles by changing few properties like start time and end time.