• AnyStream is having some DRM issues currently, Netflix is not available in HD for the time being.
    Situations like this will always happen with AnyStream: streaming providers are continuously improving their countermeasures while we try to catch up, it's an ongoing cat-and-mouse game. Please be patient and don't flood our support or forum with requests, we are working on it 24/7 to get it resolved. Thank you.

Guide Reencoding videos via free command-line tools and GPU

A clip of the original Dvd , the rip with make MKV or right before I ran it through NVenc??
Do you want a sample of the DVD??? This is from the original Dvd. You can delete it after you see it if you want to.
 
Last edited:
A clip of the original Dvd , the rip with make MKV or right before I ran it through NVenc??
Either option would work, but ideally, using a clip from the original DVD would be best. It's always beneficial to check the source material to ensure the highest quality for your process.
 
Either option would work, but ideally, using a clip from the original DVD would be best. It's always beneficial to check the source material to ensure the highest quality for your process.
Ok this is from the original dvd. I can not upload video it says wrong format and will not work. Here is some pictures!!
 

Attachments

  • vlcsnap-2023-12-21-02h10m06s035.png
    vlcsnap-2023-12-21-02h10m06s035.png
    387.2 KB · Views: 7
  • vlcsnap-2023-12-21-02h10m14s114.png
    vlcsnap-2023-12-21-02h10m14s114.png
    397.5 KB · Views: 7
  • vlcsnap-2023-12-21-02h10m20s960.png
    vlcsnap-2023-12-21-02h10m20s960.png
    385.8 KB · Views: 7
Last edited:
Either option would work, but ideally, using a clip from the original DVD would be best. It's always beneficial to check the source material to ensure the highest quality for your process.
I can not upload video!
 
Can you try putting it into a zip/rar file or just changing the extension?
 
Soo, is resizing 480p to 2160p really a good idea?

It depends on the source quality and the upscaling algorithm used. For instance, if the original 480p video is of high quality and the upscaling algorithm is advanced. NVENC, NVIDIA's video encoder, has specialized upscaling filters that can enhance the quality of upscaled videos.

Pros:
1. Improved Viewing Experience: Upscaling to 2160p can make the video more suitable for larger or high-resolution displays, providing a better viewing experience.
2. Enhanced Details: Good upscaling algorithms can enhance details and reduce artifacts, making the video appear clearer and more detailed than the original.

Cons:
1. Potential Quality Loss: If the source is of low quality or the upscaling algorithm isn't sophisticated, the resulting video might be blurry or have artifacts.
2. Processing Power: High-quality upscaling, can be resource-intensive and require powerful hardware.

Ultimately, the effectiveness of upscaling from 480p to 2160p will largely depend on the original video quality and the technology used in the upscaling process.
 
I've been asked about the special upscale and noise reduction filters for Rigaya's NVENC:

Resize Filter: --vpp-resize algo=nvvfx-superres​

Specific to nvvfx-superres:
  • nvvfx-superres: A super-resolution filter from NVIDIA's MAXINE VideoEffects SDK designed to upscale videos by enhancing details and apparent resolution. Supported only on Turing generation GPUs (RTX 20xx series) or later.
  • superres-mode=<int>: Choose between different modes of operation for the super-resolution:
    • 0: Conservative (default)
    • 1: Aggressive
  • superres-strength=<float>: Set the strength of the super-resolution effect, with values ranging from 0.0 to 1.0.
Example: Use nvvfx-superres in mode 1: --vpp-resize algo=nvvfx-superres,superres-mode=1

Grain and Noise Removal: --vpp-nvvfx-denoise​

  • A webcam denoise filter from NVIDIA MAXINE VideoEffects SDK is designed to remove low-light camera noise while preserving texture details. Useful in less-than-ideal lighting conditions.
  • Supported Resolutions: 80p to 1080p.
  • Supported GPUs: Turing generation GPUs (RTX 20xx series) or later.
Parameters:

  • strength=<int>: Determines the strength of the denoise effect.
    • 0: Weaker effect, prioritizing texture preservation.
    • 1: Stronger effect, prioritizing noise removal.

Artefact Reduction: --vpp-nvvfx-artifact-reduction​

  • An artefact reduction filter from NVIDIA MAXINE VideoEffects SDK aimed at reducing encoder artefacts while preserving original video details. It helps mitigate blockiness, blurring, or colour banding, especially in lower-bitrate videos.
  • Supported Resolutions: 90p to 1080p.
  • Supported GPUs: Turing generation GPUs (RTX 20xx series) or later.
