How to get pts associated with frame.
When i streaming the video through rtmp protocol, i want to get frame data and pts at the same time. It's there have method to do it ?
Were you able to resolve this? I am looking for a similar solution.
Maybe you can try something like this:
_, message = ffmpeg.input(...).filter('showinfo').output(...).run(quiet=True)
and then get pts from the string in
message.decode()
using a regexp.
This is working for me when dissecting a video file into frames.
Any pointers on how to get a pts timestamp and frame without loading the entire video file into memory? I'm able to iteratively get the frames from the Process video frame-by-frame using numpy section of the documentation, but I'm not able to capture the output of the showinfo filter.
process = (
ffmpeg
.input(video_path)
.filter("fps", 2)
.filter("showinfo")
.output('pipe:', format='rawvideo', pix_fmt='rgb24', vframes=8)
.run_async(pipe_stdout=True)
)
while True:
in_bytes = process.stdout.read(width * height * 3)
if not in_bytes:
break
in_frame = np.frombuffer(in_bytes, np.uint8).reshape([height, width, 3])
Hi, I've the same problem to solve. Do you have found the solution? If yes, can you share it please? Thanks