[Python] Stream klv and video using ffmpeg

Discussão em 'Python' iniciado por Stack, Julho 31, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python program that launches an ffmpeg process where the process has two inputs 1. stdin (rawvideo) and 2. udp port (klv).

    klv_sender.py

    try:
    while True:
    sock.sendto(packet, (localhost, 4444))
    except BrokenPipeError:
    pass


    ffmpeg command:

    ffmpeg -loglevel verbose -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 704x480 -r 30 -i - -f data -i udp://0.0.0.0:4444 -map 0:v -c:v libx264 -preset ultrafast -tune zerolatency -map 1:d -c:d copy -f mpegts localhost:1234?pkt_size=1316


    I see data coming from klv on port 4444 and video data is being sent but, for some reason, I only get klv data. It seems like something blocks so that only klv data is getting sent. If I remove klv from the command video is fine

    Any thoughts as to why one process seems to be blocking? I have sent the sleep time to 1/30 for both streams. The loglevel outputs messages indicating video/klv are received but only 2 packets of video and like 1200 klv packets.

    Thanks!

    Continue reading...

Compartilhe esta Página