Download streams

Project:Tools
Component:Documentation
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Project wiki:Tools of the trade
Description

A lot of interesting videos are available in stream format (C-Span, etc.)

Document how to save a stream.

Comments

#1

mplayer - dumpstream rtsp://.../video.rm

add the bandwidth tag to speed it up:
mplayer -bandwidth 100000000
so it downloads as fast as possible.. otherwise it will tend to download in realtime..

mplayer -bandwidth 100000000 -dumpstream rtsp://.../video.rm

#2

The output will be named stream.dump. You can rename the file.
Otherwise, use the -dumpfile option to specify the file name:

mplayer -bandwidth 100000000 -dumpfile video.rm -dumpstream rtsp://.../video.rm

#3

How to download LIVE streams from c-span?

wget url
gives a file which has something like this:

     <Entry>
        <ref HREF="mms://rx-wes-sea153.rbn.com/farm/pull/tx-rbn-sea001:1459/wmtencoder/cspan/cspan/wmlive/cspan1v.asf"/>
     </Entry>
</ASX>

use the link inside to download live stream using the wget command above.

Problem: I cannot play back the stream, although the file is being downloaded.

#4

Is there a time limit to listening to a stream?
Listening to live cspan stream or using mplayer to dumpstream, the streams always ends after 2 or 3 hours, even though the event is longer.

#5

try seek:
-ss 01:10:00
Seeks to 1 hour 10 min.

#6

either when listening to the live stream or when dumping an older stream, I often encountered problems.

When dumping a stream, the dump would often prematurely abort with error messages like: realrtsp: rdt chunk not recognized: got 0x02. I then had to start from the beginning.
e.g.:

$  mplayer -bandwidth 100000000 -dumpfile c08_082808_dnc2.rm -dumpstream rtsp://video1.c-span.org/archive/c08/c08_082808_dnc2.rm
MPlayer 1.0rc2-4.2.3 (C) 2000-2007 MPlayer Team
CPU: AMD Sempron(tm)   2300+ (Family: 6, Model: 8, Stepping: 1)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing rtsp://video1.c-span.org/archive/c08/c08_082808_dnc2.rm.
Resolving video1.c-span.org for AF_INET6...
Couldn't resolve name for AF_INET6: video1.c-span.org
Resolving video1.c-span.org for AF_INET...
Connecting to server video1.c-span.org[38.105.88.134]: 554...
librtsp: server responds: '$'
Cache size set to 640 KBytes
realrtsp: rdt chunk not recognized: got 0x00
realrtsp: rdt chunk not recognized: got 0x02
Core dumped ;)

Searching the mplayer mailing list, I found that I had to pass the demuxer option. To see all demuxer options, do mplayer -demuxer help, e.g.:

$ mplayer -demuxer help
MPlayer 1.0rc2-4.2.3 (C) 2000-2007 MPlayer Team
CPU: AMD Sempron(tm)   2300+ (Family: 6, Model: 8, Stepping: 1)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled with runtime CPU detection.
Available demuxers:
demuxer:  type  info:  (comment)
  rawaudio  20   Raw audio demuxer
  rawvideo  26   Raw video demuxer
        tv   9   Tv card demuxer (?)
        mf  16   mf demuxer (multiframe?, pictures demuxer)
  lavfpref  44   libavformat preferred demuxer (supports many formats, requires libavformat)
       avi   3   AVI demuxer (AVI files, including non interleaved files)
       y4m  12   YUV4MPEG2 demuxer
       asf   6   ASF demuxer (ASF, WMV, WMA)
       nsv  36   NullsoftVideo demuxer (nsv and nsa streaming files)
       nuv  13   NuppelVideo demuxer
      real  11   Realmedia demuxer (handles new .RMF files)
    smjpeg  24   smjpeg demuxer
       mkv  31   Matroska demuxer
realaudio  32   Realaudio demuxer (handles old audio only .ra files)
       vqf  37   TwinVQ demuxer (ported frm MPlayerXP)
       mov   7   Quicktime/MP4 demuxer (Handles Quicktime, MP4, 3GP)
      vivo   8   Vivo demuxer
       fli  10   Autodesk FLIC demuxer (Supports also some extensions)
      film  14   FILM/CPK demuxer for Sega Saturn CD-ROM games
       roq  15   RoQ demuxer
       gif  28   GIF demuxer
       ogg  18   Ogg demuxer
       avs  38   Avisynth demuxer (Requires binary dll)
       pva  23   PVA demuxer (streams from DVB cards)
    mpegts  29   MPEG-TS demuxer
     lmlm4  34   LMLM4 MPEG4 Compression Card stream demuxer
    mpegps   2   MPEG PS demuxer (Mpeg)
   mpegpes  41   MPEG PES demuxer (Mpeg)
    mpeges   1   MPEG ES demuxer (Mpeg)
   mpeggxf  42   MPEG ES in GXF demuxer (Mpeg)
   mpeg4es  27   MPEG4 ES demuxer (Mpeg)
    h264es  30   H.264 ES demuxer (Mpeg)
     audio  17   Audio demuxer (Audio only files)
      tivo  33   TiVo demuxer (Demux streams from TiVo)
       rtp  21   LIVE555 RTP demuxer (requires LIVE555 Streaming Media library)
      lavf  35   libavformat demuxer (supports many formats, requires libavformat)
     rawdv  22   Raw DV demuxer
       aac  39   AAC demuxer (Raw AAC files )

rtp is 21, so the problem was solved by doing:

mplayer -demuxer 21 -bandwidth 100000000 -dumpfile c08_082808_gore.rm -dumpstream rtsp://video1.c-span.org/archive/c08/c08_082808_gore.rm

I'll try to see if it makes a difference when listening to live stream:

mplayer -fs -demuxer asf mms://rx-wes-sea153.rbn.com/farm/pull/tx-rbn-sea001:1459/wmtencoder/cspan/cspan/wmlive/cspan1v.asf

Well, I just tried the latter, and I still get lots of errors like the following at the beginning:

ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%
ProcessInputError  r:0x80004005=-2147467259 (keyframe: 1)%  0%  1.5% 0 0 12%

Another thing I can try to improve the result is increase the cache:

       -cache <kBytes>
              This  option  specifies how much memory (in kBytes) to use when precaching a file or URL.  Especially useful on slow me‐
              dia.

thus:

mplayer -fs -demuxer asf -cache 2000 mms://rx-wes-sea153.rbn.com/farm/pull/tx-rbn-sea001:1459/wmtencoder/cspan/cspan/wmlive/cspan1v.asf