Pdraw renderer with blank screen

Hi I’m using ANAFI and Olympe, trying to get each frame in RTSP video stream by setting callbacks.
・Olympe : v7.5.0 on Ubuntu 20.04
・Access to ANAFI video stream via SkyController3

I could successfully see the video by using VLC media player (rtsp://192.168.53.1/live) but I couldn’t with Pdraw. Pdrawstate turns to “Playing” but only blank screen appered on renderer. Also the callback is not invoked, so it seems no frame is coming. I tried the same thing with Sphinx simulated drone but got same result.
It’s strange that when I choose local mp4 file as url, it worked. Video appered on renderer and the callback is invoked. So I suspect something is happenning in RTSP stream read.

The code is almost the same with example ( olympe/pdraw.py at master · Parrot-Developers/olympe (github.com)) and I’m not sure why it doesn’t work. I appreciate it if you have any suggestions, thank you.

import argparse
import olympe
import os
import sys
import time
from olympe.video.pdraw import Pdraw, PdrawState
from olympe.video.renderer import PdrawRenderer


DRONE_IP = os.environ.get("DRONE_IP", "192.168.53.1")
DRONE_RTSP_PORT = os.environ.get("DRONE_RTSP_PORT", "554")


def yuv_frame_cb(yuv_frame):
    """
    This function will be called by Olympe for each decoded YUV frame.
        :type yuv_frame: olympe.VideoFrame
    """
    print("Got frame!")


def main(argv):
    parser = argparse.ArgumentParser(description="Olympe Pdraw Example")
    parser.add_argument(
        "-u",
        "--url",
        default=f"rtsp://{DRONE_IP}:{DRONE_RTSP_PORT}/live",
        help=(
            "Media resource (rtsp:// or file://) URL.\n"
            "See olympe.Pdraw.play documentation"
        ),
    )
    parser.add_argument("-m", "--media-name", default="DefaultVideo")
    args = parser.parse_args(argv)
    pdraw = Pdraw()
    # Uncomment the following line, to test this OpenCV frame processing callback function
    # This function requires `pip3 install opencv-python`.
    pdraw.set_callbacks(raw_cb=yuv_frame_cb)
    pdraw.play(url=args.url, media_name=args.media_name)
    renderer = PdrawRenderer(pdraw=pdraw)
    assert pdraw.wait(PdrawState.Playing, timeout=5)
    if args.url.endswith("/live"):
        # Let's see the live video streaming for 10 seconds
        count=0
        while True:
            print(pdraw.state) #PdrawState.Playing
            time.sleep(1)
            count+=1
            if(count>9):
                break
        pdraw.close()
    else:
        # When replaying a video, the pdraw stream will be closed automatically
        # at the end of the video
        # For this is example, this is the replayed video maximal duration:
        timeout = 90
    assert pdraw.wait(PdrawState.Closed, timeout=5)
    renderer.stop()
    pdraw.dispose()


def test_pdraw():
    main([])


if __name__ == "__main__":
    main(sys.argv[1:])

This topic was automatically closed after 30 days. New replies are no longer allowed.