Skip to main content

yt-dlp postprocessor plugin for audio normalization using ffmpeg-normalize

Project description

yt-dlp-audio-normalize

CI codecov PyPI Python License: Unlicense

ffmpeg-normalize を使用した音量正規化のための yt-dlp PostProcessor プラグイン

要件

  • Python >= 3.10
  • yt-dlp
  • ffmpeg (システムにインストール済みであること)

インストール

pip install -U yt-dlp-audio-normalize

使用方法

--use-postprocessor

# デフォルト
yt-dlp --use-postprocessor AudioNormalize URL

# パラメータを指定
yt-dlp --use-postprocessor "AudioNormalize:target_level=-14.0;audio_codec=aac" URL

# 実行タイミングを指定
yt-dlp --use-postprocessor "AudioNormalize:when=pre_process" URL

when を省略した場合、自動的に after_move で実行される。これにより、ファイルが最終パスに移動された後に音量正規化が行われる。

--ppa (PostProcessor Arguments)

yt-dlp --ppa "AudioNormalize:-t -14.0 -c:a aac -b:a 128k" URL

--use-postprocessor の kwargs と --ppa の両方が指定された場合、PPA が優先される。

自動推定

ダウンロード済みファイルのメタデータから以下のパラメータが自動的に設定される:

パラメータ ソース 説明
extension ext 出力ファイルの拡張子
audio_codec acodec 音声コーデック(デコーダ名→エンコーダ名に自動変換)
sample_rate asr サンプルレート(未取得時は 48000 Hz)
audio_bitrate abr 音声ビットレート

ユーザーが明示的に指定した値は自動推定値より優先される。

Python API

import yt_dlp
from yt_dlp_plugins.postprocessor.audio_normalize import AudioNormalizePP

with yt_dlp.YoutubeDL(opts) as ydl:
    ydl.add_post_processor(AudioNormalizePP(), when="after_move")
    ydl.download([url])

サポートされるパラメータ

FFmpegNormalize.__init__() のすべてのスカラーパラメータは、ロングフラグ(例: --target-level, --audio-codec)で自動的にサポートされる

ショートフラグ

フラグ パラメータ 説明
-nt normalization_type 正規化タイプ
-t target_level ターゲットレベル
-p print_stats 統計情報の表示
-lrt loudness_range_target ラウドネス範囲ターゲット
-tp true_peak トゥルーピーク
-c:a audio_codec 音声コーデック
-b:a audio_bitrate 音声ビットレート
-ar sample_rate サンプルレート
-ac audio_channels 音声チャンネル数
-koa keep_original_audio 元の音声を保持
-prf pre_filter プリフィルター
-pof post_filter ポストフィルター
-vn video_disable 映像を無効化
-c:v video_codec 映像コーデック
-sn subtitle_disable 字幕を無効化
-mn metadata_disable メタデータを無効化
-cn chapters_disable チャプターを無効化
-ofmt output_format 出力フォーマット
-ext extension 拡張子
-d debug デバッグモード
-n dry_run ドライラン
-pr progress 進捗表示

ライセンス

Unlicense

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_dlp_audio_normalize-0.3.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_dlp_audio_normalize-0.3.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file yt_dlp_audio_normalize-0.3.1.tar.gz.

File metadata

  • Download URL: yt_dlp_audio_normalize-0.3.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yt_dlp_audio_normalize-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a4c1614b9c04b42ce4900ccd376ebaa7ddd43af8556a801108696a3c84ae0aab
MD5 165c82514ecbca271d347bd85b984116
BLAKE2b-256 825780497d3643c4fb1e4230fe8cd235a6a7085f2c01a0d004b8e518ace3d70d

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_dlp_audio_normalize-0.3.1.tar.gz:

Publisher: publish.yml on 9c5s/yt-dlp-AudioNormalize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yt_dlp_audio_normalize-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yt_dlp_audio_normalize-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e39f5594efe92fca1af4173630d9c2964ec9616cf56f21121e29827823357a46
MD5 b4ed4469a6587bb897e1eaf37d20383e
BLAKE2b-256 edb42d3839498da8060a1b2fa50060560f22f515bba1e3ac630f6d5590638603

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_dlp_audio_normalize-0.3.1-py3-none-any.whl:

Publisher: publish.yml on 9c5s/yt-dlp-AudioNormalize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page