deffcode.ffhelper
Following methods are exclusively design to handle FFmpeg related tasks. These tasks includes validation of installed FFmpeg binaries, downloading of FFmpeg binaries(on Windows), and parsing of FFmpeg metadata into useful information using various pattern matching methods.
For usage examples, kindly refer our Basic Recipes and Advanced Recipes
get_valid_ffmpeg_path¶
Validate the given FFmpeg path/binaries, and returns a valid FFmpeg executable path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
custom_ffmpeg | string | path to custom FFmpeg executables | '' |
is_windows | boolean | is running on Windows OS? | False |
ffmpeg_download_path | string | FFmpeg static binaries download location (Windows only) | '' |
verbose | bool | enables verbose for its operations | False |
Returns: A valid FFmpeg executable path string.
Source code in deffcode/ffhelper.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
download_ffmpeg_binaries¶
Generates FFmpeg Static Binaries for windows(if not available)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | path for downloading custom FFmpeg executables | required |
os_windows | boolean | is running on Windows OS? | False |
os_bit | string | 32-bit or 64-bit OS? | '' |
Returns: A valid FFmpeg executable path string.
Source code in deffcode/ffhelper.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
validate_ffmpeg¶
Validate FFmpeg Binaries. Returns True if validity test passes successfully.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | absolute path of FFmpeg binaries | required |
verbose | bool | enables verbose for its operations | False |
Returns: A boolean value, confirming whether tests passed, or not?.
Source code in deffcode/ffhelper.py
get_supported_pixfmts¶
Find and returns all FFmpeg's supported pixel formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | absolute path of FFmpeg binaries | required |
Returns: List of supported pixel formats as (PIXEL FORMAT, NB_COMPONENTS, BITS_PER_PIXEL).
Source code in deffcode/ffhelper.py
get_supported_vdecoders¶
Find and returns all FFmpeg's supported video decoders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | absolute path of FFmpeg binaries | required |
Returns: List of supported decoders.
Source code in deffcode/ffhelper.py
get_supported_demuxers¶
Find and returns all FFmpeg's supported demuxers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | absolute path of FFmpeg binaries | required |
Returns: List of supported demuxers.
Source code in deffcode/ffhelper.py
validate_imgseqdir¶
Validates Image Sequence by counting number of Image files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source | string | video source to be validated | required |
extension | string | extension of image sequence. | 'jpg' |
Returns: A boolean value, confirming whether tests passed, or not?.
Source code in deffcode/ffhelper.py
is_valid_image_seq¶
Checks Image sequence validity by testing its extension against FFmpeg's supported pipe formats and number of Image files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | absolute path of FFmpeg binaries | required |
source | string | video source to be validated | None |
verbose | bool | enables verbose for its operations | False |
Returns: A boolean value, confirming whether tests passed, or not?.
Source code in deffcode/ffhelper.py
is_valid_url¶
Checks URL validity by testing its scheme against FFmpeg's supported protocols.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | string | absolute path of FFmpeg binaries | required |
url | string | URL to be validated | None |
verbose | bool | enables verbose for its operations | False |
Returns: A boolean value, confirming whether tests passed, or not?.
Source code in deffcode/ffhelper.py
check_sp_output¶
Returns FFmpeg stdout output from subprocess module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | based on input | Non Keyword Arguments | () |
kwargs | based on input | Keyword Arguments | {} |
Returns: A string value.
Source code in deffcode/ffhelper.py