Introduction

So, FreeTube is broken and you want to watch YouTube on your desktop without using the YouTube site or embed. If you have mpv installed and want to use that, this guide is for you.

Note: This guide does NOT work with the Flatpak version of FreeTube!

Getting YT Links to open in MPV

First, we need to set MPV as a video player in FreeTube. Since FreeTube has support for external players, this is what we will use.

  1. Open Settings
  2. Under External Player, select mpv from the dropdown list.

Below the dropdown is Custom External Player Arguments. Here are the recommended ones I use:

  • --fs: Automatically opens the video in fullscreen.
  • --ytdl-raw-options=format="(bestvideo[height<=X]+bestaudio/best)": Gets the best audio and best video and combines them. Video resolution is no larger than X. Example resolutions include 720, 1080, 1440, 2160. I personally use 720, but you use whatever your bandwith allows.

Install Recommended MPV plugins

By itself, mpv is pretty barebones. It’s missing a few features that FreeTube has, such as sponsorblock or media controls. Below are the following plugins that solve these issues. I won’t include the install directions for these as these will differ for each distro, but the main installation point should be either ~/.config/mpv/scripts (Current User) or /usr/share/mpv/scripts (All Users).

mpv-sponsorblock: https://github.com/TheCactusVert/mpv-sponsorblock

This Rust implementation of sponsorblock works well with MPV. A few things to note:

  1. Segments do not display on the timeline. However, automatic skipping does work.
  2. To edit what type of segments are skipped, follow the Configuration section in the repo, and edit your sponsorblock.toml file in ~/.config/mpv.

Here is what I personally use:

# Categories: sponsor, selfpromo, interaction, poi_highlight, intro, outro, preview, music_offtopic, filler, exclusive_access
categories = ["sponsor", "interaction", "music_offtopic"]
# Action types: skip, mute, poi, full
action_types = ["skip", "skip", "skip"]

mpv-mpris: https://github.com/hoyon/mpv-mpris

This plugin displays media controls for MPV on KDE Plasma and GNOME. By default, MPV lacks the MPRIS D-Bus interface used by programs such as playerctl to provide media controls and information.

  • mpv-mpris has a package in the Arch repos (Extra). Note that this will install to /usr/share/mpv/scripts instead.

Setup Recommended Keyboard Shortcuts

MPV is looking pretty good now, however there are some small tweaks we can make to the default keyboard shortcuts. My main gripe with mpv is the UP/DOWN arrows are set to seek 1 minute and * and / (Numpad) control volume. Let’s fix that.

  1. Copy the default input.conf file for mpv to ~/.config/mpv. This file should be located in /usr/share/doc/mpv, but depending on how you install mpv, this may differ.

    $ cp /usr/share/doc/mpv/input.conf ~/.config/mpv
    
  2. Edit this file with your preferred text editor and add the following to the end:

    UP    add volume  2                         # Increase volume by 2%
    DOWN  add volume -2                         # Decrease volume by 2%
    

This will rebind your UP/DOWN arrow keys to volume controls. Change the value to whatever your want. If you want to match FreeTube’s volume controls, set the values to 5 and -5.

Some additional shortcuts to know about for MPV:

  • i: Show debug info (Similar to View Stats in YT)
  • o: Show current video progress
  • Menu: Show the menu key. Useful for accessing playlist menu.
    • Usually the Square with 3 horizontal lines in the middle.
    • Some keyboards lack this button.
  • [: Decrease video speed by 10%
    • Use Shift to decrease by 50%
  • ]: Increase video speed by 10%
    • Use Shift to increase by 50%
  • Backspace: Reset video speed to 100%
  • m: Mute audio
  • Page Up: Go to next chapter
  • Page Down: Go to previous chapter
  • q: Quit MPV
  • >/Enter: Play next video in playlist
  • <: Play previous video in playlist
    • For these two, you need to press and hold Shift with them. The exception is Enter.

Wrap-Up

And thats the setup. I hope you enjoy this temporary setup until FreeTube gets fixed. It takes some time to setup, but once it is, you can use it anywhere. You can even use it with just yt-dlp if you want.

This guide might work with Celluloid. I personally don’t use it, but you can try if you want to.

If there are any issues with this guide, let me know!___

EDIT: Added Flatpak FreeTube warning

EDIT 2: Updated debug keybind. D was for interlace, not debug.

  • anytimesoon@piefed.social
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 day ago

    Slightly off topic, but did something happen to freetube, or is this YouTube making a change and breaking things?

    • MoonMelon@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      Watching videos has been broken for a few weeks. On the 24th of Sep they mentioned that they’d identified a potential cause, but since then there haven’t been any updates. They typically aren’t super communicative and tend to lock down posts because of the huge surge of duplicate bug reports and unhelpful comments they get whenever this happens. So the silence is not that unusual, but it has been slightly longer than usual for an update.

      • AstroLightz@lemmy.worldOP
        link
        fedilink
        arrow-up
        1
        ·
        21 hours ago

        Might be something with upstream? Just speculation on my part. Wish they would post some type of update.

  • lemmyknow@lemmy.today
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    Eh. Been using MPV as an alternative, and so many thanks to whoever mentioned that on Lemmy. Works way better than FreeTube currently. However, it also fails at times. At least in my experience. Which is rather annoying. Better than nothing, though

  • RedSnt 👓♂️🖥️@feddit.dk
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    3 days ago

    It comes as no surprise that the flatpak version of freetube doesn’t like using an external player. I tried giving access to /usr/bin via flatseal, but alas.
    Installing the real version it works though, but seemingly Fedora’s current version of yt-dlp doesn’t seem to cut it anymore. There is a newer version on yt-dlp’s github though, so getting that and overwriting the installed version in /usr/bin (don’t forget to make a backup, otherwise there’s sudo dnf reinstall yt-dlp) that does the trick.

    The sponsorblock plugin is an excellent shout though, I hadn’t heard of that for MPV, then again, it’s rare for me to stream directly from youtube.
    But wait, doesn’t yt-dlp already have sponsorblock support? I guess it’s better to get the whole stream and then do player based sponsorblock stuff.

    • Domi@lemmy.secnd.me
      link
      fedilink
      arrow-up
      3
      ·
      2 days ago

      It does work via Flatpak, you have to give Freetube the “D-Bus session bus” permission and then put the following in your external player settings (this launches the flatpak mpv):

      External player

      mpv

      Custom External Player Executable:

      flatpak-spawn

      Custom External Player Arguments:

      –host flatpak run io.mpv.Mpv <any mpv arguments you need>

    • AstroLightz@lemmy.worldOP
      link
      fedilink
      arrow-up
      4
      ·
      3 days ago

      I didnt know that. Apparently there are formating options for SponsorBlock in yt-dllp directly. I don’t know how you would set that up with FreeTube though.

      I’m sticking with the plugin since it’s as simple as building it and copying it to the scripts directory, and it comes with a simple config.

  • glitching@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    2 days ago

    another option that works for me is macast. that’s a DLNA sink that you can send youtube (and other) videos to and it plays it via mpv, in full screen if you so desire. it also accepts jellyfin, you can control it remotely (via AllCast).

    so I’m browsing videos in newtube on my phone, send them to allcast, and that one sends them to macast. sounds convoluted but its like three taps and an alternative to chromecast.