mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Display long URLs in a user-friendly and informative way

Open forthrin opened this issue 3 years ago • 23 comments

Current behavior (mpv 0.35 Homebrew bottle)

When running mpv with very long URLs (~1000 characters), eg.

$ mpv VIDEO --audio-file=AUDIO

  1. The OSD media title (lower left corner) seems to display the center of VIDEO, usually a smattering of URL random parameters, giving no valuable information to the user.

< >   &yoi=5831043&mum=55166747023&wax=23&pew=65300&alf=420157670777596&yes=4558266472944516&   Cache: 42s

  1. The terminal output gets similarly flooded when AUDIO is a long URL:
(+) Video --vid=1 (*) (h264 1280x720 59.940fps)
(+) Audio --aid=1 (*) 'video?&awa=68258933661986&why=68426832960&zat=6
72582922041153&tck=50&jot=588899545351572&ber=91596529005&sla=55084828
65866614&wey=556609493395&car=5194415113869775259&rog=7290082781833467
616&nay=8721&tee=4806186815&vat=6201239513069251&soh=21339533256602356
54&mho=245809568103&mud=324292414007468734&eon=836933562&cat=3&gyp=148
386989&pur=56319700&gip=4716300145289650822&ubi=864472250798&eel=687&b
ub=53111788629099&wis=63591362568&lis=918336621218658&gig=177395&dey=8
350714&mal=325153491622480&amy=8455369206191236

Expected behavior of the wanted feature

Suggest to do like macOS Finder does for long filenames, ie. show START + DOTS + END. The rationale for this version is in case the end of the URL is a filename/extension, which is valuable information.

  1. < >   https://www.example.com/video/play?id=1234567& ... autoplay=false&ext=mkv   Cache: 42s
  2. (+) Audio --aid=1 (*) 'https://www.example.com/audio/play?id=1234567& ... format=aac

Alternative behavior of the wanted feature

Alternatively, just show START + DOTS for as long as there is room on the single line available. The rationale for this version is the idea/hope that the most important information comes first in the URL. Plus it might be easier to program.

  1. < >   https://www.example.com/video/play?id=1234567&autoplay=false&subtitles=true& ...   Cache: 42s
  2. (+) Audio --aid=1 (*) 'https://www.example.com/audio/play?id=1234567&format=aac ...

Log file

N/A

forthrin avatar Dec 07 '22 13:12 forthrin

Just noticed a related issue. The terminal was flooded with an extremely long string:

Could not read init fragment.
edl://!mp4_dash,init=%756%https://... (~380000 bytes long URL) ' has unknown duration.

The code should crop the string to a sane length before printing:

demux/demux_edl.c
489:                    MP_WARN(root, "EDL: source file '%s' has unknown duration.\n",

forthrin avatar Dec 17 '22 18:12 forthrin

Bömp

forthrin avatar Oct 17 '25 13:10 forthrin

@guidocella: Good call keeping the full URL! Open a separate issue on URL length? There obviously should be some upper limit when they can be 300k chars long.

forthrin avatar Nov 01 '25 18:11 forthrin

It is not feasible to add dots where text is cropped with ASS. We don't know the text's length before rendering it.

guidocella avatar Nov 01 '25 18:11 guidocella

Are you talking about rendering subtitles over the video...? I'm referring to abnormally long URLs being printed to the terminal.

forthrin avatar Nov 01 '25 19:11 forthrin

Ok I was thinking of stats and the OSD. Terminal output can just be hooked to the existing ${term-clip-cc} property.

guidocella avatar Nov 01 '25 19:11 guidocella

Updated so that #16932 no longer closes this issue.

guidocella avatar Nov 01 '25 19:11 guidocella

Ah. The confusing thing is that two related issues with long URLs were reported in the same issue. I'll try to run the latest build and see how things are now.

forthrin avatar Nov 01 '25 20:11 forthrin