Skip to content

Instantly share code, notes, and snippets.

@andrewloux
andrewloux / consuming-from-multiple-topics.md
Last active December 10, 2022 21:18
Kafka: Notes on Consuming from Multiple Topics

How are partitions assigned in a consumer group?

This is based on the partition assignment strategy configuration, an important note here is that this is a topic-specific configuration. It can only be used to describe the strategy used to assign partitions to a specific consumer group.

The default strategy is called the RangeAssignor strategy. In this strategy, we divide the number of partitions over the number of consumer instances, and assign one by one. If the division does not result in a nice round number, the first few consumer instances are assigned more partitions.

Example

Suppose there are two consumers C0 and C1, two topics t0 and t1, and each topic has 3 partitions, resulting in the following partitions: t0p0, t0p1, t0p2, t1p0, t1p1, and t1p2

@Andrey2G
Andrey2G / encoding.txt
Last active April 12, 2025 01:01
Video Encoding with multiple resolutions
ffmpeg -i "c:/videos/sample.mp4
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0
-c:v libx264 -crf 22 -c:a aac -ar 48000
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 64k
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 900k -b:a:1 128k
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p"
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3
-hls_flags independent_segments -master_pl_name "name-pl.m3u8"
"c:/videos/encoded/name-%v.m3u8"