User Tools

Site Tools


ffmpeg:encoding

Table of Contents

ffmpeg - Encoding

GPU Encoding


# Only extract Eng language.
# Set language to Eng for Video.
ffmpeg -i "input.mkv" -map 0:0 -metadata:s:v:0 language=eng -map 0:a:m:language:eng? -map 0:s:m:language:eng? -map 0:d? -map 0:t? -c:v libx265 -crf 23 -c:a copy -c:s copy -threads 8 -bufsize 8M -maxrate 8M "out.mkv"
 
# Set language to Eng for Audio.
# Set language to Eng for Subs.
# Set language to Eng for Video.
ffmpeg -i "input.mkv" -c:v libx265 -c:a aac -crf 23 -preset fast -metadata:s:v:0 language=eng -metadata:s:a:0 language=eng -map 0:s:m:language:eng? -metadata:s:s:0 language=eng -threads 8 -bufsize 8M -maxrate 8M "0.mkv"

GPU

ffmpeg -vaapi_device /dev/dri/renderD128 -i "input.mkv" -vf 'hwupload,scale_vaapi=w=1920:h=1080:format=nv12' -map 0:v -metadata:s:v:0 language=eng -c:v hevc_vaapi -map 0:a -metadata:s:a:0 language=eng -map 0:s? -metadata:s:s:0 language=eng -rc_mode CQP -global_quality 25 -c:a copy -c:s copy -profile:v main -v verbose output.mkv
 
 
 
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "input.mkv" -map 0:v -metadata:s:v:0 language=eng -map 0:a -metadata:s:a:0 language=eng -map 0:s? -metadata:s:s:0 language=eng -c:v hevc_vaapi -c:a copy -c:s copy -global_quality 28 "output.mkv"

OLD

# Only extract Eng language.
ffmpeg -i "input.mkv" -map 0:v -map 0:a:m:language:eng? -map 0:s:m:language:eng? -map 0:d? -map 0:t? -c:v libx265 -crf 23 -c:a copy -threads 12 -bufsize 4M "out.mkv"
 
# Set language to Eng for Audio when language of audio is not defined for English.
ffmpeg -i "input.mkv" -map 0:v -map 0:a:m:language:eng? -map 0:a -metadata:s:a:0 language=eng -map 0:s:m:language:eng? -map 0:d? -map 0:t? -c:v libx265 -crf 23 -c:a copy -threads 12 -bufsize 4M "out1.mkv"

av1

h264

h265

5.1 Audio

Batch encode all files in a directory

Get the ffmpeg encoders available

Set Language

ffmpeg/encoding.txt · Last modified: 2024/09/15 09:29 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki