playing a specific interval of a video in mplayer using command line option

assassin picture assassin · Mar 26, 2012 · Viewed 21.8k times · Source

I am using mplayer to play videos... I wanted to know if there are command line options to play a specific interval of a video in mplayer? For example, if I want to play a video file from 56 secs for a duration of 3 secs, then what would the command line options be? I know about the -ss option that will seek to a specific position, but how do I specify the duration that I want to play? Concretely, if I want a command that plays a video file starting at the beginning of the 56th second and plays 3 seconds of the video (i.e., until the beginning of the 59th sec, or equivalently, the end of the 58th sec.), what would the command look like?

I have been looking at the man page, but no success as yet. Maybe I am missing something. I really appreciate your help!

Answer

umläute picture umläute · Apr 24, 2012
man mplayer

reveals:

-ss <time>: Seek to given time position
-endpos <[[hh:]mm:]ss[.ms]|size[b|kb|mb]>: Stop at given time or byte position

so you should be able to do what you want by simple using:

mplayer -ss 56 -endpos 3