Parameters:
  • mode=<int>: Determines the mode of artefact reduction.
    • 0 (default): Removes fewer artefacts, preserves low gradient information better, and is suited for higher bitrate videos.
    • 1: Stronger effect, suitable for lower bitrate videos with more pronounced artefacts.

Standard Notes for nvvfx Filters:​

  • Platform Support: Supported only on the x64 version of the encoder.
  • GPU Requirements: Requires Turing generation GPUs (RTX 20xx series) or later.
  • Installation: Download and install Video Effect models and runtime dependencies from NVIDIA's MAXINE VideoEffects SDK. These filters rely on specific models and algorithms provided in the SDK.
Download link for NVIDIA Broadcast SDK Resources: NVIDIA Broadcast SDK Resources
Code:
https://www.nvidia.com/broadcast-sdk-resources
This is required to enable the filters. Download the appropriate filter for your hardware.

Disclaimer for Video Processing with NVENC and NVIDIA MAXINE VideoEffects SDK:

Please note that video processing, especially tasks like upscaling or noise reduction, can be highly variable regarding results. Different videos may have other characteristics and thus may require different settings for optimal outcomes. It is strongly recommended to:

  • Test Individually: Always perform tests on a small video sample before batch-processing your entire collection. This helps ensure that the settings chosen suit the specific video content.
  • Check Compatibility: Ensure that your hardware and software are compatible with the tasks you intend to perform, especially for resource-intensive processes like 4K upscaling.
  • Stay Updated: Keep your software and drivers updated. Tools and SDKs like NVIDIA's MAXINE VideoEffects are regularly updated, and newer versions may offer improved performance or additional features.
  • Consult Documentation: Always refer to the official documentation for the most accurate and up-to-date information regarding capabilities, limitations, and best practices.

Additional Note on Resolution and Upscaling:​

Most specialized filters, including noise and artefact reduction, support resolutions up to 1080p. When attempting to upscale to 4K, it's essential to understand that these filters may first upscale the video to 1080p using the particular filter and then perform additional upscaling to reach 4K. The hardware capabilities or the NVENC software typically determine this secondary upscaling step beyond 1080p.

Keep in mind:

  • Intermediate Upscaling: The process might involve an intermediate step at 1080p, which could affect the final quality, especially if the original video is of a much lower resolution.
  • Hardware and Software Limits: The effectiveness and quality of upscaling to 4K heavily depend on the hardware (GPU capabilities) and the settings/configuration of the NVENC encoder or other software tools you use.
  • Quality Variability: As with all upscaling, increasing resolution, especially to something as high as 4K, can introduce variability in quality. Details might not be as sharp or accurate as native 4K content, and results can vary widely based on the source material.
Therefore, when aiming to upscale to 4K, conducting individual tests with your specific videos is crucial to understanding how the upscaling process affects them. Adjust settings based on the initial results and consult any available documentation or forums for guidance on best practices for your particular hardware and software setup.

By proceeding with video processing, you acknowledge the inherent variability and commit to personal verification of settings and outcomes.
 
A refined example demonstrates the previously mentioned NVVFX resize filter, illustrating how to enhance your videos, particularly upgrading from 720p to 1080p.

Code:
--avhw
--codec hevc
--multipass 2pass-full
--output-res -4x1080
--qp-init 20:23:25
--qp-min 18:21:23
--qp-max 22:25:27
--output-depth 10
--lookahead 32
--bframes 5
--ref 8
--bref-mode each
--multiref-l1 3
--multiref-l0 3
--mv-precision Q-pel
--pic-struct
--split-enc auto
--vpp-deband
--audio-copy
--chapter-copy
--vpp-resize algo=nvvfx-superres,superres-mode=0
--colormatrix auto
--colorprim auto
--transfer auto

Please be aware that while you can tailor the settings to your needs or preferences, the final quality of the output will invariably depend on these adjustments.
Therefore, reviewing the encoded video is essential to ensure it meets your expectations.
 
Hello everyone,

I created this new topic to share some " basic scripts" to compress videos already on your PC.
The scripts are mostly for Anime/Cartoon but can also be used for normal Movies and Series.
Kindly note that you might need to adjust certain settings of the scripts to your preference, the scripts provided here are for your reference.
Please be advised that all scripts use HEVC - 10 bit - if possible. Scripts for H.264 might follow.

