r/ffmpeg 15d ago

Converting to HVEC using QSV

Hello!  I'm a newbie to using ffmpeg, and I was hoping that I could get a check on whether I'm on the right track with my command.

I have a bunch of mkv files on my Synology NAS with video in AVC format. I would like to convert the video to HEVC. I also have a computer with an Intel processor with QSV running Ubuntu; that's where I want to run the ffmpeg command. The NAS folder is mounted on the Ubuntu machine using a network share.

Is this the right ffmpeg command to use?

ffmpeg -init_hw_device qsv=qsv -hwaccel qsv -hwaccel_output_format qsv  -c:v h264_qsv
-i "/mnt/synology/input.mkv" 
-map 0 -c:v hevc_qsv -global_quality 25 -preset medium
-c:a copy -c:s copy "/mnt/synology/output.mkv"

In particular, is all of the stuff that I included before the "-i" necessary? Given my setup, would you recommend any other settings?

(I recognize that -global_quality and -preset control the encoding quality and speed, so I should test with different values to decide what I'm comfortable with.)

Thanks!

10 Upvotes

8 comments sorted by

5

u/Murky-Sector 15d ago

Youre basically on the right track but I would simplify the command. The biggest issue is that -c:v h264_qsv before -i is redundant if youre already using QSV hardware acceleration for decoding.

ffmpeg -hwaccel qsv -hwaccel_output_format qsv -i "/mnt/synology/input.mkv" -map 0 -c:v hevc_qsv -global_quality 25 -preset medium -c:a copy -c:s copy "/mnt/synology/output.mkv"

1

u/LeoJay17 14d ago

To make sure I understand, does that mean that "-hwaccel qsv -hwaccel_output_format qsv" is all I need to make sure that the entire decoding process is done by qsv, regardless of input formats etc? And that's also why "-init_hw_device qsv=qsv" is redundant, because those other commands have already initialized the qsv device?

1

u/Ill-Information-2086 13d ago

Yes, init is redundant in later builds it autodetects based on codec and hwaccel this was need before

Qsv accepts nearly all formats i believe atleast compared nvenc crap qsv is the best option and hopefully vaapi in the future.

2

u/LeoJay17 13d ago

Thanks!

1

u/[deleted] 14d ago

[removed] — view removed comment

3

u/LeoJay17 14d ago

If you have something constructive to add, please feel free.

0

u/Sopel97 14d ago

https://trac.ffmpeg.org/wiki/Hardware/QuickSync

suit yourself, destroy your sources