initial commit

This commit is contained in:
Alexander Jacobsen 2026-07-17 16:30:22 +02:00
commit fcaaeaaf5d
2 changed files with 169 additions and 0 deletions

26
main.py Normal file
View file

@ -0,0 +1,26 @@
import ffmpeg
import os
in_filename = "/home/albmj/media/Cowboy_Bebop.mkv"
width=640
height=360
process1 = (
ffmpeg
.input(in_filename,re=None,stream_loop="-1")
.filter('scale', width, height)
.filter('subtitles', in_filename, force_style='Fontsize=120', si='2')
.output('pipe:', format='rawvideo', pix_fmt='rgb24')
.run_async(pipe_stdout=True,quiet=False)
)
fd = os.open("/tmp/video",os.O_RDWR|os.O_CREAT)
os.lseek(fd,0,os.SEEK_SET)
#fd = os.memfd_create('test_file')
print(f'{width}x{height}x3={width*height*3}')
print(f'/tmp/video')
while True:
in_bytes = process1.stdout.read(width * height * 3)
if len(in_bytes) != width*height*3:
print("wrong size")
print(len(in_bytes))
exit(1)
os.write(fd, in_bytes)
os.lseek(fd, 0, os.SEEK_SET)