Opened 16 months ago

Last modified 8 months ago

#2372 open enhancement

UI Tweak: Show filename closer to the bottom of stdout

Reported by: dennisn Owned by: beastd
Priority: low Component: core
Version: unspecified Severity: trivial
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

Not sure if others would find this useful, but currently the filename that's being played is only shown/printf'd near the top of mplayer's stdout, so often I can't tell what's playing in my default sized xterm (80cols, 24rows) without scrolling up or resizing the window.

This patch would also need to include all the other help/help_mp-XX.h language files.

--- a/help/help_mp-en.h 2018-06-10 12:20:59.000000000 -0400
+++ b/help/help_mp-en.h 2021-02-05 13:14:50.297237228 -0500
@@ -89,7 +89,7 @@

#define MSGTR_CantFindVideoCodec "Cannot find codec matching selected -vo and video format 0x%X.\n"
#define MSGTR_CannotInitVO "FATAL: Cannot initialize video driver.\n"
#define MSGTR_CannotInitAO "Could not open/initialize audio device -> no sound.\n"

-#define MSGTR_StartPlaying "Starting playback...\n"
+#define MSGTR_StartPlaying "Starting playback %s...\n"

#define MSGTR_SystemTooSlow "\n\n"\
" \n"\

--- a/mplayer.c 2018-06-10 11:53:58.000000000 -0400
+++ b/mplayer.c 2021-02-05 13:14:41.230430345 -0500
@@ -3722,7 +3722,7 @@

else if (mpctx->loop_times == 1)

mpctx->loop_times = -1;

  • mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_StartPlaying);

+ mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_StartPlaying, filename_recode(filename));

total_time_usage_start = GetTimer();
audio_time_usage = 0;

Change History (5)

comment:1 by beastd, 11 months ago

Status: newopen

Thanks for the enhancement request! (And sorry for my late reply.)

I was thinking about this back and forth for some time now.

In the end I would say going with something similar, to what you proposed is best.
I wouldn't modify MSGTR_StartPlaying though and instead just add a new message.

comment:2 by beastd, 11 months ago

Though it might be possible to just silence a few messages.

Could you share a typical mplayer output where the initial "Playing <x>." message, is not anymore visible for you on your terminal.

comment:3 by dennisn, 11 months ago

Here's a typical last 24 lines of output in my xterm. This is from my patched version of mplayer, where MSGTR_StartPlaying = "Starting playback %s...\n\n". I also changed MSGTR_Paused = "ZZ" and got rid of the newline when MSGSTR_Paused was printed, to avoid having the filename disappear up into the scrollback if I paused a video often.

##################################################
libavcodec version 55 (external)
Mismatching header version 54
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:

major_brand: isom
minor_version: 512
compatible_brands: isomiso2avc1mp41
encoder: Lavf55

Load subtitles in ./
==========================================================================
Trying to force audio codec driver family libmad...
Trying to force audio codec driver family ffmpeg...
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, floatle, 64.0 kbit/4.54% (ratio: 8002->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
[AO_ALSA] Format floatle is not supported by hardware, trying default.
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback physicsfun.mp4..

Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 640x640 => 640x640 Planar YV12
ZZ 0.9 V: 0.9 A-V: 0.003 ct: 0.002 0/ 0 26% 13% 2.0% 0 0 88%
##################################################

Here's the output that was cutoff, if I scroll up:

##################################################
mplayer physicsfun.mp4
MPlayer (C) 2000-2019 MPlayer Team

Playing physicsfun.mp4.
Cache fill: 0.00% (0 bytes)

libavformat version 55 (external)
Mismatching header version 54
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7e5ae3679e90]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO: [H264] 640x640 24bpp 30.000 fps 582.6 kbps (71.1 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
##################################################

comment:4 by beastd, 11 months ago

Thanks.

There is one line that shouldn't be there

Mismatching header version 54

Otherwise lots of lines that could be silenced, though we should be careful not to over do it and cause trouble for frontends or other programs that use mplayer.

I think the goal to stay under 24 rows could be reached by implementing an option to reduce metadata output. AFAIK currently we just dump all metadata the demuxer made available.

comment:5 by beastd, 8 months ago

Sorry, I'm didn't have much time for MPlayer in the last months :(

First I want to explain why I shy away a bit from applying something like your initial solution in the description.

Your problem is caused by MPlayer being a bit noisy and arbitrary and overly verbose in it's output. Your solution is clever and effective in solving your use case, which is being able to see what you are playing right now.

Looking at it from a distance though, it adds to the underlying root cause of mplayer printing to much stuff by default. I know your patch doesn't add much because it re-uses the already existing MSGTR_StartPlaying message, but as I said before I wouldn't really want to do that.

So in the end I would love to solve your problem and also make mplayer better in total at the same time.

As I wrote in my last comment I think the key to achieve that would be to not dump all metadata.

This is some stupid and lazy proof of concept patch you could play with if you like:

--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -1467,8 +1467,10 @@ int demux_info_print(demuxer_t *demuxer)
 
     mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_ClipInfo);
     for (n = 0; info[2 * n] != NULL; n++) {
+        if (strstr("Title,Artist", info[2 * n])) {
         mp_msg(MSGT_DEMUX, MSGL_INFO, " %s: %s\n", info[2 * n],
                info[2 * n + 1]);
+        }
         mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CLIP_INFO_NAME%d=%s\n", n,
                info[2 * n]);
         mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CLIP_INFO_VALUE%d=%s\n", n,

The remaining difficulty is to provide a good way for users to white-list the infos they want to be printed and working out the details.

Note: See TracTickets for help on using tickets.