Changes between Version 2 and Version 3 of Hardware/QuickSync


Ignore:
Timestamp:
Dec 20, 2018, 12:36:26 PM (9 months ago)
Author:
lizhong1008
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Hardware/QuickSync

    v2 v3  
    100100
    101101[=#i965] All of the user source code is available, but it includes proprietary blobs of compiled GPU code.  Since the complete human-readable source is not available, this certainly renders it GPL-incompatible and is likely to cause issues with other copyleft licences.  Using the libva dynamic-loading shim mostly sidesteps this, and therefore is encouraged.
     102
     103
     104
     105== Full Examples ==
     106
     107
     108=== Decode-only ===
     109
     110Check supported qsv decoder list
     111{{{
     112ffmpeg -decoders|grep qsv
     113}}}
     114
     115H264 video decode and download as yuv420p raw file
     116{{{
     117ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf hwdownload,format=nv12 -pix_fmt yuv420p output.yuv
     118}}}
     119
     120H264 video decode and display with sdl
     121{{{
     122ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf hwdownload,format=nv12 -pix_fmt yuv420p -f sdl -
     123}}}
     124
     125H264 video decode without output (this can be used as a crude benchmark of the decoder)
     126{{{
     127ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -f null -
     128}}}
     129
     130HEVC 10bit video decode and download as p010le yuv file
     131{{{
     132ffmpeg -hwaccel qsv -c:v hevc_qsv -load_plugin hevc_hw -i input.mp4 -vf hwdownload,format=p010 -pix_fmt p010le output.yuv
     133}}}
     134
     135
     136=== Encode-only ===
     137
     138Check supported qsv decoder list
     139{{{
     140ffmpeg -encoders|grep qsv
     141}}}
     142
     143Check private option list of h264 encoder
     144{{{
     145ffmpeg -h encoder=h264_qsv
     146}}}
     147
     148Encode a 1080p raw yuv input as H264 with 5Mbps using VBR mode
     149{{{
     150ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 -i input.yuv -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -b:v 5M output.mp4
     151}}}
     152
     153Encode a 1080p p010le raw yuv input as HEVC main10 profile (supported since KabyLake platform)
     154{{{
     155ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -v verbose -f rawvideo -video_size 1920x1080 -pix_fmt p010le -i input.yuv -an \
     156-vf 'hwupload=extra_hw_frames=64,format=qsv' -c:v hevc_qsv -profile:v main10 output.mp4
     157}}}
     158
     159
     160=== Transcode ===
     161
     162Software decode + h264 qsv encode with 5Mbps using CBR mode
     163{{{
     164ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -i input.mp4 -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -b:v 5M -maxrate 5M output.mp4
     165}}}
     166
     167Software decode + h264 qsv encode with CQP mode
     168{{{
     169ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -i input.mp4 -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -q 25 output.mp4
     170}}}
     171
     172H264 qsv decode + h264 qsv encode with 5Mbps using VBR && Look_ahead mode (look_ahead may not be supported on some platforms)
     173{{{
     174ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -c:v h264_qsv -b:v 5M -look_ahead 1 output.mp4
     175}}}
     176
     177As previous, but use ICQ mode (which is similar to crf mode of x264)
     178{{{
     179ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -c:v h264_qsv -global_quality 25 output.mp4
     180}}}
     181
     182As previous, but use ICQ && Look_ahead mode
     183{{{
     184ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -c:v h264_qsv -global_quality 25 -look_ahead 1 output.mp4
     185}}}
     186
     187Hevc qsv decode + qsv scaling to 1080p@60fps + h264 qsv encode
     188{{{
     189ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.mp4 -vf 'vpp_qsv=framerate=60,scale_qsv=w=1920:h=1080' -c:v h264_qsv out.mp4
     190}}}
     191
     192Hevc qsv decode + qsv scaling to 1080p@60fps and color space convert from nv12 to rgb32 + output as sdl
     193{{{
     194ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.mp4 -vf 'vpp_qsv=framerate=60,scale_qsv=w=1920:h=1080:format=rgb32, hwdownload,format=rgb32' -f sdl -
     195}}}
     196
     1971:N transcoding: (MFE will be enabled by default if MSDK can support it)
     198{{{
     199   ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 \
     200        -filter_complex "split=2[s1][s2]; [s1]scale_qsv=1280:720[o1];[s2]scale_qsv=960:540[o2]" \
     201        -map [o1] -c:v h264_qsv -b:v 3200k 3200a.mp4 \
     202        -map [o2] -c:v h264_qsv -b:v 1750k -f 1750a.264
     203}}}
     204
     205M:N transcoding
     206
     207{{{
     208   ffmpeg -hwaccel qsv -c:v h264_qsv -i input1.mp4 -hwaccel qsv -c:v h264_qsv -i input2.mp4 \
     209     -filter_complex '[0:v]split=2[out1][out2],[1:v]split=2[out3][out4]' \
     210     -map '[out1]' -c:v h264_qsv  output1.mp4  -map '[out2]' -c:v h264_qsv output2.mp4 \
     211     -map '[out3]' -c:v h264_qsv output3.mp4 -map '[out4]' -c:v h264_qsv output4.mp4
     212}}}
     213
     214
     215
     216=== Hybrid transcode ===
     217
     218It is also possible to use "vaapi decode + vaapi scaling + qsv encode" (available on Linux platform)
     219{{{
     220ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -vf 'scale_vaapi=1280:720,hwmap=derive_device=qsv,format=qsv' -c:v h264_qsv out.mp4
     221}}}
     222
     223Or use "dxva decode + qsv scaling + qsv encode" (available on Windows)
     224{{{
     225ffmpeg -hwaccel dxva2 -hwaccel_output_format dxva2_vld -i input.mp4 -vf 'scale_vaapi=1280:720,hwmap=derive_device=qsv,format=qsv' -c:v h264_qsv out.mp4
     226}}}