Page 1 of 1

Seeking in network streams

Posted: 14 Nov 2014 14:08
by Ortix
For some time now I've been trying to build a little application (which I will explain later on), and I'm trying to figure out the inner workings of decoding video. So now I'm curious how VLC handles seeking in network streams. From what I understand is that it needs some header information before it can actually render anything. But how does that work when the user skips to halfway into the video without actually downloading the whole thing?

The reason I ask is because I'm trying to build a tiny app (currently in nodejs, since CLI didn't work) which uses peerflix to stream a torrent through an http server from which I then want to take several screenshots without having to download the entire file. I can then open the stream in VLC and this is where the tricky part comes in. Apparently VLC creates a request with an http range header. So peerflix then starts downloading those parts. But how does that work? What about the header information? Is that still stored as cache in VLC? Because I tried to be smart and decided to manually download the first part of a torrent, another chunk from somewhere in the middle and tried to concat both streams. That obviously did not work.

So the background to the story is: Extract screenshots without downloading the entire file through bittorrent and automate the process

I also thought of using CLI to open the stream (which works) but when I try to take a screenshot at let's say 50%, it will download the entire thing up to 50% and then take the screenshot. Also, I couldn't get it to work on a headless linux machine where it's supposed to be, only on my windows machine it worked.

Any form of help would be appreciated! I've been researching this for some time now and I feel I get closer by the day

Re: Seeking in network streams

Posted: 14 Nov 2014 16:09
by Rémi Denis-Courmont
How to seek depends on the file format... There are no simple answers to the question.

Re: Seeking in network streams

Posted: 14 Nov 2014 16:40
by Ortix
let's say it's an x264 video format

Re: Seeking in network streams

Posted: 14 Nov 2014 18:51
by Rémi Denis-Courmont
x264 is not a video format.

Re: Seeking in network streams

Posted: 14 Nov 2014 19:55
by Ortix
Sorry I mean h264 encoded video in a matroska container. I was in a bit of rush with that response, excuse me :oops: