[MEncoder-users] Downloading a stream

Andrew Udvare audvare at gmail.com
Sun Dec 7 00:55:24 CET 2014


On Saturday 06 December 2014 15:32:11 Reimar Döffinger wrote:
> On Wed, Dec 03, 2014 at 03:22:47PM -0700, jd1008 wrote:
> > Could someone please explain how I might save a video stream?
> > 
> > It is not an ordinary stream like youtube.
> > 
> > When I play it, and I click on the doun-arrow next to
> > the icon of the firefox add-on "Video DownloadHelper",
> > it displays many files whose names are all numbers, with
> > the extension .f4f
> > 
> > I downloaded one of those and it is not playable by any
> > player I have (mplayer, vlc).
> > 
> > So, how can I save the stream as an mp4 or any of the
> > formats that mplayer or vlc can play?
> 
> A sample file (or web site) would probably be useful, it might be not
> that hard to implement support.

youtube-dl supports a lot of sites: https://github.com/rg3/youtube-dl/tree/master/youtube_dl/extractor

I suggest trying it out. The generic scraper works for a lot of sites too.

youtube-dl -v http://the-page.with/a-video-embedded/

Just FYI on F4F format: it exists for streaming content (think live content), 
faster random access, and saving bandwidth. Example: You only want to watch 5 
minutes into a video, and only 2 minutes of it:

- You click on video time slider to 5 minutes; you are no longer sent segments 
from the beginning of the video
- The segments are separate files, so the server never seeks, it just sends 
you the closest segment that matches time-stamp 5 minutes (so indeed you may 
never really start from 5:00.000)
- You stop the video after 2 minutes. The server stops sending you data 
completely, thus saving a lot of bandwidth.

On the last point I know a lot of people hate that because they want to pre-
buffer the entire video prior to watching, but this no longer works on most 
sites including YouTube. If you really want the video data right away, use 
youtube-dl or another solution. This obviously does not really work for live 
broadcasts.

This live streaming format exists for videos (f4f container and MP4 
container), AAC, and MP3. There is usually an m3u8 file involved, especially 
if there is encryption (typically a session-based AES key). The m3u8 file 
lists the segments, the keys, and can also list metadata (it's just an 
extension on m3u). Even if the content is 'free' (as in has ads), there is 
usually encryption in the mix somewhere. The encryption algorithm itself is 
usually in some JS on the page (even YouTube has it on the page), and is 
usually very obfuscated.

Andrew


More information about the MEncoder-users mailing list