kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
9.89k stars 885 forks source link

specify protocol option before input? #313

Open arlenarlenarlen opened 4 years ago

arlenarlenarlen commented 4 years ago

I'm trying to specify a protocol before my input so that I can capture a png from an RTSP stream. Right now I have

(
    ffmpeg
    .input(stream)
    .filter("scale", width, -1)
    .output(time_now + ".png", vframes=1)
    .overwrite_output()
    .run(capture_stdout=True, capture_stderr=True)
)

This captures frames, but is often gitchy as it grabs the first frame it sees and something something keyframes.

One soultion I found for this is to force tcp $ ffmpeg -rtsp_transport tcp -i "$SOURCE" -frames 1 ./picture1.jpg but I'm unclear on how I can specify the rtsp/tcp protocols.

Background https://stackoverflow.com/questions/23238295/force-ffmpeg-to-use-tcp-protocol-when-reading-a-rtsp-stream https://stackoverflow.com/questions/49868802/rtsp-frame-grabbing-creates-smeared-pixeled-and-corrupted-images

kfur commented 4 years ago

add to input call kwargs like ffmpeg.input(stream, ss="00:00:11.000")

kkroening commented 4 years ago

Try this:

ffmpeg.input(stream, rtsp_transport='tcp')
DaniloAlves1995 commented 2 years ago

Try this:

ffmpeg.input(stream, rtsp_transport='tcp')

Thank you, this worked for me.