Skip to content

Instantly share code, notes, and snippets.

@nico-lab
Created September 19, 2024 12:36
Show Gist options
  • Save nico-lab/b0128d195c985d72f4ecde153cd52021 to your computer and use it in GitHub Desktop.
Save nico-lab/b0128d195c985d72f4ecde153cd52021 to your computer and use it in GitHub Desktop.
ffmpeg -h encoder=h264_vulkan
Encoder h264_vulkan [H.264/AVC (Vulkan)]:
General capabilities: dr1 delay hardware
Threading capabilities: none
Supported hardware devices: vulkan
Supported pixel formats: vulkan
h264_vulkan AVOptions:
-idr_interval <int> E..V....... Distance (in I-frames) between key frames (from 0 to INT_MAX) (default 0)
-b_depth <int> E..V....... Maximum B-frame reference depth (from 1 to INT_MAX) (default 1)
-async_depth <int> E..V....... Maximum processing parallelism. Increase this to improve single channel performance. (from 1 to 64) (default 2)
-qp <int> E..V....... Use an explicit constant quantizer for the whole stream (from -1 to 255) (default -1)
-quality <int> E..V....... Set encode quality (trades off against speed, higher is faster) (from 0 to INT_MAX) (default 0)
-rc_mode <int> E..V....... Select rate control type (from 0 to UINT32_MAX) (default auto)
auto 4294967295 E..V....... Choose mode automatically based on parameters
driver 0 E..V....... Driver-specific rate control
cqp 1 E..V....... Constant quantizer mode
cbr 2 E..V....... Constant bitrate mode
vbr 4 E..V....... Variable bitrate mode
-tune <int> E..V....... Select tuning type (from 0 to INT_MAX) (default default)
default 0 E..V....... Default tuning
hq 1 E..V....... High quality tuning
ll 2 E..V....... Low-latency tuning
ull 3 E..V....... Ultra low-latency tuning
lossless 4 E..V....... Lossless mode tuning
-usage <flags> E..V....... Select usage type (default 0)
default E..V....... Default optimizations
transcode E..V....... Optimize for transcoding
stream E..V....... Optimize for streaming
record E..V....... Optimize for offline recording
conference E..V....... Optimize for teleconferencing
-content <flags> E..V....... Select content type (default 0)
default E..V....... Default content
camera E..V....... Camera footage
desktop E..V....... Screen recording
rendered E..V....... Game or 3D content
-profile <int> E..V....... Set profile (profile_idc and constraint_set*_flag) (from -99 to 65535) (default -99)
constrained_baseline 578 E..V.......
main 77 E..V.......
high 100 E..V.......
high444p 110 E..V.......
-level <int> E..V....... Set level (level_idc) (from -99 to 255) (default -99)
1 10 E..V.......
1.1 11 E..V.......
1.2 12 E..V.......
1.3 13 E..V.......
2 20 E..V.......
2.1 21 E..V.......
2.2 22 E..V.......
3 30 E..V.......
3.1 31 E..V.......
3.2 32 E..V.......
4 40 E..V.......
4.1 41 E..V.......
4.2 42 E..V.......
5 50 E..V.......
5.1 51 E..V.......
5.2 52 E..V.......
6 60 E..V.......
6.1 61 E..V.......
6.2 62 E..V.......
-coder <int> E..V....... Entropy coder type (from 0 to 1) (default cabac)
cabac 1 E..V.......
vlc 0 E..V.......
-units <flags> E..V....... Set units to include (default aud+identifier+timing+recovery+a53_cc)
aud E..V....... Include AUD units
identifier E..V....... Include encoder version identifier
timing E..V....... Include timing parameters (buffering_period and pic_timing)
recovery E..V....... Include recovery points where appropriate
a53_cc E..V....... Include A/53 caption data
@brauliobo
Copy link

can you share one example? I'm only getting errors

 bhavapower ➜  media-downloader-bot git:(main) ✗  nice ffmpeg -y -threads 16 -loglevel error  -i Tiny\ Spine\ LOUD\ CRUNCHES\ \#chiropractor\ \#asmr\ \#shorts\ \[tQzuyQBZkF4\].webm  -c:v h264_vulkan -c:a libopus -b:a 61k  out.mp4   
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
[vf#0:0 @ 0x644628aef000] Error reinitializing filters!
[vf#0:0 @ 0x644628aef000] Task finished with error code: -38 (Function not implemented)                                                                                
[vf#0:0 @ 0x644628aef000] Terminating thread with return code -38 (Function not implemented)                                                                           
[vost#0:0/h264_vulkan @ 0x644628b25d80] Could not open encoder before EOF                                                                                              
[vost#0:0/h264_vulkan @ 0x644628b25d80] Task finished with error code: -22 (Invalid argument)                                                                          
[vost#0:0/h264_vulkan @ 0x644628b25d80] Terminating thread with return code -22 (Invalid argument)                                                                     
[out#0/mp4 @ 0x644628aee5c0] Nothing was written into output file, because at least one of its streams received no packets.                                            

bhavapower ➜  media-downloader-bot git:(main) ✗  nice ffmpeg -y -threads 16 -loglevel error  -i Tiny\ Spine\ LOUD\ CRUNCHES\ \#chiropractor\ \#asmr\ \#shorts\ \[tQzuyQBZkF4\].webm  -c:v h264_vulkan -quality=10 -c:a libopus -b:a 61k  out.mp4
Unrecognized option 'quality=10'.
Error splitting the argument list: Option not found  

@nico-lab
Copy link
Author

Sometimes the same command produces an error, sometimes it does not.
Keyframes can be specified with -force_key_frames
-hwaccel vulkan can be used for HW decoding assistance.

ffmpeg  -init_hw_device vulkan=vkdev:0 -filter_hw_device vkdev -f lavfi -i testsrc2 -t 10 -filter:v "format=nv12,hwupload" -c:v h264_vulkan -qp 20 -g 100 out.mp4
ffmpeg  -init_hw_device vulkan=vkdev:0 -filter_hw_device vkdev -f lavfi -i testsrc2 -t 10 -filter:v "format=nv12,hwupload" -c:v h264_vulkan -qp 20 -force_key_frames "expr:gte(t,n_forced*5)" out.mp4
ffmpeg -hwaccel vulkan -init_hw_device vulkan=vkdev:0 -filter_hw_device vkdev -i "h264.mp4" -filter:v "format=nv12,hwupload" -c:v h264_vulkan -qp 20 -g 100 -c:a copy out.mp4

https://trac.ffmpeg.org/ticket/11296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment