Good Day,
I am hoping someone could help me figure out the ffmpeg command to use Intel QuickSync Video for encoding files. I am about 5 hours into this and have unfortunately made very little progress. The default command of:
-i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset ultrafast -profile:v main -acodec aac "[DEST_FILE].mp4"
works with no issues. I have tried multiple variations of this including:
-i "[SOURCE_FILE]" -f mp4 -vcodec h264_qsv -preset ultrafast -profile:v main -acodec aac "[DEST_FILE].mp4"
-i "[SOURCE_FILE]" -f mp4 -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -b:v 5M -maxrate 5M -bufsize 5M -acodec aac "[DEST_FILE].mp4"
-i "[SOURCE_FILE]" -f mp4 -vcodec h264_qsv -preset ultrafast -profile:v main -acodec aac "[DEST_FILE].mp4"
-i "[SOURCE_FILE]" -f mp4 -init_hw_device qsv=hw -filter_hw_device hw -preset ultrafast -profile:v main -acodec aac "[DEST_FILE].mp4"
and multiple other variations. I can get nothing to work with the intel QSV encoder.
I have installed the intel OneAPI but this made no difference.
It sometimes looks like it is going to start as GPU usage will go to 100 (for about 3 seconds) then return to idle with no functional file being produced.
Can anyone assist in converting the original command to one that works with QSV?
Thanks!
+ Reply to Thread
Results 1 to 6 of 6
-
-
Here's a drag/drop batch file I sometimes use:
Code:"G:\program files\ffmpeg64\bin\ffmpeg.exe" -y -benchmark -init_hw_device qsv=hw -filter_hw_device hw -v verbose ^ -i %1 -pix_fmt nv12 ^ -load_plugin h264_hw -c:v h264_qsv -preset veryslow -global_quality 21 -look_ahead 1 -look_ahead_depth 30 ^ -profile:v high -level:v 4.2 -adaptive_b 1 -rdo 1 -g 30 -colorspace bt709 -color_range tv ^ -acodec copy ^ "%~dpn1.h264.qsv.mkv"
-
Maybe use QSVEnc instead.
ffmpeg has no 'ultrafast' for h264_qsv:
Code:ffmpeg -h encoder=h264_qsv
Code:Encoder h264_qsv [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration)]: General capabilities: delay hybrid Threading capabilities: none Supported hardware devices: qsv qsv qsv Supported pixel formats: nv12 qsv h264_qsv encoder AVOptions: -async_depth <int> E..V....... Maximum processing parallelism (from 1 to INT_MAX) (default 4) -preset <int> E..V....... (from 0 to 7) (default 0) veryfast 7 E..V....... faster 6 E..V....... fast 5 E..V....... medium 4 E..V....... slow 3 E..V....... slower 2 E..V....... veryslow 1 E..V....... -forced_idr <boolean> E..V....... Forcing I frames as IDR frames (default false) -low_power <boolean> E..V....... enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.) (default auto) -rdo <int> E..V....... Enable rate distortion optimization (from -1 to 1) (default -1) -max_frame_size <int> E..V....... Maximum encoded frame size in bytes (from -1 to INT_MAX) (default -1) -max_frame_size_i <int> E..V....... Maximum encoded I frame size in bytes (from -1 to INT_MAX) (default -1) -max_frame_size_p <int> E..V....... Maximum encoded P frame size in bytes (from -1 to INT_MAX) (default -1) -max_slice_size <int> E..V....... Maximum encoded slice size in bytes (from -1 to INT_MAX) (default -1) -bitrate_limit <int> E..V....... Toggle bitrate limitations (from -1 to 1) (default -1) -mbbrc <int> E..V....... MB level bitrate control (from -1 to 1) (default -1) -extbrc <int> E..V....... Extended bitrate control (from -1 to 1) (default -1) -adaptive_i <int> E..V....... Adaptive I-frame placement (from -1 to 1) (default -1) -adaptive_b <int> E..V....... Adaptive B-frame placement (from -1 to 1) (default -1) -p_strategy <int> E..V....... Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0). (from 0 to 2) (default 0) -b_strategy <int> E..V....... Strategy to choose between I/P/B-frames (from -1 to 1) (default -1) -dblk_idc <int> E..V....... This option disable deblocking. It has value in range 0~2. (from 0 to 2) (default 0) -low_delay_brc <boolean> E..V....... Allow to strictly obey avg frame size (default auto) -max_qp_i <int> E..V....... Maximum video quantizer scale for I frame (from -1 to 51) (default -1) -min_qp_i <int> E..V....... Minimum video quantizer scale for I frame (from -1 to 51) (default -1) -max_qp_p <int> E..V....... Maximum video quantizer scale for P frame (from -1 to 51) (default -1) -min_qp_p <int> E..V....... Minimum video quantizer scale for P frame (from -1 to 51) (default -1) -max_qp_b <int> E..V....... Maximum video quantizer scale for B frame (from -1 to 51) (default -1) -min_qp_b <int> E..V....... Minimum video quantizer scale for B frame (from -1 to 51) (default -1) -scenario <int> E..V....... A hint to encoder about the scenario for the encoding session (from 0 to 8) (default unknown) unknown 0 E..V....... displayremoting 1 E..V....... videoconference 2 E..V....... archive 3 E..V....... livestreaming 4 E..V....... cameracapture 5 E..V....... videosurveillance 6 E..V....... gamestreaming 7 E..V....... remotegaming 8 E..V....... -avbr_accuracy <int> E..V....... Accuracy of the AVBR ratecontrol (unit of tenth of percent) (from 0 to 65535) (default 0) -avbr_convergence <int> E..V....... Convergence of the AVBR ratecontrol (unit of 100 frames) (from 0 to 65535) (default 0) -skip_frame <int> E..V....... Allow frame skipping (from 0 to 3) (default no_skip) no_skip 0 E..V....... Frame skipping is disabled insert_dummy 1 E..V....... Encoder inserts into bitstream frame where all macroblocks are encoded as skipped insert_nothing 2 E..V....... Encoder inserts nothing into bitstream brc_only 3 E..V....... skip_frame metadata indicates the number of missed frames before the current frame -cavlc <boolean> E..V....... Enable CAVLC (default false) -vcm <boolean> E..V....... Use the video conferencing mode ratecontrol (default false) -idr_interval <int> E..V....... Distance (in I-frames) between IDR frames (from 0 to INT_MAX) (default 0) -pic_timing_sei <boolean> E..V....... Insert picture timing SEI with pic_struct_syntax element (default true) -single_sei_nal_unit <int> E..V....... Put all the SEI messages into one NALU (from -1 to 1) (default -1) -max_dec_frame_buffering <int> E..V....... Maximum number of frames buffered in the DPB (from 0 to 65535) (default 0) -look_ahead <boolean> E..V....... Use VBR algorithm with look ahead (default false) -look_ahead_depth <int> E..V....... Depth of look ahead in number frames (from 0 to 100) (default 0) -look_ahead_downsampling <int> E..V....... Downscaling factor for the frames saved for the lookahead analysis (from 0 to 3) (default unknown) unknown 0 E..V....... auto 0 E..V....... off 1 E..V....... 2x 2 E..V....... 4x 3 E..V....... -int_ref_type <int> E..V....... Intra refresh type. B frames should be set to 0. (from -1 to 65535) (default -1) none 0 E..V....... vertical 1 E..V....... horizontal 2 E..V....... slice 3 E..V....... -int_ref_cycle_size <int> E..V....... Number of frames in the intra refresh cycle (from -1 to 65535) (default -1) -int_ref_qp_delta <int> E..V....... QP difference for the refresh MBs (from -32768 to 32767) (default -32768) -recovery_point_sei <int> E..V....... Insert recovery point SEI messages (from -1 to 1) (default -1) -int_ref_cycle_dist <int> E..V....... Distance between the beginnings of the intra-refresh cycles in frames (from -1 to 32767) (default -1) -profile <int> E..V....... (from 0 to INT_MAX) (default unknown) unknown 0 E..V....... baseline 66 E..V....... main 77 E..V....... high 100 E..V....... -a53cc <boolean> E..V....... Use A53 Closed Captions (if available) (default true) -aud <boolean> E..V....... Insert the Access Unit Delimiter NAL (default false) -repeat_pps <boolean> E..V....... repeat pps for every frame (default false)
Last edited by Selur; 1st Jul 2023 at 11:35.
users currently on my ignore list: deadrats, Stears555, marcorocchini -
@OP
What kind of hardware are you running and what OS?
I have used quick sync for years, up to Ice Lake based cpu's, on Win 10 and Linux, via different utilities and while I generally like it, i have found odd quirks that will result in an encode failing.
Things like resolution, mod, driver versions, color space, can all cause an encode to fail with qsv that will work just fine with a software based encoder.
Similar Threads
-
FFmpeg command help
By Boxcart in forum Video ConversionReplies: 18Last Post: 12th Mar 2023, 12:32 -
ffmpeg 5.0 new syntax breaks scripts, especially QSV
By BartZLederman in forum User guidesReplies: 6Last Post: 29th Mar 2022, 13:39 -
Get the complete FFmpeg command line when using FFmpeg Batch Converter
By pascor in forum Newbie / General discussionsReplies: 8Last Post: 13th May 2021, 23:14 -
Need a command line for ffmpeg
By NTradd in forum Video ConversionReplies: 11Last Post: 14th Oct 2019, 11:25 -
ffmpeg command line help
By njscorpion in forum Newbie / General discussionsReplies: 2Last Post: 12th Jul 2019, 12:42