This topic is mainly for Intel iGPU dGPU and Nvidia GPUs.
Due to AMD drivers and related encoding issues, please take caution when using them.

At this point, I would like to thank
@0x0x0x0x0 providing the idea with the intel "high" CQP settings and for Intel encoding testing.
@cartman0208 and @DeepSpace for testing some of the encodings.
@Ch3vr0n for providing NVencC hardware readouts of the RTX 4 series.

Let's proceed

Needed for Intel:
Rigayas Qsvcenc and latest drivers as well as a capable Intel iGPU or dGPU
The latest version can be found here:
Code:
 https://github.com/rigaya/QSVEnc/releases
Please download and extract into a folder of your choice and remember the location.

Needed for Nvidia:
Rigayas NVencC and latest drivers as well as a capable Nvidia GPU
The latest version can be found here:
Code:
 https://github.com/rigaya/NVEnc/releases
Please download and extract into a folder of your choice and remember the location.

Needed for AMD:
Rigayas VCEEnc and latest drivers as well as a capable AMD GPU
The latest version can be found here:
Code:
 https://github.com/rigaya/VCEEnc/releases
Please download and extract into a folder of your choice and remember the location.


For all scripts, please copy the text 1:1 and only change things for which you know what they do, or if you like to play with different settings.
Create a new TXT file for each script in the same folder as the extracted encoder.
For example, if you extracted QSVEncC to "D:\Encoder\QSVEncC\" the script should be saved there too.
Give each script a different name.


How to run the scripts?
After all the scripts you need have been stored in the folder and with separate naming, you can either create a batch file or run the command from the command line.

Run from the command line:
Go into the folder with the videos you want to convert and open a command line, ensure that the output folder exists and adjust the below example accordingly

Code:
for %i in (*.mp4) do "E:\rigaya\NVEncC\NVEncC64.exe" -i "%i" --sub-source "%~dpni.srt" --option-file "E:\rigaya\NVEncC\example.txt" -o "F:\Re-encode\%~ni.mkv"

For a batch file:
Create a new text document.
Rename it with a .bat extension, e.g., EncodeVideosWithSubtitles.bat.
Right-click on the .bat file and select 'Edit', which should open the file in Notepad or another text editor.

Paste the following script:
Code:
@echo off
cd %~dp0
for %%i in (*.mp4) do (
    "E:\rigaya\NVEncC\NVEncC64.exe" -i "%%i" --sub-source "%%~dpni.en-us.srt" --option-file "E:\rigaya\NVEncC\example.txt" -o "F:\REencode\%%~ni.mkv"
)
pause

%~dp0 sets the current directory to where the batch file resides.
In a batch script, you must use double per cent signs %% instead of a single % for loop variables.
The pause command at the end will keep the command window open after processing so you can see any errors or messages.

To use the script:

Place the .bat file in the directory containing your MP4 videos and subtitle files.
Double-click the .bat file to run it.
The script will process each MP4 file, encode it using the settings in example.txt, and mux in the subtitles, saving the result in the F:\Re-encode directory.

Please note that you need to adjust the subtitle info accordingly to the subtitle you have in your folder.
You can also force a subtitle and create metadata for example:
Code:
--sub-source "%%~dpni.en-us.srt:disposition=forced;metadata=language=eng"


Disclaimer:

While I have dedicated a significant amount of time and effort to test everything detailed in this post, I cannot guarantee that there are no mistakes.
Human error is always a possibility, and this guide is no exception.
If you find any inaccuracies or errors, please kindly bring them to my attention.
I'm committed to rectifying any issues based on your feedback.
I genuinely appreciate constructive comments and suggestions that can help improve this guide further.
What needs to be entered here?
The following error: H.265/HEVC encoding is not supported on current platform.

