Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в Python в модуле re.
Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки.
pattern = re.compile(r"(\w+)+")
words = pattern.search(text, re.DOTALL)
А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как.
pattern.search(text, re.DOTALL | re.VERBOSE)
А теперь смотрим исходники, что находится в этих атрибутах?
Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево.
>>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]:
>>>
print(bin(n))
0b1
0b10
0b100
0b1000
0b10000
0b100000
0b1000000
0b10000000
0b100000000
Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули:
000000001
000000010
000000100
000001000
000010000
000100000
001000000
010000000
100000000
Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45
В общем, это пример применения побитовых операций в самом Python.
Теперь вы знаете Python еще немного лучше)
#tricks#regex#libs
📰 FFmpeg Introduces Vulkan-Accelerated 360 Degree Video Conversion
Beyond the capabilities of just the Vulkan Video API, the FFmpeg multimedia library has made interesting Vulkan-accelerated adaptations using compute shaders. With Vulkan compute they've implemented Apple ProRes video acceleration, FFV1 decode, and other features. The newest Vulkan feature now in place for FFmpeg is 360 degree video conversion...
🔗 Source: https://www.phoronix.com/news/FFmpeg-360-Degree-Vulkan
#ffmpeg
📰 FFmpeg 8.1 Released With Experimental xHE-AAC MPS212, More Vulkan Acceleration
FFmpeg 8.1 is out today as the newest stable release of this widely-used, open-source multimedia library...
🔗 Source: https://www.phoronix.com/news/FFmpeg-8.1-Released
#opensource#ffmpeg
📰 Gentoo-Based Redcore Linux Hardened 2601 Released with Kernel 6.19
Redcore Linux Hardened 2601 Vulpecula has been released, featuring Linux kernel 6.19, FFmpeg 8, and updates to the Sisyphus package manager.
🔗 Source: https://linuxiac.com/gentoo-based-redcore-linux-hardened-2601-released-with-kernel-6-19/
#ffmpeg#kernel#linux
Кстати! Я всем советую попробовать HandBrake — программу для ужатия видео.
Это графический интерфейс для мощной библиотеки ffmpeg, которая заточена на перегонку видео в разные форматы.
Я в основном использую для уменьшения размера файлов, чтобы телеграм проигрывал их без звука автоматически
Тут подробнее писал как это работает
Анимацию постом выше я просто закинул и без изменения настроек перегнал из mpg в mp4. Размер изменился с 4.5мб до 300кб
А для тизера «Коротких вопросов» нажав две кнопки, смог уменьшить файл со 167 мб до (!) 3 мб. За счет уменьшения размера сторон с 4к до 720p.
На мобиле разницы скорее всего не будет видно, а вовлечение в просмотр повысится — сплошная польза!
Работает на всех платформах, в том числе на маке и линуксе!
🎤Ссылки на утро — второй канал
⏲Ускорить YouTube за звезду (VPN за 2₽)
#ToolReview@cogload#ffmpeg@cogload#telegram@cogload
🔖 The creator of ffmpeg Fabrice Bellard(1) is truly a genius and has created so many amazing software that have been an amazing benefit to the world. | Hacker News #pinboard#pantheon#ffmpeg#person
Yeah definitely. If programming genius had a unit it should be called the bellard.
One 10x programmer = a 1/10th Bellard?
100x 工程师,可以放在万神殿了
https://news.ycombinator.com/item?id=25487711
This is Probably the Best Video Downloader App (And it is Free and Open Source) | itsFOSS
VidBee allows you to download videos from YouTube, Facebook, X, Instagram, etc. In fact, it supports over 1,800 websites.
It is built on top of popular command line tools like yt-dlp and #ffmpeg. For the interface, it uses the Electron framework. I understand that some people dislike Electron framework as it runs a web browser underneath, but the 'advantage' of this framework is that you get the same interface in all the operating systems. At least, it's an advantage for the developers as they don't have to build the interface separately for #Linux, #Windows and #macOS.
The source code for VidBee is available on its GitHub repository.
#VidBee - Free Open Source Video Downloader
https://vidbee.org/