FFMPEG Tutorial: 2-Pass & CRF In X264 & X265 - Gists · GitHub
Instantly share code, notes, and snippets.
- Download ZIP
- Star (14) You must be signed in to star a gist
- Fork (2) You must be signed in to fork a gist
- Embed Select an option
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/hsab/7c9219c4d57e13a42e06bf1cab90cd44.js"></script> - Save hsab/7c9219c4d57e13a42e06bf1cab90cd44 to your computer and use it in GitHub Desktop.
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/hsab/7c9219c4d57e13a42e06bf1cab90cd44.js"></script> Save hsab/7c9219c4d57e13a42e06bf1cab90cd44 to your computer and use it in GitHub Desktop. Download ZIP FFMPEG Tutorial: 2-Pass & CRF in x264 & x265 Raw ffmpeg_tut_.mdGoogle FFMPEG H264
Two-Pass: Requires a bitrate. This defines the quality of the video. Youtube and Vimeo usually reduce your bitrate to 25mbs. So if it is higher, it will be compressed by these websites.
Lower bitrate means lower files size.
Calculating Bitrate:
- (Size in Megabytes * 8192) / Total Length in Seconds = Available bandwith
- Available bandwith - Audio Bitrate = Video Bitrate
For example:
- (200 MiB * 8192 [converts MiB to kBit]) / 600 seconds = ~2730 kBit/s total bitrate
- 2730 - 320 kBit/s (desired audio bitrate) = 2410 kBit/s video bitrate
Procedure:
2 Pass example:
-
Download FFMPEG fro Windows
-
Extract and go to "bin" folder.
-
In "bin" hold Shift+RightClick and select Open PowerShell...
-
For pass 1: .\ffmpeg.exe -thread_queue_size 512 -y -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv420p -vprofile high422 -vlevel 4.2 -preset veryslow -b:v 2410k -c:a aac -strict experimental -b:a 320k -pass 1 -f mp4 NULL
-
For pass 2: .\ffmpeg.exe -thread_queue_size 512 -r 24 "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv420p -vprofile high422 -vlevel 4.2 -preset veryslow -b:v 2410k -c:a aac -strict experimental -b:a 320k -pass 2 "D:\output.mp4"
CRF example:
-
Lossy CRF (1-51): .\ffmpeg.exe -thread_queue_size 512 -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv420p -vprofile high422 -vlevel 4.2 -preset veryslow -crf 2 -c:a aac -strict experimental -b:a 320k "D:\crf2_output.mp4"
-
Lossless CRF 0 H264: .\ffmpeg.exe -thread_queue_size 512 -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx264 -pix_fmt yuv444p -vprofile high444 -vlevel 5.1 -preset veryslow -crf 0 -c:a aac -strict experimental -b:a 320k "D:\crf0_output.mp4"
-
Lossless CRF 0 H265: .\ffmpeg.exe -thread_queue_size 512 -r 24 -i "D:\%04d.png" -i "D:\Max.wav" -c:v libx265 -preset veryslow -crf 0 -c:a aac -strict experimental -b:a 320k "D:\crf0_output.mp4"
Parameters Explained:
Framerate of Source: -r 24
Source Video: -i "D:\%04d.png" (Image Sequence eg 0001.png)
Source Audio: -i "D:\Max.wav"
Codec Video: -c:v libx264
Pixel Format: -pix_fmt yuv420p
H264 Profile: -vprofile high422
H264 Level: -vlevel 4.2
Compression (Loseless): -preset veryslow
Bitrate Video: -b:v 2410k (Calculated as above)
Pass Number: -pass 1
Codec Audio: -c:a aac
Needed For AAC: -strict experimental
Bitrate Audio: -b:a 320k (Desired audio rate)
Format: -f mp4
slycordinator commented May 17, 2023
According to https://trac.ffmpeg.org/wiki/Encode/H.264 the conversion factor for bitrates should be 8388.608.
In ffmpeg, bitrates are given in "kb/s" and according to the documentation, kb is 1000 bits. But using a factor of 8192 gives you kibibits (1024 bits).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment You can’t perform that action at this time.Từ khóa » H264 H265 Crf
-
FFmpeg H264 & H265 Preset Crf Comparison 2020 (finale) - Write
-
CRF Guide (Constant Rate Factor In X264, X265 And Libvpx)
-
H.264 Video Encoding Guide - FFmpeg Wiki
-
What Is CRF H264? - High Tech Guide
-
Video Compression Testing: X264 Vs X265 CRF In Handbrake 0.10.5
-
What CRF Or Settings I Should Choose For H265 In Order To Achieve A ...
-
H265 Crf - Non-Emby General Discussion - Emby Community
-
What CRF Or Settings I Should Choose For H265 ... - CopyProgramming
-
CRF Values? - VideoHelp Forum
-
CRF Values - VideoHelp Forum
-
The Relation Between Quality And Bitrate In CRF. | Download Table
-
Encoding Time, Bitrate And Objective Qualities For Videos Encoded ...
-
Is A CRF Of 1 Overkill? - Ffmpeg - Super User
-
Encoding Guide - Remotion