this post was submitted on 06 Oct 2026
1034 points (98.8% liked)

linuxmemes

33004 readers
1522 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry of any kind will not be tolerated. This is an LGBTQ+-friendly community -- if that is a problem for you, you should leave.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don't come looking for advice, this is not the right community.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves / tolerates / hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. πŸ‡¬πŸ‡§ Language/язык/Sprache
  • This is primarily an English-speaking community. πŸ‡¬πŸ‡§πŸ‡¦πŸ‡ΊπŸ‡ΊπŸ‡Έ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • Β 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 3 years ago
    MODERATORS
    1034
    Linux tips (media.piefed.zip)
    submitted 16 hours ago* (last edited 16 hours ago) by inari@piefed.zip to c/linuxmemes@lemmy.world
     
    you are viewing a single comment's thread
    view the rest of the comments
    [–] diaphragmwp@discuss.tchncs.de 5 points 8 hours ago* (last edited 8 hours ago) (1 children)

    I can help.

    First, install it. This depends on your distribution and package manager. apt, pacman, you name it, just search for "yt-dlp". Epic tech tip: do not install from flatpak or snap, because if you ever run into an issue the maintainers will hate you for it, and because it will be annoying (slightly different) to use in the former case. Important to note that sometimes your distribution will put some technically-optional component (that you probably still want) into a different package like yt-dlp-ejs. Regardless, you will probably want to install ffmpeg, curl and curl-cffi (sometimes called curl-impersonate) for all of the features.

    If your distribution allows using pip (most don't), you may do python3 -m pip install -U "yt-dlp[default]" to install it (do the same to upgrade later).

    Navigate your shell to the directory you want to put your video in (some file managers have "Open in {some terminal emulator}" in the right click menu, which does as it sounds).

    Now, yt-dlp --embed-metadata -- video_id some_other_video_id (--embed-metadata is optional, it's so that someone who downloads the video will be able to read the description). Note the --, it tells yt-dlp that your options have ended and IDs have started, to prevent it from thinking an ID is an option. In extremely rare cases, the video ID may have an exclamation mark or an ampersand, which will fuck everything up. In that case, put \ in front of the symbol, right in the ID (like "dwQ&smshIt" turns into "dwQ\&smshIt"). If you are downloading from a service other than YouTube, paste your URL (with the same precautions) instead.

    Welp, this is the basic usage. You can stop reading if it already did what you want.

    This may sometimes save to an MKV file when it's impossible for it to be WEBM, which is good for video editors. Most web browsers don't understand it, however. So, if you want to share it online, you may want to instead do: yt-dlp --remux-video mp4 -- video_id to forcefully shove it up a .mp4 file. If you have only noticed later, you can also do: ffmpeg -i "video.mkv" -c copy -movflags +faststart "video.mp4" (and delete the old one).

    This picks and downloads the highest quality format it detects. You can see the available formats for a given upload with yt-dlp -F -- video_id. It is a table with format numbers, video resolutions (and if HDR is present or not), audio frequencies and so on. Note that most only have video OR audio, but some have both. For YouTube, the objectively best audio is 251, and is present in basically all videos (and music!) since 2014. Available video depends; apart from resolution there's also the video codec. My ranking from best quality per filesize to least resource heavy to decode (for old phone users...): AV1, VP9, VP8, H264.

    Now, you can specify the formats you want to put into your video like: yt-dlp -f "251+699" -- video_id. That's it. If you want to download from YouTube Music without the pointless video tracks, you may also do: yt-dlp -f 251 --embed-metadata --remux-video opus -- your-amazing-id-here.

    Downloading age and/or account gated content, and content from some picky sites, is a little more tricky. Login to the service from Firefox, default profile and no containers (it's possible to use other profiles and containers but the syntax is annoying and you will have to dig around directories). Now, do yt-dlp --embed-metadata --cookies-from-browser firefox -- id. This will download using your account. Although this may also make the site refuse some formats and give you a piece of shit video. If it's not doing anything still, try adding --impersonate firefox. If you are really desperate, you may try installing Chromium, then logging in there and using --cookies-from-browser chromium --impersonate chrome.

    Bonus tech tip: there's some basic support for the Wayback Machine. Try: yt-dlp --embed-metadata -- https://web.archive.org/web/0/https://youtube.com/watch?v=wvsboPUjrGc https://web.archive.org/web/0/https://youtube.com/watch?v=_jZXbhe6-rg.

    [–] tal@lemmy.today 1 points 7 hours ago* (last edited 7 hours ago) (1 children)

    If your distribution allows using pip (most don't)

    Either create a venv for the python package in question ($ python -m venv venv in the package build directory) and activate it ($ . venv/bin/activate in the package build directory) before running the program or running pip commands, or use pipx instead of pip).

    Or --break-system-packages, then never run as root and run rm ~/.local/lib/python* to clear.