Use the following commands:
i) To get the duration of video stream:
$ mediainfo --Inform="Video;%Duration%" [inputfile]
ii) To get the duration of the media file:
$ mediainfo --Inform="General;%Duration%" [inputfile]
iii) To get the duration of audio stream only:
$ mediainfo --Inform="Audio;%Duration%" [inputfile]
iv) To get values of more than one parameter:
$ mediainfo --Inform="Video;%Width%,%Height%,%BitRate%,%FrameRate%" [inputfile]
Output would be something like this:
1280,720,3000000,30.0