Introduction:
I have been conducting extensive research on video encoding, particularly focusing on hardware-accelerated processes.
One of my most interesting findings challenges the misconception that rapid upscaling is impossible.
I've also done this proof of concept as some tools falsely claim to offer 1080p quality and 5.1 sound when they don't deliver these results.
This research aims to expose these misleading claims and demonstrate how this upscaling and audio upsampling can be achieved quickly.
During my research, I experimented with the rapid upscaling of SD (standard definition) MP4 videos to 1080p resolution using various GPU types.
I want to mention that the script was initially written for FFmpeg 6.
However, users of FFmpeg 7 may notice differences, particularly with Intel acceleration, where the CRF option seems no longer included.
Intel and Nvidia produce better quality outputs than AMD, which performs somewhat lower in quality.
Script Execution:
Please note that the script for upscaling will be provided further down in this post.
To use it, copy the provided script into a new text file, rename it (e.g., upscale.ps1), and save it in the folder containing your MP4 files.
Run the script from that folder to begin the upscaling process.
Important Note:
This script is a proof of concept with no further updates or improvements. As such, any feedback or observations you have are greatly appreciated.
Here's the script itself:
Before Using the Script:
Before running the provided script, ensure that the FFmpeg executable path is correctly set.
Locate the line that begins with $ffmpegPath and update the path to reflect the location of your FFmpeg executable file on your system.
For example:
Script Overview:
The provided script is designed to facilitate the rapid upscaling of SD (standard definition) MP4 videos to 1080p resolution using hardware-accelerated encoding via FFmpeg.
It prompts the user to select the type of GPU for hardware acceleration (AMD, Intel, or NVIDIA) and performs the encoding accordingly.
Here's a brief overview of what each GPU option entails:
Feel free to further adjust or expand upon this as needed!
I have been conducting extensive research on video encoding, particularly focusing on hardware-accelerated processes.
One of my most interesting findings challenges the misconception that rapid upscaling is impossible.
I've also done this proof of concept as some tools falsely claim to offer 1080p quality and 5.1 sound when they don't deliver these results.
This research aims to expose these misleading claims and demonstrate how this upscaling and audio upsampling can be achieved quickly.
During my research, I experimented with the rapid upscaling of SD (standard definition) MP4 videos to 1080p resolution using various GPU types.
I want to mention that the script was initially written for FFmpeg 6.
However, users of FFmpeg 7 may notice differences, particularly with Intel acceleration, where the CRF option seems no longer included.
Intel and Nvidia produce better quality outputs than AMD, which performs somewhat lower in quality.
Script Execution:
Please note that the script for upscaling will be provided further down in this post.
To use it, copy the provided script into a new text file, rename it (e.g., upscale.ps1), and save it in the folder containing your MP4 files.
Run the script from that folder to begin the upscaling process.
Important Note:
This script is a proof of concept with no further updates or improvements. As such, any feedback or observations you have are greatly appreciated.
Here's the script itself:
Code:
# Set ffmpeg executable path
$ffmpegPath = "X:\FFmpeg\ffmpeg.exe"
# Get all MP4 files in the current directory
$videoFiles = Get-ChildItem -Path . -Filter *.mp4
# Prompt user for hardware acceleration type
Write-Host "Select the type of GPU for hardware acceleration:"
Write-Host "1. AMD (uses hevc_amf)"
Write-Host "2. Intel (uses hevc_qsv)"
Write-Host "3. NVIDIA (uses hevc_nvenc)"
$gpuSelection = Read-Host "Enter the number corresponding to your GPU type"
# Encoding based on GPU selection
switch ($gpuSelection) {
"1" {
# AMD Encoding with HEVC and CRF 21
foreach ($video in $videoFiles) {
$inputPath = $video.FullName
$outputPath = $video.DirectoryName + "\" + $video.BaseName + "_resized.mp4"
try {
$ffmpegCommand = "$ffmpegPath -i `"$inputPath`" -vf scale=-1:1080 -c:v hevc_amf -crf 21 -c:a copy -c:s copy `"$outputPath`""
Invoke-Expression $ffmpegCommand
Write-Host "AMD Encoding completed: $outputPath"
} catch {
Write-Host "Error during AMD encoding."
Write-Host "Error message: $($_.Exception.Message)"
}
}
}
"2" {
# Intel Encoding with HEVC and CRF 21
foreach ($video in $videoFiles) {
$inputPath = $video.FullName
$outputPath = $video.DirectoryName + "\" + $video.BaseName + "_resized.mp4"
try {
$ffmpegCommand = "$ffmpegPath -i `"$inputPath`" -vf scale=-1:1080 -c:v hevc_qsv -crf 21 -c:a copy -c:s copy `"$outputPath`""
Invoke-Expression $ffmpegCommand
Write-Host "Intel Encoding completed: $outputPath"
} catch {
Write-Host "Error during Intel encoding."
Write-Host "Error message: $($_.Exception.Message)"
}
}
}
"3" {
# NVIDIA Encoding with HEVC and CRF 21
foreach ($video in $videoFiles) {
$inputPath = $video.FullName
$outputPath = $video.DirectoryName + "\" + $video.BaseName + "_resized.mp4"
try {
$ffmpegCommand = "$ffmpegPath -i `"$inputPath`" -vf scale=-1:1080 -c:v hevc_nvenc -crf 21 -c:a copy -c:s copy `"$outputPath`""
Invoke-Expression $ffmpegCommand
Write-Host "NVIDIA Encoding completed: $outputPath"
} catch {
Write-Host "Error during NVIDIA encoding."
Write-Host "Error message: $($_.Exception.Message)"
}
}
}
default {
Write-Host "Invalid selection."
}
}
# Indicate completion and wait for user input to exit
Write-Host "All encoding processes are completed."
Write-Host "Press 'Enter' to exit."
Read-Host ""
Before Using the Script:
Before running the provided script, ensure that the FFmpeg executable path is correctly set.
Locate the line that begins with $ffmpegPath and update the path to reflect the location of your FFmpeg executable file on your system.
For example:
Code:
# Set ffmpeg executable path
$ffmpegPath = "X:\FFmpeg\ffmpeg.exe"
Script Overview:
The provided script is designed to facilitate the rapid upscaling of SD (standard definition) MP4 videos to 1080p resolution using hardware-accelerated encoding via FFmpeg.
It prompts the user to select the type of GPU for hardware acceleration (AMD, Intel, or NVIDIA) and performs the encoding accordingly.
Here's a brief overview of what each GPU option entails:
- AMD: Utilizes the hevc_amf codec for encoding with a constant rate factor (CRF) of 21.
- Intel: Utilizes the hevc_qsv codec for encoding with a CRF of 21. Note that the AC CRF option may not be included in FFmpeg 7 for Intel.
- NVIDIA: Utilizes the hevc_nvenc codec for encoding with a CRF of 21.
Feel free to further adjust or expand upon this as needed!