Urgent.News

What's breaking now, across thousands of outlets.

Tech

From a database to a YouTube Short with Pillow and ffmpeg (no video editor)

Every night our server writes a plain-language post about the day's data and turns it into a short vertical video for YouTube Shorts, Instagram Reels and Facebook. No video editor, no paid API: Pillow draws the slides and ffmpeg joins them. 1. Draw slides with Pillow from PIL import Image , ImageDraw , ImageFont img = Image . new ( "RGB" , ( 1080 , 1920 ) , "#0f172a" ) # 9:16 vertical d =…

Our server generates a concise, easy-to-understand post each night about the day's data, and transforms it into a short vertical video for popular social media platforms like YouTube Shorts, Instagram Reels, and Facebook. Remarkably, this process requires no video editing software or paid APIs. Instead, it relies on open-source tools like Pillow for creating the slides and ffmpeg for stitching them together.

To create each slide, Pillow, a Python imaging library, draws text onto images in a 9:16 vertical format. The text is drawn in a bold font with a white color, making it stand out on the slide. A small helper function ensures that long sentences are wrapped to fit within the slide's boundaries, preventing any text from running off the edge.

Once the slides are ready, ffmpeg's concat demuxer is employed to join them into a single video file. The last slide is repeated in the list of files to ensure its duration is accounted for in the final video, despite ffmpeg typically ignoring the duration of the last file in such lists. To maintain compatibility with various platforms, a silent audio track is added using ffmpeg's anullsrc input. This is crucial as some platforms may reject videos lacking any audio stream.

Each caption undergoes a stringent compliance check before being posted. This check involves a regular expression to filter out unwanted words and a mandatory disclaimer. If a caption fails this check, it is skipped, logged, and the remaining posts are uploaded as usual. The entire operation is powered by an Always Free cloud VM, leveraging open-source tools, and a self-hosted scheduler named Postiz to distribute the videos across different platforms.

This entire process, developed by Quantooo Lab, the creators of quantooo.com, an open and educational quantitative laboratory, is completely free and documented at https://quantooo.com/learn?tag=daily. It's important to note that this method provides educational content, not investment advice.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Smart Ring Goes to Church

From glowing crosses to voice-transcribed prayers, the Elah and Glorify rings are reimagining traditional faith rituals for the wearable era.

Tail sampling rules in the OpenTelemetry Collector: cost and pitfalls

Your second-tier Collector keeps restarting, or your trace bill refuses to fall: either way, it is your tail sampling rules that need another look, well before you touch the traffic.

  • Tail sampling rules impact memory usage and performance in OpenTelemetry Collector
  • Three types of sampling rules: exclusions, safety nets, and cost ceiling
  • Monitor key metrics to ensure tail sampling rules function properly

More from Friday 20 November →