When you paste a video link into my downloader, ramrom.io, and it resolves, you get a little dropdown of quality options. It looks like the least interesting part of the whole site. It is actually the part I argued with myself about the most, because that dropdown is where a tool either tells the truth or quietly misleads you.
What "best" actually means
The provider APIs I use return a list of formats, and each one is a bundle of facts: a height in pixels, a file size in bytes if the provider knows it, whether there is an audio track, and whether the stream is muxed (video and sound in one file) or adaptive (video only). A 1080p video-only stream is useless on its own if you wanted a file you can just play, so sorting by height alone would put a silent file at the top. That is the first trap. My rule now is: muxed files with sound come first, sorted by resolution, then video-only streams, then audio-only options. The default selection is the first item in that list — the best playable file, not the biggest one.
Labels that say what the file really is
Every option gets a label built from what the provider actually told me, not from what I hope is true. A label looks like "720p · MP4 · 24 MB" or "Audio only · M4A". If the provider did not give me a file size, the label says nothing about size. I never guess a size, and I never write "HD" next to a 360p file, because a label that exaggerates once makes every other label untrustworthy.
There is one label I am particularly careful with. YouTube's adaptive streams mean the highest video-with-sound file most APIs can hand over is usually 360p. If I called that "HD", nobody would complain in the moment, but they would notice when they played it. So the label says 360p, plainly. Honest labelling costs me nothing and saves the visitor a disappointment.
When there is no audio track
Sometimes the provider returns a format with no audio track at all and no muxed alternative. Earlier versions of the site would still offer it as if it were a normal download. Now, if the only video option has no sound, the dropdown says so: "1080p · video only, no sound". A visitor can still choose it if that is what they want, but nobody downloads a silent file by accident any more. The same goes for audio: if the provider offers an audio track, it is labelled M4A or Opus, because YouTube does not have MP3 audio to give, and calling it MP3 would be a lie with a familiar name.
The small code behind it
The sorting itself is a few lines of plain PHP in resolve.php, running after the provider response is normalised. Each format becomes a small array with height, has_audio, muxed, size, and label, and then usort puts muxed-with-sound first by height, then the rest. The labelling function builds the string from those same fields, so the label can never describe a file the sorter did not see. Keeping the sort and the label fed by the same data is the whole trick: the moment they drift apart, the dropdown starts lying.
Why I bother
A downloader is a trust exercise. The visitor pastes a link to something they care about and presses a button, and they have no way to check what they are getting until the file lands on their phone. The quality dropdown is the one place where I can show my working before that happens. Sorting best first, labelling honestly, and saying "no sound" when there is no sound does not make the site faster or prettier. It makes it the kind of tool I would trust with my own links, and that is the only standard that matters.