Is another script necessary?
for %%i in (*.mp4) do (
 
Last edited:
What needs to be entered here?
Nothing ... the last character is an opening bracket ... between that and the closing bracket is the command that gets executed for as many times as *.mp4 files are in the folder ....
In this case ... every mp4 file gets reencoded to mkv ....
 
Nothing ... the last character is an opening bracket ... between that and the closing bracket is the command that gets executed for as many times as *.mp4 files are in the folder ....
In this case ... every mp4 file gets reencoded to mkv ....
The following error: H.265/HEVC encoding is not supported on current platform.

Is another script necessary?
How can I run the script without subtitles?
 
That thing is around 10 years old ... you should not bother doing hardware encodes with it...
 
That thing is around 10 years old ... you should not bother doing hardware encodes with it...
Thanks for your help

Unfortunately, VCE encoding only works on HD7xxx onwards and HEVC with 10-bit only on RX5xxx onwards.
See here: https://github.com/rigaya/VCEEnc#supported-hw-encode-codecs

The lack of HEVC b-frames support is the biggest drawback in AMD. Only specific models support b-frames in h.264 and are limited to a maximum of 3 frames.
The encoding speed for h.264 is very slow compared to HEVC or AV1 on newer cards.
When it comes to encoding, the quality is crucial. At higher bitrates, it may not be as noticeable. However, when the bitrates are lower, artefacts such as blocks are visible, especially with AMD encoding. I tested this with the AMD Ryzen™ 5 5600G's APU and the RX 6700 XT and RX 7600.

As per my experience, the Intel Arc A series provides the best encoding quality, tested with the A750 and A770. I haven't tested the Pro series yet.
The Arc A supports 16 b-frames in h.264 and HEVC and can compress not only anime at superb quality but also with a very low file size.
Both of these formats encode at a very fast speed.

The next item on the list is Nvidia. I have tested several GPUs, including the 1660ti, 2060, 3060, and 3080. Both HEVC and H.264 support up to 5 frames for b-frames.
The encoding speed for all of them is the same. The newer RTX4xxxx series has two encoding engines on specific models that can speed up the encoding process.
However, the b-frame support remains at 5 frames.


What are B-frames?​

B-frames, or Bi-directional frames, are video frames that increase video compression efficiency. They do this by referencing the previous frames (P-frames or I-frames) and the upcoming frames in the video sequence. This differs from I-frames (Intra-coded frames) that are self-contained and P-frames (Predicted frames) that only reference previous frames.

Why are B-frames Better than No B-frames?​

  1. Efficient Compression: B-frames can store only the differences from the frames before and after them, leading to more efficient storage and bandwidth use. This means a smaller file size for the same quality of video.
  2. Improved Quality: By referencing past and future frames, B-frames can more accurately predict and represent motion and changes in the scene, leading to better video quality at lower bitrates.
  3. Flexibility: B-frames add flexibility in how a video is compressed, allowing for better optimization between file size and quality.

Impact of Different Numbers of B-frames (3, 5, 16)​

  1. 3 B-frames:
    • Size: Moderate reduction in file size compared to no B-frames.
    • Quality: Noticeable improvement in quality, especially in scenes with moderate motion.
  2. 5 B-frames:
    • Size: Further reduction in file size.
    • Quality: Better quality in complex scenes with more motion.
  3. 16 B-frames:
    • Size: Maximum reduction in file size among these options.
    • Quality: Potentially the best quality, especially beneficial for high-motion and complex scenes.
 
An example is Big Buck Bunny 1080p encoded with NVIDIA RTX 3080 and Intel ARC A770.
You can download the file here. Its 691MB: http://download.blender.org/peach/bigbuckbunny_movies/
Filename:
Code:
big_buck_bunny_1080p_h264.mov

Nvidia settings:
Code:
--avhw
--codec hevc
--mv-precision Q-pel
--audio-copy
--qp-init 20:23:25
--qp-min 18:21:23
--qp-max 22:25:27
--output-depth 10
--lookahead 32
--bframes 5
--ref 8
--bref-mode each
--multiref-l1 3
--multiref-l0 3
--mv-precision Q-pel
--pic-struct
--split-enc auto
--vpp-deband
--chapter-copy

Result:
Code:
encoded 14315 frames, 326.99 fps, 3311.81 kbps, 235.48 MB
encode time 0:00:43, CPU: 0.7%, GPU: 0.4%, VE: 96.9%, VD: 43.8%, GPUClock: 1963MHz, VEClock: 1724MHz
frame type IDR   137
frame type I     137,  avgQP  19.67,  total size   21.63 MB
frame type P    2982,  avgQP  21.31,  total size  107.03 MB
frame type B   11196,  avgQP  23.30,  total size  106.82 MB

Total filesize after encoding: 266 MB

And here with the Intel Arc A770:
Setting:
Code:
--avhw
-c hevc
-u best
--profile main10
--cqp 34:34:36
--i-adapt
--b-adapt
--scenario-info archive
--open-gop
--bframes 16
--output-depth 10
--pic-struct
--hevc-gpb
--vpp-deband
--chapter-copy

Result:
Code:
encoded 14315 frames, 279.62 fps, 2065.53 kbps, 146.87 MB
encode time 0:00:51, CPU: 0.6%, GPU: 9.9%, VD: 97.9%
frame type IDR     1
frame type I      60,  total size   8.09 MB
frame type P     836,  total size  54.04 MB
frame type B   13419,  total size  84.74 MB

Total file size after encoding: 156 MB


Please note that this is an example of how it could look.
 
Understanding the Difference Between QP and CQP Encoding Settings

When discussing video encoding settings, particularly in the context of GPU encoding, you may encounter the terms QP (Quantization Parameter) and CQP (Constant Quantization Parameter). Both are related to video compression quality, but they function differently.

  1. QP (Quantization Parameter) Settings:
    • --qp-init 20:23:25: This setting specifies the initial QP values for I, P, and B frames. The numbers represent the quantization levels for different types of frames in the video. A lower QP value generally means higher quality and larger file size, while a higher QP value results in lower quality and smaller file size.
    • --qp-min 18:21:23 and --qp-max 22:25:27: These settings define the minimum and maximum QP values for I, P, and B frames. They set boundaries on how much the QP value can vary, allowing for some level of quality control and file size management.
  2. CQP (Constant Quantization Parameter) Setting:
    • --cqp 34:34:36: This is a simpler approach where a constant QP value is used throughout the video. The numbers again represent the QP values for I, P, and B frames. Unlike the variable QP settings, CQP maintains a consistent quality.
Why Different GPU Manufacturers Offer Different Encoding Properties:

The availability of certain encoding properties, like QP and CQP, varies among GPU manufacturers due to several factors:

  • Hardware Design: Different GPUs are built with varying architectures and capabilities. This inherent design difference dictates what kind of encoding features and optimizations can be supported.
  • Target Audience: Manufacturers often tailor their products to specific market segments. For instance, a GPU designed for gaming might prioritize different features than one intended for professional video editing.
  • Proprietary Technologies: Some manufacturers develop unique technologies to differentiate their products. These proprietary solutions can lead to variations in supported encoding properties.
  • Software and Driver Support: The software and drivers provided by the manufacturer also play a crucial role in determining the available encoding features. These are often updated and improved over time, adding or refining capabilities.
To sum up, QP and CQP are both involved in quantization during video encoding, but they have different approaches. QP allows for more flexible adjustments, whereas CQP maintains a constant level. The differences in encoding properties across various GPUs can be attributed to diverse hardware designs, target markets, proprietary technologies, and software support.


Why Anime and Cartoons Compress Better Than Live-Action Content

Video compression favors anime and cartoons over live-action due to content nature and image characteristics.

  1. Simpler Color Palettes and Fewer Details:
    • Anime and cartoons often have simpler and more consistent colour palettes when compared to the various colours and shades used in live-action footage. This consistency in colors makes it easier for compression algorithms to reduce the file size, without considerably affecting the visual quality.
    • The lack of complex textures and fine gradients in animated content makes it easier to compress, unlike live-action footage which often contains intricate backgrounds and lighting variations that require more data to represent accurately.
  2. Less Motion and Camera Noise:
    • Animated content typically involves fewer motion and scene changes than live-action footage, making it more compression-friendly.
    • Live-action footage often contains camera noise, grain, and other artefacts, particularly in low-light conditions or when using specific film stocks. These elements make the image more intricate, making it difficult to compress efficiently. On the other hand, animation usually doesn't have these types of noise, resulting in clearer images that are easier to compress.

Exceptions to the Rule:

However, there are exceptions where anime or cartoons might not compress as efficiently:

  • Highly Detailed Animation: Some modern anime and high-budget cartoons feature intricate details, complex shading, and elaborate backgrounds which can make the content more challenging to compress, similar to live-action footage.
  • Intentional Artistic Effects: Adding artistic effects like grain, noise, or texturing to animated content can make it less compressible by introducing complexity and variability similar to live-action footage.
  • Rapid Motion and Scene Changes: Certain animated sequences with fast motion and quick cuts pose compression challenges, like in live-action scenes.
To sum up, animated content such as anime and cartoons generally compress more efficiently than live-action content. This is due to their simpler color palettes, lack of fine details, and cleaner images. However, there are exceptions to this rule. For instance, highly detailed animations, artistic effects like grain or noise, and rapid motion sequences can reduce the compression advantage of animated content.
 
Back
Top