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

omxplayer has 20s delay on raspberry pi live stream #832

Open
gitterman opened this issue Aug 18, 2023 · 4 comments
Open

omxplayer has 20s delay on raspberry pi live stream #832

gitterman opened this issue Aug 18, 2023 · 4 comments

Comments

@gitterman
Copy link

I am running buster on a pi model B which acts as a door monitor with an attached USB cam.
The camera is streamed with mjpg_player on the internal network without any significant delay.
I also have a 640x480 car monitor attached to the analog video output, and I am using omxplayer to show the stream on this monitor.
Alas, there is a delay of about 20s on the omxplayer output which makes the setup rather unusable.
The command line I am using is:
omxplayer -r -b --no-keys --live http://$HOSTNAME:8080/?action=stream
I have tried to reduce the frame rate by adding --fps 10 before the --live option but no change.

@popcornmix
Copy link
Owner

Setting the fps higher than the actual rate would be more likely to reduce buffering (although if stream contains timestamps the fps setting will be ignored).

I'd suggest playing with:

  --audio_fifo  n         Size of audio output fifo in seconds
    --video_fifo  n         Size of video output fifo in MB
    --audio_queue n         Size of audio input queue in MB
    --video_queue n         Size of video input queue in MB
    --threshold   n         Amount of buffered data required to finish buffering [s]

But be aware omxplayer is deprecated and will get no updates, so you may be better off with a newer distribution and a supported tool like VLC.

@gitterman
Copy link
Author

Thanks for the quick answer, I will give it a try.
From my understanding VLC is way much more resource consuming than omxplayer and has its problems when running without a GUI.
My doorcam pi runs just from CLI and has no keyboard attached.
Tools like omxplayer and streamers like mjpg_streamer are very valuable in these scenarios.
The usefulness of a raspberry pi as a headless workhorse in the closet, without a GUI is much bigger than to use it as a desktop because of its lack of power compared to a cheap refurbished notebook.
It is a pity that things become so GUI oriented these days.

@popcornmix
Copy link
Owner

VLC will run without a gui (e.g. from a RPiOS lite image launched from CLI).

@gitterman
Copy link
Author

gitterman commented Aug 19, 2023

Installation of VLC required 224MB, and it is not supposed to be run as root.
I can display the stream with VLC on my desktop PC and on my raspberry 4 GUI, but I did not succeed to get the live stream shown on my attached analog display to my CLI only buster raspi yet.
I also found that VLC needs more CPU than omxplayer.
So far, I have changed the omxplayer command according to your hints to the one below, which reduces the delay to about 4 seconds, which is acceptable for me.
omxplayer -r -b --no-keys -n -1 --video_queue 0.1 --live http://$HOSTNAME:8080/?action=stream

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

2 participants