Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rtek1000 opened this issue Feb 22, 2025 · 0 comments
Open

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

rtek1000 opened this issue Feb 22, 2025 · 0 comments

Comments

@rtek1000
Copy link

rtek1000 commented Feb 22, 2025

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:passwd@192.168.1.181: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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant