5

By default mplayer displays the current location in the video in seconds, which is less than useless. Example:

A:4086.2 V:4086.2 A-V:  0.000 ct:  0.039   0/  0 17%  2%  2.1% 3 0 
  ^--------^----- This is the current location in seconds.

Well, so what? Mplayer has terrible defaults. What else is new? But mplayer is highly configurable to the last detail, so there has got to be a way to change that line and put whatever information you want there. I scoured the manpage though, and I can't find an option that will do that. Ideal behaviour:

A:1:08:06.2 V:1:08:06.2 A-V:  0.000 ct:  0.039   0/  0 17%  2%  2.1% 3 0 
  ^-----------^----- This is the current location in hours:minutes:seconds.

Has anybody figured out a way to do this?

2 Answers2

4

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: enter image description here

[UPDATE]

Keep in mind that there are 4 states if you continuously pressing o:

  1. current time
  2. current time/total time (acts like -osdlevel 3)
  3. OSD enabled (no time show yet, but press P is allow)
  4. 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.

林果皞
  • 455
0

My own solution ended up being a switch to the mplayer fork called mpv, which handles the realtime terminal time display much more sensibly by default. It seems serious mplayer development has completely stagnated, thus mpv is now better in every way imaginable. It has become my primary media player.