Compress video and detect video length

Hey there I hope you get back to this…

I need to upload a video file to my server. Also I need to compress it. Uploading is easy enough. Also I can limit to length and resolution with capture. But I need a way to do it on local files. I need to compress files before uploading when user choose video from gallery.Also I need to determinate the length of the video file too.

Any advice?

Thanks in advance

@Dahico did you solved it?