Open ghost opened 7 years ago
There are 2 caches, try --cache-secs=0 --demuxer-readahead-secs=0
to disable the packet cache (I think).
Generally mpv has no logic to catch up in live streams.
Thanks for quick answer, it disables cache but it still does not catch up. For example when I pause, wait few seconds and hit play again it does not catch-up. It continues like if the cache was still there even when it says zero.
That's most likely just buffered across network or server.
I did not know that could be happening. And I can not change settings of the server because it is bundled in the NVR software. Do you have any suggestion how could I achieve real time streaming? I saw that mpv has some sort of scripting, so maybe script for catch-up behavior?
Can you seek forward to catch up? If so, you could work around this by making an input command to un-pause and seek forward. Maybe a fancier version is a lua script that periodically tries to seek forward.
I can skip ahead. But unfortunately I have no idea on how to make this plugin/script.
@PSSGCSim One method would be to use a tiny bit of lua that executes some code at recurring intervals; the function add_periodic_timer would do it. See the add_periodic_timer example on https://github.com/mpv-player/mpv/blob/master/DOCS/man/lua.rst. Instead of calling 'print' within your periodic timer as in the example, you'd instead execute a command to seek forward, probably via mp.command - here's a script that shows a simple mp.command usage: https://github.com/mpv-player/mpv/blob/f1436658647aceb7ea58e595439fa6dd5c2cdb97/TOOLS/lua/ao-null-reload.lua#L7 The commands usable by mp.command are the same things you can assign to key binds via input.conf. If you're not familiar with input.conf or lua, you'll likely want to read up a bit first. The lua.rst doc is a good primer for lua scripts, and the command interface section of the mpv documentation describes all the the actions (commands) that can be triggered by various sources like key binds, lua calls to mp.command, notification / observer handlers, etc.
Of course, seeking forward means you will miss some stuff (whatever you seek past). A more delicate and advanced solution might be to slightly increase the playback speed if you (or rather, your periodically invoked function) notice that you're sufficiently behind realtime, and then bring it back to 1.0 as you approach realtime. This would require some tinkering to get right, but would be a good exercise.
I'm trying:
DISPLAY=:0 mpv --no-cache --keep-open --hwdec=vdpau --hwdec-codecs=all --vo=vdpau --cache-secs=0 --demuxer-readahead-secs=0 rtsp://127.0.0.1:10105/proxyStream
And I'm seeing like a 5 second delay :( - any ideas?
the same here, 5 seconds delay
try mpv --no-cache --untimed
I had this very same issue and got it solved with mixing the examples in this thread.
mpv <source> --cache-secs=0 --demuxer-readahead-secs=0 --untimed
Is what i needed. --no-cache
didn't seem to matter.
Which has a bit of irony. I want to disable all caching and have to use functions that are not named as such. The function that should disable all caching (--no-cache) is not doing what you'd expect.
Neither is --cache-secs=0 etc. --untimed just plays video as fast as possible.
Neither is --cache-secs=0 etc. --untimed just plays video as fast as possible.
I just tried it again and i really need all 3 of these commands to make it work properly. The video in this case is a live (from smartphone) cam stream over http.
You probably want --cache-pause=no, which is the thing that actually disables waiting until part of the cache is filled. --profile=low-latency might be useful too.
MPV is missing a --video-sync=external
type option to ffplay
's -sync ext
. The FFMPEG code speeds up the clock when buffer grows (presumably the demuxer), and slows down when it drains.
https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffplay.c#L93
https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffplay.c#L1458
https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffplay.c#L1575
mpv version and platform
Debian GNU/Linux stable-updates (sid)
Reproduction steps
mpv --no-cache --keep-open --hwdec=vdpau --hwdec-codecs=all --vo=vdpau rtsp://my-nvr.local:7447/xxxxxxxxxxxxxxxxxxxxxxxxx_2
I can provide live rtsp URL but I would rather not (it is my security camera facing fence gate)
Expected behavior
I have specified
--no-cache
option so I expect to have real-time video streamActual behavior
Log
http://sprunge.us/MhYJ