Network-Cahing not working because of keyframes

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Llorx
New Cone
New Cone
Posts: 5
Joined: 18 Sep 2020 00:55

Network-Cahing not working because of keyframes

Postby Llorx » 18 Sep 2020 01:00

This is easy. If I set the network caching to something less than the amount of keyframes, it will still "Stream buffering done" the amount of keyframes I'm sending.

I'm using "tcp/ts://HOST:PORT" to receive the stream, and the stream is created using ffmpeg with mpegts output.

I tested this by having a 1 keyframe each 2 seconds stream and setting network-caching over 2 seconds, working as expected, then reducing it to 100ms and still having 2 seconds of caching.

If I change the keyframes to 1 per second, the network caching reduces to 1000ms, but sill not 100ms, which is what I want.

What option do I need to set to avoid this?

Lotesdelere
Cone Master
Cone Master
Posts: 10077
Joined: 08 Sep 2006 04:39
Location: Europe

Re: Network-Cahing not working because of keyframes

Postby Lotesdelere » 18 Sep 2020 20:26

Interesting finds.

Please open Tools -> Messages (set Verbosity to 2) before you start the playback, and then paste the full resulting log here or on Pastebin.com if it's too long.

Llorx
New Cone
New Cone
Posts: 5
Joined: 18 Sep 2020 00:55

Re: Network-Cahing not working because of keyframes

Postby Llorx » 18 Sep 2020 21:45

Nice. This is a video of the process. The network caching is set to 100ms and the video keyframes are set to 1 per second. As you can see when the first picture is received, the video is paused for 1 second while buffering: https://femto.pw/8myg.mp4

By the way you can see the buffering also in the logs line 270: https://pastebin.pl/view/b70b8202

Rémi Denis-Courmont
Developer
Developer
Posts: 15312
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Network-Cahing not working because of keyframes

Postby Rémi Denis-Courmont » 19 Sep 2020 07:48

The caching value is just an initial hint. VLC will automatically increase if it needs to. AFAICT, it's working as intended.

You probably should make sure that the sent first frame is a always key frame.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Llorx
New Cone
New Cone
Posts: 5
Joined: 18 Sep 2020 00:55

Re: Network-Cahing not working because of keyframes

Postby Llorx » 19 Sep 2020 09:31

Hm, that's a bit difficult to achieve as is just a ffmpeg output piped directly to the socket. By the way, there's always a 2000ms seconds caching, although I restart the stream 10 times, and is impossible that all 10 times I just miss a keyframe and have to wait for the next one for 2 seconds.

The weird thing is that if I set the amount of keyframes to 1 per 2 seconds (which is the usual default), I'll get a network caching of 2 seconds, which is huge. I don't mind vlc to show some grey frames for 2 seconds as long as the stream is as live as possible, like ffplay does, for example. Almost all players do this so I don't get why vlc ignore "network-caching" if its value is lower than the amount of keyframes. I thought that the "network-caching" option was always forced under my responsibility. Right now is just not working as explained in the documentation :-( Even the default caching value is 1000ms when the usual keyframes are 1 each 2 seconds, so it usually is not applying.

Isn't there an option to disable waiting for keyframes or ignoring gop size or things like that?

EDIT: I'm not the only one having this problem, and a lot more not posting them on forums: https://forums.vmix.com/posts/t20603-VL ... -2-seconds
(Just arrived by chance looking for vMix SRT thingies haha)

User avatar
InTheWings
Developer
Developer
Posts: 1275
Joined: 07 Aug 2013 13:15
VLC version: crashing
Operating System: Linux
Contact:

Re: Network-Cahing not working because of keyframes

Postby InTheWings » 25 Sep 2020 10:13

use 4.0 nb and --low-delay
:!: If you want your problem to be solved :
* First read troubleshooting guide VSG:Main
* Always provide verbose LOGS ! (command line or from gui)
* Always check your issue against a developer build from Nightly Build of VLC
* Tell us when your problem is solved !

Llorx
New Cone
New Cone
Posts: 5
Joined: 18 Sep 2020 00:55

Re: Network-Cahing not working because of keyframes

Postby Llorx » 30 Sep 2020 16:09

Yeah, that made it @InTheWings. Still a bit of buffering (for example, if I set 1000ms it raises up to 1400ms and if I set 300ms it raises up to 700ms) but at least it skips the keyframes, which is what I wanted. Thank you!


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 47 guests