Skip to content

Play RTSP stream and desktop screen with the lowest possible delay #175

Open
@rtek1000

Description

Hello,

I liked this application ffpyplayer, I was able to find examples of how to put buttons in the kivy application, but I couldn't reproduce the desktop screen and I couldn't reduce the delay of the live stream, which was a few seconds. I haven't found many ways to embed ffplay in a window.

To replicate the desktop:

ffplay -loglevel error -hide_banner -af "volume=0.0" -flags low_delay -f gdigrab -i desktop -offset_x 100 -offset_y 100 -video_size 640x480 -left 0 -top 300 -x 400 -y 225

The command to play the RTSP live stream with little delay that I found is this, ffplay plays well images from security cameras with support for ONVIF protocol, 1080p image, H.264 or H.265:

ffplay -loglevel error -hide_banner -af "volume=0.0" -flags low_delay -vf setpts=0 -rtsp_transport tcp rtsp://user:[email protected]:554/live/0/main -left 0 -top 50 -x 400 -y 225

I understand that it is difficult to have a camera on hand to test the RTSP stream, but there is ONVIF server software that emulates a camera stream to play files or the desktop screen, for example.

ffplay -loglevel error -hide_banner -af "volume=0.0" -flags low_delay -vf setpts=0 -rtsp_transport tcp rtsp://192.168.1.35/screenlive -left 0 -top 50 -x 400 -y 225

If I run ffplay directly, there is practically no delay, but with the test.py example, the user can already notice that there is a delay.

The exemple https://github.com/matham/ffpyplayer/blob/master/examples/test.py

ONVIF server software:
https://www.happytimesoft.com/products/onvif-server/index.html

Could you tell me how I can set the ffplay command flags in ffpyplayer?

Another thing is about the log, I tried leaving log_level = 'error', but I continued to have debug type messages. Then I tried other ways, but I didn't have much success.

    def on_start(self):
        self.callback_ref = WeakMethod(self.callback)
        filename = 'rtsp://192.168.1.35/screenlive' #sys.argv[1]
        logging.info('ffpyplayer: Playing file "{}"'.format(filename))
        # try ff_opts = {'vf':'edgedetect'} http://ffmpeg.org/ffmpeg-filters.html
        ff_opts = {'loglevel': 'error', 'fflags': 'low_delay'}
        self.ffplayer = MediaPlayer(filename, callback=self.callback_ref,
                                    loglevel=log_level, ff_opts=ff_opts)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions