koala
Active Member
The question we all want to know is:
What encoder and which encoder setting should I use for streaming/for recording?
and:
If I use a hardware encoder, does the quality suffer?
There are so many configuration options and there is so many different hardware available, so this is always very difficult to answer.
So I made a autohotkey script and created recordings of literally every combination of every encoder setting. Then I compared the quality of the resulting videos to the original lossless recording. The first level of comparison was made with ffmpeg (method see down below).
This is the result for OBS simple settings for streaming. I did the tests on 2 machines:
- i5-3570k with GTX 670 (QSV_IvyBridge with NVENC_Kepler)
- i7-6700k with GTX 1070 (QSV_Skylake with NVENC_Pascal)
- [no AMD-VCE, since I don't own one.] see post #25 for a comparison that includes VCE
Bitrates tested: 2000, 2500, 3500
Resolutions tested: 1280x720 (30 and 60 fps), 1920x1080 (30 fps)
The report only includes the one preset that gives the best quality for each encoder. This was done to not clutter the report with settings one will not use anyway. However, I tested all presets (for example for NVENC such as: "Low-Latency", "Low-Latency High Performance").
Excel-Sheet
From this computer-generated rating with mainly the mse as criteria, you may come to the conclusion that NVENC is on par with x264 preset=veryfast (the default in OBS), or even a bit better, but unfortunately it isn't. At least for high motion scenes.
Download the bitrate 2500 x264 and nvenc video and compare them with your eyes, and you will see more details in the second half of the video with x264 than with NVENC. I was mislead by the mse numbers myself, but I cannot deny the x264 video definitely shows a bit more more detail in high motion parts. Low motion looks the same with both.
Still correct is the ordering of NVENC and Quicksync: NVENC provides better visual quality than Quicksync. Quicksync on Skylake is better than on IvyBridge, but NVENC is still a bit better than both.
So I recommend the encoders in this order:
rating:
You can download the encoded videos here and do a visual comparison yourself:
http://www.wombaz.de/uploads/2016/11/obs-codec-test/
A convenient table for visual comparison between codecs is in this post:
https://obsproject.com/forum/posts/252221
If you do extensive visual comparison, please don't watch the videos though the browser but do a "Save as" and download them to your disk. Then watch them with your media player locally.
In the directories included are "analyis2.txt" files, which contain the machine-generated ratings from every single test.
I also made recordings with advanced settings. But the analysis is extremely difficult to interpret, because videos with varying encoding quality (x264 with crf, Quicksync with icq) inherently score worse than videos with constant quality (CQP with hardware encoders), although they don't look worse to the eyes of a human being.
But even with bitrate-based streams, the comparison method can only be a rough estimate. The true judge can only be the human eye. For example, in another thread, I falsely claimed NVENC is better than x264, because the mse comparison said this (I apologize, @Harold). For quality-based recordings it is even more difficult - I am really lost here.
I would like to make a guide/resource from this, but how extensive should that be? It could be as short as "x264 > nvenc > quicksync" and as long as this post.
What encoder and which encoder setting should I use for streaming/for recording?
and:
If I use a hardware encoder, does the quality suffer?
There are so many configuration options and there is so many different hardware available, so this is always very difficult to answer.
So I made a autohotkey script and created recordings of literally every combination of every encoder setting. Then I compared the quality of the resulting videos to the original lossless recording. The first level of comparison was made with ffmpeg (method see down below).
This is the result for OBS simple settings for streaming. I did the tests on 2 machines:
- i5-3570k with GTX 670 (QSV_IvyBridge with NVENC_Kepler)
- i7-6700k with GTX 1070 (QSV_Skylake with NVENC_Pascal)
- [no AMD-VCE, since I don't own one.] see post #25 for a comparison that includes VCE
Bitrates tested: 2000, 2500, 3500
Resolutions tested: 1280x720 (30 and 60 fps), 1920x1080 (30 fps)
The report only includes the one preset that gives the best quality for each encoder. This was done to not clutter the report with settings one will not use anyway. However, I tested all presets (for example for NVENC such as: "Low-Latency", "Low-Latency High Performance").
Excel-Sheet
From this computer-generated rating with mainly the mse as criteria, you may come to the conclusion that NVENC is on par with x264 preset=veryfast (the default in OBS), or even a bit better, but unfortunately it isn't. At least for high motion scenes.
Download the bitrate 2500 x264 and nvenc video and compare them with your eyes, and you will see more details in the second half of the video with x264 than with NVENC. I was mislead by the mse numbers myself, but I cannot deny the x264 video definitely shows a bit more more detail in high motion parts. Low motion looks the same with both.
Still correct is the ordering of NVENC and Quicksync: NVENC provides better visual quality than Quicksync. Quicksync on Skylake is better than on IvyBridge, but NVENC is still a bit better than both.
So I recommend the encoders in this order:
- if your computer is able to encode x264 preset=veryfast or better while running your game, use this. This will interfere with your game and your stream, if your CPU is not powerful enough. Only desktop i5 and i7 processors are probably able to encode better than veryfast while a CPU-demanding game is run in parallel.
- if you have NVENC available, use NVENC with preset=highquality. This will not interfere with your game at all.
- if you have Quicksync available, use Quicksync with preset=balanced. This will not interfere with your game at all.
- don't use x264 preset=superfast or ultrafast for streaming, as they produce way worse output than even Quicksync.
rating:
x264 faster = 80/100
x264 veryfast = 75/100
nvenc highquality = 70/100
quicksync balanced = 60/100
x264 superfast = 40/100
x264 ultrafast = 30/100
x264 veryfast = 75/100
nvenc highquality = 70/100
quicksync balanced = 60/100
x264 superfast = 40/100
x264 ultrafast = 30/100
***
You can download the encoded videos here and do a visual comparison yourself:
http://www.wombaz.de/uploads/2016/11/obs-codec-test/
A convenient table for visual comparison between codecs is in this post:
https://obsproject.com/forum/posts/252221
If you do extensive visual comparison, please don't watch the videos though the browser but do a "Save as" and download them to your disk. Then watch them with your media player locally.
In the directories included are "analyis2.txt" files, which contain the machine-generated ratings from every single test.
***
The method:
- I created a 2 minute long reference video of my favorite game. 2560x1440p60 lossless recording with OBS (simple output mode->"Lossless Quality, Tremendously Large File Size"). The video includes 2 low motion scenes and 2 high motion scenes, each about the same length.
- for the test of 1280x720p30 create a 1280x720p30 reference video by downscaling the original reference video to 1280x720p30 with ffmpeg. Output codec again lossless (video codec utvideo, same as OBS uses)
- pick 2 reference frames, one from near the start of the video and one from near the end. Record the frame numbers.
- in OBS, create a new scene with one vlc video source and add the 1280x720p30 reference video
- In OBS, set base and output resolution to 1280x720 and frame rate to 30
- now create a bunch of recordings of the reference video by permutating every output setting. A autohotkey script was used for this.
- search for the 2 reference frames and record the frame numbers. This is done with ffmpeg and the psnr filter.
- to see by how many frames the recorded video is shifted in relation to the reference video, get the difference between the frame numbers of the high motion reference frame. For example, if the reference frame is number 2400 in the reference video but 2420 in the recorded video, the recorded video is offset by 20 frames and any frame-by-frame comparison must start these 20 frames later.
- compare the reference video and the recorded video and take the offset into account. "compare" means use the psnr filter of ffmpeg. Save the psnr statistics file. This way, each original frame is compared with its corresponding encoded frame and we determine the mse ("mean square error") of each frame. The lower the mse, the better the encoded frame. The better the mse of all frames of a video, the better is the quality of a video.
- now we have all mse comparisons. For each video, we have a list of the mse of all frames of this video.
- To order our videos by quality, compare the mse list of each video with the mse list of each other video.
- a comparison of 2 videos looks like this: for each pair of frames (one frame from video 1 and one frame from video 2), look which has lower mse. Count the frames which have lower mse. The video that has more frames with lower mse is declared "better" than the other video.
- by using the this comparison method, it is possible to sort all videos by some sort of visual quality. It doesn't sort by average mse of each video but by answering the question: "which video has more frames that are better than the rest of the videos?"
***
I also made recordings with advanced settings. But the analysis is extremely difficult to interpret, because videos with varying encoding quality (x264 with crf, Quicksync with icq) inherently score worse than videos with constant quality (CQP with hardware encoders), although they don't look worse to the eyes of a human being.
But even with bitrate-based streams, the comparison method can only be a rough estimate. The true judge can only be the human eye. For example, in another thread, I falsely claimed NVENC is better than x264, because the mse comparison said this (I apologize, @Harold). For quality-based recordings it is even more difficult - I am really lost here.
I would like to make a guide/resource from this, but how extensive should that be? It could be as short as "x264 > nvenc > quicksync" and as long as this post.
Last edited: