zimscraperlib.video.presets
Classes:
-
VideoMp4High–Low Quality mp4 video
-
VideoMp4Low–Low Quality mp4 video
-
VideoWebmHigh–High Quality webm video
-
VideoWebmLow–Low Quality webm video
-
VoiceMp3Low–Low quality mp3 audio
Attributes:
preset_type
module-attribute
preset_type = 'video'
VideoMp4High
VideoMp4High(**kwargs: Any)
Bases: Config
Low Quality mp4 video
20 constant quality
Methods:
-
build_from–build a Config easily via shortcut params
-
to_ffmpeg_args–Convert the options dict to list of ffmpeg arguments
-
update_from–Updates Config object based on shortcut params as given in build_from()
Attributes:
-
VERSION– -
audio_codec– -
audio_sampling_rate– -
buffersize– -
defaults(dict[str, str | None]) – -
ext– -
mapping(dict[str, str]) – -
max_video_bitrate– -
mimetype– -
min_video_bitrate– -
options(dict[str, str | None]) – -
quantizer_scale_range– -
target_audio_bitrate– -
target_video_bitrate– -
video_codec– -
video_scale(str | None) –
Source code in src/zimscraperlib/video/config.py
21 22 23 24 | |
VERSION
class-attribute
instance-attribute
VERSION = 1
audio_codec
property
writable
audio_codec
audio_sampling_rate
property
writable
audio_sampling_rate
buffersize
property
writable
buffersize
ext
class-attribute
instance-attribute
ext = 'mp4'
mapping
class-attribute
mapping: dict[str, str] = {
"video_codec": "-codec:v",
"audio_codec": "-codec:a",
"max_video_bitrate": "-maxrate",
"min_video_bitrate": "-minrate",
"target_video_bitrate": "-b:v",
"buffersize": "-bufsize",
"audio_sampling_rate": "-ar",
"target_audio_bitrate": "-b:a",
}
max_video_bitrate
property
writable
max_video_bitrate
min_video_bitrate
property
writable
min_video_bitrate
options
class-attribute
quantizer_scale_range
property
writable
quantizer_scale_range
target_audio_bitrate
property
writable
target_audio_bitrate
target_video_bitrate
property
writable
target_video_bitrate
video_codec
property
writable
video_codec
build_from
classmethod
build_from(**params: Any)
build a Config easily via shortcut params
video_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Video-Encoders values: h264 | libvpx | libx264 | libx265 | xxx audio_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders values: aac | mp3 | flac | opus | libvorbis | xxx max_video_bitrate: maximum size per second for video stream values: 128k | 1m min_video_bitrate: minimum size per second for video stream values: 128k | 1m target_video_bitrate: tentative size per second for video stream values: 384k | 1m target_audio_bitrate: tentative size per second for audio stream values: 48k | 128k buffersize: decoder buffer size values: 1000k | 1m audio_sampling_rate: number of audio samples per second values: 44100 | 48000 quantizer_scale_range: tuple of min / max values of video quantizer scale (VBR) values: (21, 35) | (68, 97) | (x, y) video_scale: video frame scale. more info - https://trac.ffmpeg.org/wiki/Scaling values: 480:320 | 320:240 | width:height
Source code in src/zimscraperlib/video/config.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
to_ffmpeg_args
Convert the options dict to list of ffmpeg arguments
Source code in src/zimscraperlib/video/config.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
update_from
update_from(**kwargs: Any)
Updates Config object based on shortcut params as given in build_from()
Source code in src/zimscraperlib/video/config.py
26 27 28 29 30 | |
VideoMp4Low
VideoMp4Low(**kwargs: Any)
Bases: Config
Low Quality mp4 video
480:h format with height adjusted to keep aspect ratio 300k video bitrate 48k audio bitrate highly degraded quality (30, 42)
Methods:
-
build_from–build a Config easily via shortcut params
-
to_ffmpeg_args–Convert the options dict to list of ffmpeg arguments
-
update_from–Updates Config object based on shortcut params as given in build_from()
Attributes:
-
VERSION– -
audio_codec– -
audio_sampling_rate– -
buffersize– -
defaults(dict[str, str | None]) – -
ext– -
mapping(dict[str, str]) – -
max_video_bitrate– -
mimetype– -
min_video_bitrate– -
options(dict[str, str | None]) – -
quantizer_scale_range– -
target_audio_bitrate– -
target_video_bitrate– -
video_codec– -
video_scale(str | None) –
Source code in src/zimscraperlib/video/config.py
21 22 23 24 | |
VERSION
class-attribute
instance-attribute
VERSION = 1
audio_codec
property
writable
audio_codec
audio_sampling_rate
property
writable
audio_sampling_rate
buffersize
property
writable
buffersize
ext
class-attribute
instance-attribute
ext = 'mp4'
mapping
class-attribute
mapping: dict[str, str] = {
"video_codec": "-codec:v",
"audio_codec": "-codec:a",
"max_video_bitrate": "-maxrate",
"min_video_bitrate": "-minrate",
"target_video_bitrate": "-b:v",
"buffersize": "-bufsize",
"audio_sampling_rate": "-ar",
"target_audio_bitrate": "-b:a",
}
max_video_bitrate
property
writable
max_video_bitrate
min_video_bitrate
property
writable
min_video_bitrate
options
class-attribute
options: dict[str, str | None] = {
"-codec:v": "h264",
"-b:v": "300k",
"-maxrate": "300k",
"-minrate": "300k",
"-qmin": "30",
"-qmax": "42",
"-vf": "scale='480:trunc(ow/a/2)*2'",
"-codec:a": "aac",
"-ar": "44100",
"-b:a": "48k",
"-movflags": "+faststart",
"-ac": "2",
}
quantizer_scale_range
property
writable
quantizer_scale_range
target_audio_bitrate
property
writable
target_audio_bitrate
target_video_bitrate
property
writable
target_video_bitrate
video_codec
property
writable
video_codec
build_from
classmethod
build_from(**params: Any)
build a Config easily via shortcut params
video_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Video-Encoders values: h264 | libvpx | libx264 | libx265 | xxx audio_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders values: aac | mp3 | flac | opus | libvorbis | xxx max_video_bitrate: maximum size per second for video stream values: 128k | 1m min_video_bitrate: minimum size per second for video stream values: 128k | 1m target_video_bitrate: tentative size per second for video stream values: 384k | 1m target_audio_bitrate: tentative size per second for audio stream values: 48k | 128k buffersize: decoder buffer size values: 1000k | 1m audio_sampling_rate: number of audio samples per second values: 44100 | 48000 quantizer_scale_range: tuple of min / max values of video quantizer scale (VBR) values: (21, 35) | (68, 97) | (x, y) video_scale: video frame scale. more info - https://trac.ffmpeg.org/wiki/Scaling values: 480:320 | 320:240 | width:height
Source code in src/zimscraperlib/video/config.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
to_ffmpeg_args
Convert the options dict to list of ffmpeg arguments
Source code in src/zimscraperlib/video/config.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
update_from
update_from(**kwargs: Any)
Updates Config object based on shortcut params as given in build_from()
Source code in src/zimscraperlib/video/config.py
26 27 28 29 30 | |
VideoWebmHigh
VideoWebmHigh(**kwargs: Any)
Bases: Config
High Quality webm video
25 constant quality
Methods:
-
build_from–build a Config easily via shortcut params
-
to_ffmpeg_args–Convert the options dict to list of ffmpeg arguments
-
update_from–Updates Config object based on shortcut params as given in build_from()
Attributes:
-
VERSION– -
audio_codec– -
audio_sampling_rate– -
buffersize– -
defaults(dict[str, str | None]) – -
ext– -
mapping(dict[str, str]) – -
max_video_bitrate– -
mimetype– -
min_video_bitrate– -
options(dict[str, str | None]) – -
quantizer_scale_range– -
target_audio_bitrate– -
target_video_bitrate– -
video_codec– -
video_scale(str | None) –
Source code in src/zimscraperlib/video/config.py
21 22 23 24 | |
VERSION
class-attribute
instance-attribute
VERSION = 2
audio_codec
property
writable
audio_codec
audio_sampling_rate
property
writable
audio_sampling_rate
buffersize
property
writable
buffersize
ext
class-attribute
instance-attribute
ext = 'webm'
mapping
class-attribute
mapping: dict[str, str] = {
"video_codec": "-codec:v",
"audio_codec": "-codec:a",
"max_video_bitrate": "-maxrate",
"min_video_bitrate": "-minrate",
"target_video_bitrate": "-b:v",
"buffersize": "-bufsize",
"audio_sampling_rate": "-ar",
"target_audio_bitrate": "-b:a",
}
max_video_bitrate
property
writable
max_video_bitrate
min_video_bitrate
property
writable
min_video_bitrate
options
class-attribute
options: dict[str, str | None] = {
"-codec:v": "libvpx-vp9",
"-b:v": "340k",
"-qmin": "26",
"-qmax": "54",
"-g": "240",
"-quality": "good",
"-speed": "1",
"-codec:a": "libvorbis",
"-b:a": "48k",
"-ar": "44100",
"-ac": "2",
}
quantizer_scale_range
property
writable
quantizer_scale_range
target_audio_bitrate
property
writable
target_audio_bitrate
target_video_bitrate
property
writable
target_video_bitrate
video_codec
property
writable
video_codec
build_from
classmethod
build_from(**params: Any)
build a Config easily via shortcut params
video_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Video-Encoders values: h264 | libvpx | libx264 | libx265 | xxx audio_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders values: aac | mp3 | flac | opus | libvorbis | xxx max_video_bitrate: maximum size per second for video stream values: 128k | 1m min_video_bitrate: minimum size per second for video stream values: 128k | 1m target_video_bitrate: tentative size per second for video stream values: 384k | 1m target_audio_bitrate: tentative size per second for audio stream values: 48k | 128k buffersize: decoder buffer size values: 1000k | 1m audio_sampling_rate: number of audio samples per second values: 44100 | 48000 quantizer_scale_range: tuple of min / max values of video quantizer scale (VBR) values: (21, 35) | (68, 97) | (x, y) video_scale: video frame scale. more info - https://trac.ffmpeg.org/wiki/Scaling values: 480:320 | 320:240 | width:height
Source code in src/zimscraperlib/video/config.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
to_ffmpeg_args
Convert the options dict to list of ffmpeg arguments
Source code in src/zimscraperlib/video/config.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
update_from
update_from(**kwargs: Any)
Updates Config object based on shortcut params as given in build_from()
Source code in src/zimscraperlib/video/config.py
26 27 28 29 30 | |
VideoWebmLow
VideoWebmLow(**kwargs: Any)
Bases: Config
Low Quality webm video
480:h format with height adjusted to keep aspect ratio 128k target video bitrate but stay within quality boundaries. 48k audio bitrate
Methods:
-
build_from–build a Config easily via shortcut params
-
to_ffmpeg_args–Convert the options dict to list of ffmpeg arguments
-
update_from–Updates Config object based on shortcut params as given in build_from()
Attributes:
-
VERSION– -
audio_codec– -
audio_sampling_rate– -
buffersize– -
defaults(dict[str, str | None]) – -
ext– -
mapping(dict[str, str]) – -
max_video_bitrate– -
mimetype– -
min_video_bitrate– -
options(dict[str, str | None]) – -
quantizer_scale_range– -
target_audio_bitrate– -
target_video_bitrate– -
video_codec– -
video_scale(str | None) –
Source code in src/zimscraperlib/video/config.py
21 22 23 24 | |
VERSION
class-attribute
instance-attribute
VERSION = 3
audio_codec
property
writable
audio_codec
audio_sampling_rate
property
writable
audio_sampling_rate
buffersize
property
writable
buffersize
ext
class-attribute
instance-attribute
ext = 'webm'
mapping
class-attribute
mapping: dict[str, str] = {
"video_codec": "-codec:v",
"audio_codec": "-codec:a",
"max_video_bitrate": "-maxrate",
"min_video_bitrate": "-minrate",
"target_video_bitrate": "-b:v",
"buffersize": "-bufsize",
"audio_sampling_rate": "-ar",
"target_audio_bitrate": "-b:a",
}
max_video_bitrate
property
writable
max_video_bitrate
min_video_bitrate
property
writable
min_video_bitrate
options
class-attribute
options: dict[str, str | None] = {
"-codec:v": "libvpx-vp9",
"-b:v": "140k",
"-qmin": "30",
"-qmax": "40",
"-g": "240",
"-quality": "good",
"-speed": "4",
"-vf": "scale='480:trunc(ow/a/2)*2'",
"-codec:a": "libvorbis",
"-b:a": "48k",
"-ar": "44100",
"-ac": "2",
}
quantizer_scale_range
property
writable
quantizer_scale_range
target_audio_bitrate
property
writable
target_audio_bitrate
target_video_bitrate
property
writable
target_video_bitrate
video_codec
property
writable
video_codec
build_from
classmethod
build_from(**params: Any)
build a Config easily via shortcut params
video_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Video-Encoders values: h264 | libvpx | libx264 | libx265 | xxx audio_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders values: aac | mp3 | flac | opus | libvorbis | xxx max_video_bitrate: maximum size per second for video stream values: 128k | 1m min_video_bitrate: minimum size per second for video stream values: 128k | 1m target_video_bitrate: tentative size per second for video stream values: 384k | 1m target_audio_bitrate: tentative size per second for audio stream values: 48k | 128k buffersize: decoder buffer size values: 1000k | 1m audio_sampling_rate: number of audio samples per second values: 44100 | 48000 quantizer_scale_range: tuple of min / max values of video quantizer scale (VBR) values: (21, 35) | (68, 97) | (x, y) video_scale: video frame scale. more info - https://trac.ffmpeg.org/wiki/Scaling values: 480:320 | 320:240 | width:height
Source code in src/zimscraperlib/video/config.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
to_ffmpeg_args
Convert the options dict to list of ffmpeg arguments
Source code in src/zimscraperlib/video/config.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
update_from
update_from(**kwargs: Any)
Updates Config object based on shortcut params as given in build_from()
Source code in src/zimscraperlib/video/config.py
26 27 28 29 30 | |
VoiceMp3Low
VoiceMp3Low(**kwargs: Any)
Bases: Config
Low quality mp3 audio
44Khz audio sampling 48k audio bitrate audio-only
Methods:
-
build_from–build a Config easily via shortcut params
-
to_ffmpeg_args–Convert the options dict to list of ffmpeg arguments
-
update_from–Updates Config object based on shortcut params as given in build_from()
Attributes:
-
VERSION– -
audio_codec– -
audio_sampling_rate– -
buffersize– -
defaults(dict[str, str | None]) – -
ext– -
mapping(dict[str, str]) – -
max_video_bitrate– -
mimetype– -
min_video_bitrate– -
options(dict[str, str | None]) – -
quantizer_scale_range– -
target_audio_bitrate– -
target_video_bitrate– -
video_codec– -
video_scale(str | None) –
Source code in src/zimscraperlib/video/config.py
21 22 23 24 | |
VERSION
class-attribute
instance-attribute
VERSION = 1
audio_codec
property
writable
audio_codec
audio_sampling_rate
property
writable
audio_sampling_rate
buffersize
property
writable
buffersize
ext
class-attribute
instance-attribute
ext = 'mp3'
mapping
class-attribute
mapping: dict[str, str] = {
"video_codec": "-codec:v",
"audio_codec": "-codec:a",
"max_video_bitrate": "-maxrate",
"min_video_bitrate": "-minrate",
"target_video_bitrate": "-b:v",
"buffersize": "-bufsize",
"audio_sampling_rate": "-ar",
"target_audio_bitrate": "-b:a",
}
max_video_bitrate
property
writable
max_video_bitrate
mimetype
class-attribute
instance-attribute
mimetype = 'audio/mp3'
min_video_bitrate
property
writable
min_video_bitrate
options
class-attribute
options: dict[str, str | None] = {
"-vn": "",
"-codec:a": "mp3",
"-ar": "44100",
"-b:a": "48k",
"-ac": "2",
}
quantizer_scale_range
property
writable
quantizer_scale_range
target_audio_bitrate
property
writable
target_audio_bitrate
target_video_bitrate
property
writable
target_video_bitrate
video_codec
property
writable
video_codec
build_from
classmethod
build_from(**params: Any)
build a Config easily via shortcut params
video_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Video-Encoders values: h264 | libvpx | libx264 | libx265 | xxx audio_codec: codec for output audio stream. more info https://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders values: aac | mp3 | flac | opus | libvorbis | xxx max_video_bitrate: maximum size per second for video stream values: 128k | 1m min_video_bitrate: minimum size per second for video stream values: 128k | 1m target_video_bitrate: tentative size per second for video stream values: 384k | 1m target_audio_bitrate: tentative size per second for audio stream values: 48k | 128k buffersize: decoder buffer size values: 1000k | 1m audio_sampling_rate: number of audio samples per second values: 44100 | 48000 quantizer_scale_range: tuple of min / max values of video quantizer scale (VBR) values: (21, 35) | (68, 97) | (x, y) video_scale: video frame scale. more info - https://trac.ffmpeg.org/wiki/Scaling values: 480:320 | 320:240 | width:height
Source code in src/zimscraperlib/video/config.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
to_ffmpeg_args
Convert the options dict to list of ffmpeg arguments
Source code in src/zimscraperlib/video/config.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
update_from
update_from(**kwargs: Any)
Updates Config object based on shortcut params as given in build_from()
Source code in src/zimscraperlib/video/config.py
26 27 28 29 30 | |