-
Notifications
You must be signed in to change notification settings - Fork 2
/
ffmpeg
40 lines (37 loc) · 2.29 KB
/
ffmpeg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
_ffmpeg()
{
local cur=${COMP_WORDS[$COMP_CWORD]}
local prev=${COMP_WORDS[$COMP_CWORD-1]}
if [ -n "$prev" ] && [ "${prev:0:1}" = "-" ]; then
case "$prev" in
-acodec|-c:a)
COMPREPLY=( $(compgen -W "$(ffmpeg -encoders 2>/dev/null | sed -n '/--/,$p' | tail -n +2 | grep "^ A" | awk '{print $2}')" -- "$cur") ) ;;
-cpuflags)
COMPREPLY=( $(compgen -W "3dnow 3dnowext altivec armv5te armv6 armv6t2 armv8 athlon athlonxp atom avx avx2 bmi1 bmi2 cmov fma3 fma4 k6 k62 k8 mmx mmxext neon pentium2 pentium3 pentium4 setend sse sse2 sse2slow sse3 sse3slow sse4.1 sse4.2 ssse3 vfp vfpv3 xop") ) ;;
-f)
COMPREPLY=( $(compgen -W "$(ffmpeg -formats 2>/dev/null | sed -n '/--/,$p' | tail -n +2 | awk '{print $2}')" -- "$cur") ) ;;
-h|-\?|-help|--help)
COMPREPLY=( $(compgen -W "long full decoder= encoder= demuxer= muxer= filter=" -- "$cur") ) ;;
-hwaccel)
COMPREPLY=( $(compgen -W "none auto $(ffmpeg -hwaccels 2>/dev/null | tail -n +2)" -- "$cur") ) ;;
-init_hw_device)
COMPREPLY=( $(compgen -W "cuda dxva2 vaapi vdpau qsv" -- "$cur") ) ;;
-loglevel)
COMPREPLY=( $(compgen -W "quiet panic fatal error warning info verbose debug trace" -- "$cur") ) ;;
-movflags)
COMPREPLY=( $(compgen -W "default_base_moof disable_chpl empty_moov faststart frag_custom frag_keyframe omit_tfhd_offset rtphint separate_moof" -- "$cur") ) ;;
-preset)
COMPREPLY=( $(compgen -W "ultrafast superfast veryfast faster fast medium slow slower veryslow placebo" -- "$cur") ) ;;
-pix_fmt)
COMPREPLY=( $(compgen -W "$(ffmpeg -pix_fmts 2>/dev/null | sed -n '/--/,$p' | tail -n +2 | awk '{print $2}')" -- "$cur") ) ;;
-vcodec|-c:v)
COMPREPLY=( $(compgen -W "$(ffmpeg -encoders 2>/dev/null | sed -n '/--/,$p' | tail -n +2 | grep "^ V" | awk '{print $2}')" -- "$cur") ) ;;
-vprofile|-profile:v)
COMPREPLY=( $(compgen -W "baseline main high high10 high422 high444" -- "$cur") ) ;;
esac
elif [ -n "$cur" ] && [ "${cur:0:1}" = "-" ]; then
COMPREPLY=( $(compgen -W "$(ffmpeg -h full 2>/dev/null | grep -e "^-" -e "^ -" | awk '{print $1}')" -- "$cur") )
fi
}
complete -o default -F _ffmpeg ffmpeg