LinuxCommandLibrary

peerflix

Stream torrent videos without fully downloading

TLDR

Stream the largest media file in a torrent

$ peerflix "[torrent_url|magnet_link]"
copy

List all streamable files contained in a torrent (given as a magnet link)
$ peerflix "[magnet:?xt=urn:btih:0123456789abcdef0123456789abcdef01234567]" [[-l|--list]]
copy

Stream the largest file in a torrent, given as a torrent URL, to VLC
$ peerflix "[http://example.net/music.torrent]" [[-v|--vlc]]
copy

Stream the largest file in a torrent to MPlayer, with subtitles
$ peerflix "[torrent_url|magnet_link]" [[-m|--mplayer]] [[-t|--subtitles]] [subtitle-file.srt]
copy

Stream all files from a torrent to Airplay
$ peerflix "[torrent_url|magnet_link]" [[-a|--all]] [[-s|--airplay]]
copy

SYNOPSIS

peerflix [options] <magnet-link|torrent-file|info-hash>

PARAMETERS

--path
    Specifies the directory where the torrent content will be downloaded.

--port
    Sets the port for the local HTTP streaming server.

--vlc
    Opens the torrent stream directly in VLC media player.

--mplayer
    Opens the torrent stream directly in MPlayer.

--mpv
    Opens the torrent stream directly in MPV media player.

--player
    Specifies a custom media player application to open the stream.

--list
    Displays a list of files contained within the torrent without starting the download.

--file
    Selects a specific file by its index from the torrent to stream, useful for multi-file torrents.

--remove
    Deletes the downloaded files and created server on exit.

--stdout
    Pipes the torrent stream directly to standard output, useful for piping to other tools.

--subtitles
    Loads an external subtitle file for the streamed content.

--airplay
    Streams the torrent content to an AirPlay-enabled device.

--chromecast
    Streams the torrent content to a Chromecast device.

--peer
    Manually adds a peer to connect to for the torrent.

--quiet
    Suppresses verbose output during streaming.

--verbose
    Enables detailed logging output for debugging.

--version
    Displays the current version of peerflix.

--help
    Shows the command's help message and available options.

DESCRIPTION

peerflix is a command-line tool that enables instant streaming of torrent content directly to a media player such as VLC, MPlayer, or MPV, without waiting for the entire file to download. It acts as a lightweight torrent client that prioritizes the initial parts of the file to allow for immediate playback, buffering the rest in the background. It supports magnet links, .torrent files, and info hashes. Beyond local playback, peerflix can also stream to network devices like Chromecast and AirPlay, making it a versatile tool for consuming media from torrents. Its simplicity and effectiveness make it a popular choice for quick access to torrented video content.

CAVEATS

  • peerflix requires Node.js and npm to be installed for its initial setup.
  • The quality of streaming depends heavily on the number of available peers and network speed.
  • Some media players might have issues with non-standard video formats or codecs.
  • The --remove option deletes files immediately after streaming, so ensure you don't need them later.

INSTALLATION

peerflix is typically installed via npm:
npm install -g peerflix
This makes it accessible globally from the command line.

USAGE EXAMPLE

To stream a torrent using a magnet link and open it in VLC:
peerflix 'magnet:?xt=urn:btih:...' --vlc
To stream a specific file from a multi-file torrent:
peerflix <torrent-file> --list (first to see file indices)
peerflix <torrent-file> --file 0 --mpv (then stream the selected file).

HISTORY

peerflix emerged as an early and popular tool for streaming torrents directly from the command line, leveraging the growing popularity of streaming media and the utility of torrents. It was developed in JavaScript (Node.js), making it cross-platform. While webtorrent-cli later gained significant traction offering similar features, peerflix remains a well-known and functional utility for its specific purpose of direct media player integration.

SEE ALSO

webtorrent(1), vlc(1), mpv(1)

Copied to clipboard