익명 03:16

How to encode to HEVC using ffmpeg with VAAPI in order to get good video quality...

How to encode to HEVC using ffmpeg with VAAPI in order to get good video quality? (at reasonable bitrates)

I want to encode many of my H264 videos to H265 video with reduced resolution (480p or something in this case, at most 720p) so they don't take too much space on the disk.

I've been trying to use Intel CPU's VAAPI hardware acceleration with the hevc_vaapi codec because H265 encoding in software is still pretty slow (on slower CPUs), and so far it works, but either the encoded video looks much worse than the source, or it takes up more space than the original, or both.

Has anyone managed to achieve good quality and reasonable bitrates as you would expect from HEVC video?

In my example this should of course be lower than the H264 source, otherwise it doesn't make any sense to re-encode. The H264 videos use between 1 - 1.5 Mbit/s mostly - so I am aiming at something below 1Mbit/s for HEVC in 480p, as libx265 gives me output of around 500 kbit/s with good visual quality with -crf 26 (or similar, and depending on the source of course - but software encoding is pretty slow)

The best option to use instead of constant bitrate mode for the hevc_vaapi codec seems to be using -qp 25 (or similar values) but this made it only a bit better, it still doesn't look really good...

I've read and tried the commands from the ffmpeg wiki for VAAPI (though they all use CBR mode there) but this didn't help too much as they use very high bitrates, which isn't really what HEVC is intended for (https://trac.ffmpeg.org/wiki/Hardware/VAAPI).

Does anyone know a solution for this - or possibly has the same problem?!

Is it possible to get good quality with reasonable bitrates when using VAAPI at all?

I'd also consider other possibilities to speed things up, but currently I just have this slow CPU with VAAPI support (qsv didn't work, if this is any better at all).



Top Answer/Comment:

Encoding large video files in a way that they do not need to much storage space is a very common problem. Depending on the content and the real original file, it can be quite difficult to find a good compromise between filesize and quality.

One option would be to go with the VideoTranscodingTools by Don Melton. Those are made for hardware accelerated transcoding of ripped DVDs and BluRays, but they work with other media files, like videos captured with a camcorder or your mobile phone. There is active support on GitHub, and occurring problems are mostly answered by the developer within a few days.

FWIW, the toolset made by Don Melton leverages FFmpeg at its core, i.e. in the end, your video file is passed to an FFmpeg executable with a dozen arguments that you never would choose by your own.

It works by detecting the quality of the input file (quality in means of bitrate, resolution and some other parameters) and then deciding on that basis how the output has to be encoded in order to ensure maximal portability while shrinking the file size and keeping as much of the original information as needed in order to retain the best possible picture.

In addition, it automatically detects what kind of hardware you run the tools on and selects the proper method of hardware acceleration.

Personal experience: My rather old laptop with an i5 processor from 2017 I think takes about 15 minutes to process a full 1.5h movie ripped from DVD, without any visual losses while compressing the input from about 6 gb to around 1.5 gb.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다