Skip to main content

Post-Processing Basics

Post-processing allows you to modify, convert, and enhance downloaded media after the initial download. yt-dlp includes numerous built-in post-processors and supports custom processing workflows.

Core Post-Processing Concepts

Post-Processing Pipeline

Post-processing occurs in stages after video download:

  1. Pre-process: Before format selection
  2. After filter: After format filtering
  3. Video: After format selection
  4. Before download: Before each video download
  5. Post-process: After each video download (default)
  6. After move: After moving to final location
  7. After video: After processing all formats
  8. Playlist: At end of playlist

Audio Post-Processing

Extract Audio

# Basic audio extraction
yt-dlp -x "https://example.com/video"

# Specify audio format and quality
yt-dlp -x --audio-format mp3 --audio-quality 0 "https://example.com/video"

# Keep original video file
yt-dlp -x --keep-video "https://example.com/video"

Audio Format Conversion

# Convert to specific format
yt-dlp --audio-format flac "https://example.com/video"

# Multiple format rules
yt-dlp --audio-format "mp3/aac/best" "https://example.com/video"

# Specific bitrate
yt-dlp -x --audio-quality 192K "https://example.com/video"

Video Post-Processing

Video Format Conversion

# Remux to different container
yt-dlp --remux-video mp4 "https://example.com/video"

# Re-encode video
yt-dlp --recode-video mp4 "https://example.com/video"

# Complex remuxing rules
yt-dlp --remux-video "aac>m4a/mov>mp4/mkv" "https://example.com/video"

Video Quality Processing

# Merge best video and audio
yt-dlp -f "bv+ba" --merge-output-format mp4 "https://example.com/video"

Metadata Processing

Embed Metadata

# Add metadata to file
yt-dlp --embed-metadata "https://example.com/video"

# Embed thumbnails
yt-dlp --embed-thumbnail "https://example.com/video"

# Embed subtitles
yt-dlp --embed-subs "https://example.com/video"

# Embed chapters
yt-dlp --embed-chapters "https://example.com/video"

Custom Metadata

# Parse custom metadata
yt-dlp --parse-metadata "title:(?P<artist>.+) - (?P<title>.+)" "https://example.com/video"

# Replace metadata fields
yt-dlp --replace-in-metadata "title" " " "_" "https://example.com/video"

Chapter Processing

Split by Chapters

# Split video into chapters
yt-dlp --split-chapters "https://example.com/video"

# Custom chapter output template
yt-dlp --split-chapters \
-o "chapter:%(title)s - %(section_number)02d - %(section_title)s.%(ext)s" \
"https://example.com/video"

Remove Chapters

# Remove specific chapters by title
yt-dlp --remove-chapters "intro|outro" "https://example.com/video"

# Force keyframes at cuts (slower but cleaner)
yt-dlp --remove-chapters "ads" --force-keyframes-at-cuts "https://example.com/video"

Advanced Post-Processing

Custom Post-Processors

# Use specific post-processor with arguments
yt-dlp --use-postprocessor "ModifyChapters:remove_chapters_patterns=intro.*" \
"https://example.com/video"

# Execute custom commands
yt-dlp --exec "after_move:python process.py %(filepath)q" "https://example.com/video"

FFmpeg Arguments

# Custom FFmpeg arguments for specific post-processors
yt-dlp --postprocessor-args "FFmpeg:-c:v libx264 -crf 23" "https://example.com/video"

# Specific to video converter
yt-dlp --postprocessor-args "VideoConvertor:-c:v libx265" "https://example.com/video"

# Input/output specific arguments
yt-dlp --postprocessor-args "FFmpeg_i:-hwaccel cuda" "https://example.com/video"

Thumbnail Processing

Thumbnail Extraction and Conversion

# Write thumbnails to disk
yt-dlp --write-thumbnail "https://example.com/video"

# Convert thumbnail format
yt-dlp --write-thumbnail --convert-thumbnails jpg "https://example.com/video"

# Write all available thumbnails
yt-dlp --write-all-thumbnails "https://example.com/video"

Subtitle Post-Processing

Subtitle Conversion

# Convert subtitle format
yt-dlp --write-subs --convert-subs srt "https://example.com/video"

# Multiple subtitle processing
yt-dlp --write-subs --embed-subs --convert-subs vtt "https://example.com/video"

Fixup Post-Processors

Automatic Fixes

# Automatic fixup policy
yt-dlp --fixup detect_or_warn "https://example.com/video"

# Force fixup even if file exists
yt-dlp --fixup force "https://example.com/video"

# Never attempt fixup
yt-dlp --fixup never "https://example.com/video"

Post-Processing Control

Overwrite Policies

# Overwrite post-processed files
yt-dlp --post-overwrites "https://example.com/video"

# Don't overwrite existing processed files
yt-dlp --no-post-overwrites "https://example.com/video"

Processing Order

# Execute at different stages
yt-dlp --exec "pre_process:echo Starting %(title)s" \
--exec "post_process:echo Finished %(title)s" \
"https://example.com/video"

Batch Post-Processing

Process Existing Files

# Process info.json files
yt-dlp --load-info-json video.info.json

# Batch process with post-processing
yt-dlp --embed-metadata --batch-file videos.txt

Playlist Post-Processing

# Post-process entire playlist
yt-dlp --embed-metadata --embed-thumbnail \
-o "%(playlist)s/%(title)s.%(ext)s" \
"https://example.com/playlist"

Performance Considerations

FFmpeg Location

# Specify FFmpeg location
yt-dlp --ffmpeg-location /usr/local/bin/ffmpeg "https://example.com/video"

Resource Management

# Limit concurrent processing
yt-dlp --concurrent-fragments 2 "https://example.com/video"

Error Handling

Post-Processing Errors

# Continue on post-processing errors
yt-dlp --ignore-errors --embed-metadata "https://example.com/video"

# Abort on post-processing errors
yt-dlp --abort-on-error --embed-metadata "https://example.com/video"

Configuration Examples

Complete Media Processing

# Full featured processing
yt-dlp \
--format "bv*+ba/b" \
--embed-metadata \
--embed-thumbnail \
--embed-subs \
--sub-langs en \
--write-info-json \
--merge-output-format mkv \
"https://example.com/video"

Audio-Only Processing

# Complete audio extraction with metadata
yt-dlp \
--extract-audio \
--audio-format mp3 \
--audio-quality 0 \
--embed-metadata \
--embed-thumbnail \
--parse-metadata "title:(?P<artist>.+) - (?P<title>.+)" \
"https://example.com/video"