npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

peertube-plugin-custom-transcoding-profile

v0.3.4

Published

Set a custom quality for transcoding videos in Peertube with CRF, preset, tune options, and then some.

Downloads

50

Readme

PeerTube Plugin — Custom Transcoding Profile

so good it's almost lossless™

This plugin introduces a transcoding profile with configurable settings for CRF, preset, tune, profile, and custom audio parameters. All the configurations and settings revolve around ffmpeg, providing you with a flexible means to manipulate the transcoding process.

Reference to Original Project

This plugin is a derivative of the peertube-plugin-transcoding-custom-quality project, developed by Framasoft, specifically Chocobozzz and other Individual Contributors. The original project is licensed under AGPL 3.0.

Modification Details and Available Options

The following modifications and additions have been made to the original project:

  • the default CRF values have been fine-tuned;
  • a profile option has been added;
  • a tune option has been added;
  • a preset option has been added;
  • audio-related options have been integrated;
  • code linting and formatting.

CRF

CRF (Constant Rate Factor) is a setting for the video encoder that balances video quality against file size. The lower the CRF value, the higher the video quality, but also the larger the file size.

In this plugin, the default CRF value is set to 20 for VOD and 21 for live streams.

For more information on CRF, refer to ffmpeg's guide on CRF in H.264.

Profile

The profile option allows you to specify the encoding profile. Not all codecs support all profiles, and not all devices can play all profiles. Setting up the right profile ensures compatibility and efficiency.

The default profile is set to "high" for both VOD and live streams.

For more details on profiles, refer to ffmpeg's guide on profiles in H.264 and Wikipedia's article on H.264 profiles.

Tune

The tune option helps you optimize the settings for specific types of source material.

While the default tune for VOD is set to nothing, for live streams it is set to "zerolatency" to reduce encoding latency.

For more information on tune settings, refer to ffmpeg's guide on tune settings in x264.

Preset

The preset option determines the encoding speed to compression ratio. A slower preset will provide better compression. This means that, given a certain file size or bit rate, using a slower preset will increase quality; or, given a certain quality level, will reduce the bit rate.

The default preset for VOD is "slow", and for live streams, it's "fast".

For further details on presets, refer to ffmpeg's guide on presets in x264.

Audio

The plugin provides the ability to apply custom audio configurations during the encoding process. This feature is disabled by default, but can be enabled according to your needs.

The default audio configuration for VOD is "-b:a 320k -filter:a loudnorm=I=-16:TP=-1.0" (320 kbps bitrate and loudness normalization to -16.0 LUFS and -1.0 dB true peak), and for live streams, it's "-b:a 286k".

For more insights into audio encoding with ffmpeg, refer to ffmpeg's guide on AAC encoding and ffmpeg's aac encoder parameters, as well as ffmpeg's guide on audio filters.

Other

Please note that these settings directly influence the ffmpeg command used for encoding, and any changes might disrupt the encoding process, introduce vulnerabilities, or result in unexpected behavior. Therefore, it's crucial to proceed with caution, and to test the settings thoroughly before applying them to a production environment.

Note on Audio Options

To fully utilize the "audio configuration" in this plugin, it might be necessary to disable PeerTube's default behavior of instructing ffmpeg to copy the audio stream, when available. The reason is that this behavior could lead to an error if you attempt to apply audio filtering.

To disable this, you will need to apply a simple patch to PeerTube's source code. The patch removes the check for availability of copying the audio stream from packages/ffmpeg/src/ffmpeg-default-transcoding-profile.ts at lines 47-49.

Please proceed with caution when modifying the underlying behavior of PeerTube's transcoding process.