1

I want to use mplayer command line to play music files in the terminal and keep the output messages quiet only except for audio timestamp. Only keep the last line A: 133.5 (02:13.4) of 347.1 (05:47.0) 0. in the below example (of course 02:13.4/05:47.0 format would be better). Is there any way to get that? Thanks.

> mplayer -novideo "Tokimeki Records,ひかり/Midnight Pretenders (feat. ひかり)/Tokimeki Records,ひかり - Midnight Pretenders (feat. ひかり).flac"
MPlayer 1.5-14.0.0 (C) 2000-2022 MPlayer Team
Can't init Apple Remote.

Playing Tokimeki Records,ひかり/Midnight Pretenders (feat. ひかり)/Tokimeki Records,ひかり - Midnight Pretenders (feat. ひかり).flac. libavformat version 59.17.102 (internal) libavformat file format detected. [lavf] stream 0: audio (flac), -aid 0 [lavf] stream 1: video (mjpeg), -vid 0 Clip info: ALBUM: Midnight Pretenders (feat. ひかり) ARTIST: Tokimeki Records/ひかり COMMENT: Create by xxxx copyright protected dump tool. author 5L TITLE: Midnight Pretenders (feat. ひかり) Load subtitles in Tokimeki Records,ひかり/Midnight Pretenders (feat. ひかり)/ ========================================================================== Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders libavcodec version 59.21.100 (internal) AUDIO: 48000 Hz, 2 ch, s16le, 0.0 kbit/0.00% (ratio: 0->192000) Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio) ========================================================================== AO: [coreaudio] 48000Hz 2ch s16le (2 bytes per sample) Video: no video Starting playback... A: 133.5 (02:13.4) of 347.1 (05:47.0) 0.

gpanda
  • 113

1 Answers1

1

You could do that by disabling verbosity for all modules and enabling it only for STATUSLINE

mplayer -novideo -msglevel all=0:statusline=5 infile.mp4

The -msglevel option is explained in the manual:

-msglevel <all=<level>:<module>=<level>:...>
Control verbosity directly for each module. The 'all' module changes the verbosity of all the modules not explicitly specified on the command line. See -msglevel help for a list of all modules.
NOTE: Some messages are printed before the command line is parsed and are therefore not affected by -msglevel. To control these messages you have to use the MPLAYER_VERBOSE environment variable.
Available levels:
-1 complete silence
0 fatal messages only
1 error messages
2 warning messages
3 short hints
4 informational messages
5 status messages (default)
6 verbose messages
7 debug level 2
8 debug level 3
9 debug level 4

Or, you could use mpv which has similar switches and prints elapsed/total times just like you want:

mpv --no-video --msg-level=all=no,statusline=status infile.mp4
don_crissti
  • 82,805