Let's look at the source code of mplayer, mplayer.c:
... // Audio time if (mpctx->sh_audio) { saddf(line, &pos, width, "A:%6.1f ", a_pos); if (!sh_video) { float len = demuxer_get_time_length(mpctx->demuxer); saddf(line, &pos, width, "("); sadd_hhmmssf(line, &pos, width, a_pos); saddf(line, &pos, width, ") of %.1f (", len); sadd_hhmmssf(line, &pos, width, len); saddf(line, &pos, width, ") "); } } // Video time if (sh_video) saddf(line, &pos, width, "V:%6.1f ", sh_video->pts); // A-V sync if (mpctx->sh_audio && sh_video) saddf(line, &pos, width, "A-V:%7.3f ct:%7.3f ", a_v, corr); ...
As you can see, only if (mpctx->sh_audio) AND if (!sh_video)
whereas audio-only will call sadd_hhmmssf()
which will print hh:mm:ss format to stdout. But mpctx->sh_audio && sh_video
whereas audio+video wouldn't.
So if you invoke the mplayer
command with -novideo
option, it will included hh:mm:ss format:
[xiaobai@xiaobai example]$ mplayer -novideo example.mkv MPlayer SVN-r37391-5.1.1 (C) 2000-2015 MPlayer Team ... Video: no video Position: 58 % A: 90.5 (01:30.4) of 145.4 (02:25.4) 0.0%
[MPlayer-dev-eng] [PATCH] total time for audio-only files explained the origin of audio-only:
the attached patch makes MPlayer display the total time in the status line for audio-only files. I think this is useful for audio-only since
1) the status line is still quite small
2) you can't just activate the OSD to find the total time
From this explanation, we know OSD can be activated to achieve the same goal. So now just read man mplayer
and search for OSD keyword:
... o Toggle OSD states: none / seek / seek + timer / seek + timer + total time. ... P Show progression bar, elapsed time and total duration on the OSD. ... -osdlevel <0-3> (MPlayer only) Specifies which mode the OSD should start in. 0 subtitles only 1 volume + seek (default) 2 volume + seek + timer + percentage 3 volume + seek + timer + percentage + total time ...
This means that press P will toggle the current time/total time on the fly, or invoke mplayer -osdlevel 3 file
to show the current time/total time consistently:
[UPDATE]
Keep in mind that there are 4 states if you continuously pressing o:
- current time
- current time/total time (acts like
-osdlevel 3
) - OSD enabled (no time show yet, but press P is allow)
- OSD disabled (press P will do nothing)
For unknown reason,-novideo
still accept o key, and only introduce 2 states, i.e., enabled OSD and disable OSD. A bug occur if you press o enable OSD and then press P and it will show 00:00:00/total time.