ffmpeg:conversions:convert_h264_to_h265
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
ffmpeg:conversions:convert_h264_to_h265 [2023/06/13 10:46] – created peter | ffmpeg:conversions:convert_h264_to_h265 [2023/11/01 21:23] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ffmpeg - Conversions - Convert H264 to H265 ====== | ====== ffmpeg - Conversions - Convert H264 to H265 ====== | ||
+ | |||
+ | ===== Convert h.264 to h.265 (no change in resolution) ===== | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i input.mp4 -c:v libx265 -vtag hvc1 -c:a copy output.mp4 | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Software Encoding ===== | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i a.mp4 -c:v libx265 a.mkv | ||
+ | |||
+ | ffmpeg -i a.mp4 -c:v libx265 -map 0:v -c:a copy -map 0:a -c:s copy b.mkv | ||
+ | |||
+ | ffmpeg -i a.mp4 -c:v libx265 -map 0:v -c:a copy -map 0:a? -c:s copy -map 0:s? b.mkv | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * It does not support hardware encoding. | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Using GPU Hardware Encoding ===== | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -hwaccel vaapi -hwaccel_device / | ||
+ | |||
+ | ffmpeg -hwaccel vaapi -hwaccel_device / | ||
+ | |||
+ | ffmpeg -hwaccel vaapi -hwaccel_device / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | <code bash> | ||
+ | -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Encoding formats ==== | ||
+ | |||
+ | Try replacing scale with scale_vaapi and replace -c:v h264 with -c:v: h264_vaapi | ||
+ | |||
+ | The supported encoders are: | ||
+ | |H.262 / MPEG-2 part 2|mpeg2_vaapi| | ||
+ | |H.264 / MPEG-4 part 10 (AVC)|h264_vaapi| | ||
+ | |H.265 / MPEG-H part 2 (HEVC)|hevc_vaapi| | ||
+ | |MJPEG / JPEG|mjpeg_vaapi| | ||
+ | |VP8|vp8_vaapi| | ||
+ | |VP9|vp9_vaapi| | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Keeping the output size low, similar to Software encoding ===== | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -hwaccel vaapi -hwaccel_device / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * You can change bitrate at 0.589M | ||
+ | * 0.589M is 0.589 Megabytes. | ||
+ | * Change it accordingly to your desired bitrate. I will use 2x - 3x smaller than the orginal. In this example h.264 to hevc. | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Other examples ==== | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i a.mp4 -vaapi_device / | ||
+ | |||
+ | ffmpeg -hwaccel vaapi -hwaccel_device / | ||
+ | |||
+ | ffmpeg -init_hw_device vaapi=amd:/ | ||
+ | |||
+ | |||
+ | ffmpeg -hwaccel vaapi -hwaccel_device / | ||
+ | |||
+ | ffmpeg -threads 16 -hwaccel vaapi -hwaccel_device / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | === References === | ||
+ | |||
+ | https:// | ||
ffmpeg/conversions/convert_h264_to_h265.1686653211.txt.gz · Last modified: 2023/06/13 10:46 by peter