saving video streams

Dear Lazyweb,

How do I save a streaming WMV clip to disk in some replayable form, on OSX? E.g., this one.

I found this suggestion for using VLC, which doesn't work: it saves a file with no audio, and chunky, corrupted video. (In my experience, VLC doesn't work worth shit on half the things that play fine in the official WMV and QT players.)

QT 7.0.2, WMP 9.0.0 3307, VLC 0.8.2, OS 10.4.2.

(As usual, non-answers and pathetic attempts at humor will get you banned before anyone even sees how funny you aren't, so please don't waste my time, ok?)

Update: Best answer so far:

    mplayer -dumpstream -playlist url -dumpfile filename.wmv
That should work with both "mms:" URLs and .asf/.asx redirectors.
Tags: , , , ,

30 Responses:

  1. evan says:

    I've had success with mmsclient in the past, but it seems to depend on the stream. I feel like it's worked less often recently -- maybe it hasn't been updated to the latest protocol versions or something?

    I stumbled across this in the mplayer manpage recently:
    -dumpstream (MPlayer only)
    Dumps the raw stream to ./stream.dump. Useful when ripping from DVD or network.
    If you give more than one of -dumpaudio, -dumpvideo, -dumpstream on the command
    line only the last one will work.
    This does create a dump for the stream you mention. It would seem to me that "supporting the mms protocol and writing to disk" is an entirely separate issue and codepath from being able to actually decode the movie (which my mplayer fails to do).

    • invdaic says:

      This is how to do it with Mplayer (using 1.0pre8, available here.

      1. Install mplayer (for the purposes of example assuming it's in /Applications).
      2. Fire up the terminal
      3. cd /Applications/MPlayer OSX.app/Contents/Resources/External_Binaries/mplayer.app/Contents/MacOS
      4. ./mplayer_noaltivec -dumpstream "URL_OF_MOVIE" or, if you have altivec, ./mplayer -dumpstream "URL_OF_MOVIE"
      5. Rename stream.dump whatever the file should be named

      Now,this normally works just fine, but your example movie required a little extra work.

      1. Ignore step 5 above
      2. cat stream.dump
      3. find the url. In this case mms://lonwle.interoutemediaservices.com/{2559CDD3-1436-4761-BDC2-94F40A99E6AD}/{C7FE2ACB-6501-4F16-A22F-7E2EC1A6A77A}/EVN1568-w8-250.wmv
      4. ./mplayer -dumpstream "mms://lonwle.interoutemediaservices.com/{2559CDD3-1436-4761-BDC2-94F40A99E6AD}/{C7FE2ACB-6501-4F16-A22F-7E2EC1A6A77A}/EVN1568-w8-250.wmv"
      5. Now rename stream.dump to the real file name.

      Best of luck.

      • invdaic says:

        Oh crap, forgot to turn off the autoformatting, sorry about the excess carriage returns.

      • invdaic says:

        Also, while Mplayer downloads the file just fine, it plays it without audio. The file will play just fine in WMP 9 though.

      • jwz says:

        That works, thanks!

      • lifftchi says:

        if you give mplayer the -playlist option, it'll correctly interpret the initial url, sparing you the second set of steps.

        • invdaic says:

          Cool, that's good to know. So now things are shortened down to:

          1. /usr/local/bin/mplayer -playlist ...the-url... -dumpstream
          2. mv stream.dump foo.wmv

          That's almost simple.

          • edm says:

            You may find the "-dumpfile" option of use. It allows you to specify that the output file (from -dumpstream or -dumpaudio or -dumpvideo) should be foo.wmv: "-dumpfile foo.wmv". Which saves one step. (You still need the -dumpstream option as well.)

            Ewen

      • mattjhsn says:

        I've been reading here about mplayer and all of the possible option and I think I've found a stream that mplayer will not download It is mms:// from http://keloland.com

        Here is the version:

        "MPlayer dev-CVS-040330-18:37-3.3 (C) 2000-2004 MPlayer Team"

        Here is the command line:

        ./mplayer -playlist "mms://media.keloland.com/KELO/120305Count.wmv" -dumpstream -dumpfile "/Users/mattj/stream.wmv"

        Here is the output:

        --

        MPlayer dev-CVS-040330-18:37-3.3 (C) 2000-2004 MPlayer Team

        AltiVec found

        CPU: PowerPC

        Reading config file /usr/local/etc/mplayer/mplayer.conf: No such file or directory

        Reading config file /Users/mattj/.mplayer/config

        Resolving media.keloland.com for AF_INET6...

        Couldn't resolve name for AF_INET6: media.keloland.com

        Resolving media.keloland.com for AF_INET...

        Connecting to server media.keloland.com[66.115.207.41]:80 ...

        Stream bitrate properties object

        Max bandwidth set to 0

        Resolving media.keloland.com for AF_INET6...

        Couldn't resolve name for AF_INET6: media.keloland.com

        Resolving media.keloland.com for AF_INET...

        Connecting to server media.keloland.com[66.115.207.41]:80 ...

        Cache size set to 705 KBytes

        Connected to server: media.keloland.com

        Reading /Users/mattj/.mplayer/codecs.conf: Can't open '/Users/mattj/.mplayer/codecs.conf': No such file or directory

        Reading /usr/local/etc/mplayer/codecs.conf: Can't open '/usr/local/etc/mplayer/codecs.conf': No such file or directory

        Using built-in default codecs.conf.

        font: can't open file: /Users/mattj/.mplayer/font/font.desc

        font: can't open file: /usr/local/share/mplayer/font/font.desc

        Using usleep() timing
        Can't open input config file /Users/mattj/.mplayer/input.conf: No such file or directory

        Can't open input config file /usr/local/etc/mplayer/input.conf: No such file or directory

        Falling back on default (hardcoded) input config

        Playing mms://media.keloland.com/KELO/0&?u?f???.

        Resolving media.keloland.com for AF_INET6...

        Couldn't resolve name for AF_INET6: media.keloland.com

        Resolving media.keloland.com for AF_INET...

        Connecting to server media.keloland.com[66.115.207.41]:80 ...

        Server return 400:Bad Request

        Failed to parse header

        Resolving media.keloland.com for AF_INET6...

        Couldn't resolve name for AF_INET6: media.keloland.com

        Resolving media.keloland.com for AF_INET...

        Connecting to server media.keloland.com[66.115.207.41]:1755 ...

        Connection timeout

        Unknown protocol: mms

        asf_streaming_start failed

        Unable to open URL: mms://media.keloland.com/KELO/0&?u?f???

        Option stream url: This URL doesn't have a hostname part.

        File not found: 'KELO/0&?u?f???'

        Failed to open mms://media.keloland.com/KELO/0&?u?f???

        Exiting... (End of file)

        --

        When I download "120305Count.wmv" separately and display it I get:

        cat 120305Count.wmv

        [Reference]

        Ref1=http://10.0.2.200:80/KELO/120305Count.wmv

        --

        It looks like it is redirecting to an internal server. Is this ok? Any other ideas on what I'm doing wrong? Thanks!

        -Matt

        P.S. The video is of a demolition of a feed elevator in Sioux Falls, SD, scheduled to be taken down on 12/3/2005.

    • jwz says:

      Oh, and you've compiled that on OSX, have you? See, this would be firmly in the category of "wasting my time".

      • mayoff says:

        As a matter of fact, I have. Here's a typescript of me downloading the source, compiling it, and running it to fetch your example movie:

        http://dqd.com/~mayoff/jwz-mmsclient.txt

        It's long (1247553 bytes) because mmsclient is extremely verbose. Check the end for the output of 'uname -a' and 'gcc -v'.

        • jwz says:

          After manually fixing the "dbl" typo in the configure script (aka "the author didn't run it before shipping it") I get this:

            make
            cd . && aclocal
            aclocal: configure.in: 34: macro `AM_TYPE_PTRDIFF_T' not found in library

          At that point, I'm no longer interested in fucking with it. Especially since the mplayer trick above seems to work, and doesn't require me to edit source code.

          • mayoff says:

            I understand that you've found a different solution, but... You don't have to edit the code. I didn't. The "dbl" typo is harmless. It compiles and works anyway.

            • jwz says:

              The PTRDIFF thing is not harmless. (I don't know why you didn't get that, but it will remain a mystery.)

              • mayoff says:

                The PTRDIFF error only happens if you modify configure.in. So don't. You'll get a working mmsclient if you paste this into a shell:

                cd /tmp; rm -rf mms_client-0.0.3*; curl -O http://www.geocities.com/majormms/mms_client-0.0.3.tar.gz; tar xzf mms_client-0.0.3.tar.gz; cd mms_client-0.0.3; ./configure; make

                On my PowerBook that takes under 8 seconds.

                • mattjhsn says:

                  This mmsclient download and compile works file for me!

                  It doesn't, however, download this file:

                  mms://media.keloland.com/KELO/120305Count.wmv

                  This file does play in Windows Media Player 9 for OS X.

                  The output:

                  dirk:/tmp/mms_client-0.0.3$ mmsclient mms://media.keloland.com/KELO/120305Count.wmv

                  host : >media.keloland.com< path : >KELO/120305Count.wmv< file : >/120305Count.wmv< creating output file '120305Count.wmv' port: 000006db socket open request: Operation timed out
                  dirk:/tmp/mms_client-0.0.3$ ls -l 120305Count.wmv

                  -rw------- 1 myuser wheel 0 3 Dec 16:35 120305Count.wmv

                  Ideas? Suggestions? Incorrigible Rants?

    • spikenheimer says:

      or you could download the app thats here: http://www.misawa.net/archives/000030.html

      you'll have to still parse out the mms:// url from the original link like <lj user=invdaic> was talking about above, but this app has a compiled version of mmsclient that its calling that worked fine on that link you posted.

      this would save you the step of renaming the file from stream.dump in the mplayer solution above...

      • jwz says:

        That seems to work, but it took me a while to figure out where it wrote the output file. Guess where it put it? In the ROOT DIRECTORY. That's right, in "/". Awesome!

  2. cjensen says:

    It worked for me with VLC after I thrashed about a bit to get the mms: stream url instead of the link you provided. I did this:

    • Opened your example stream into VLC without attempting to save it.
    • opened the Info window which gave me the mms: style link to the stream.
    • Restarted VLC cause I don't trust that fucking program.
    • Selected 'Open Network' and fed it the mms: stream, selected 'Advanced output', clicked on 'Settings' where I finally got to tell it what file to save it into and also selected 'Dump raw input'.
    • Waited for the player to play the stream into the file, then closed VLC
    • When renamed with a .wmv extension, it played for me in Windows Media Player on my Mac with sound-- it's about 6MB on disk
    • jwz says:

      It plays in VLC, but it looks completely fucked up, like it's dropping half the keyframes.

      • cjensen says:

        When I used your original http: link, it saved some tiny file and then played the mms: stream badly as you describe. When I extracted the mms: link and used that instead, it played nothing and saved the mms: stream. So it doesn't matter that VLC is incompetent as long as it saves all the bits into a file for Microsoft's player to work with.

  3. Is the output of the best answer a first-class WMV file that one can seek through, or just the dump of a stream without headers? I find that when I do something similar with RealAudio, it produces files that RealPlayer won't open and that mplayer can only seek back to the start of.

    • jwz says:

      Yes, it's seekable.

    • edge_walker says:

      Even that works perfectly for me – now if there was a way to save not only rtsp: streams but pnm: ones also, I could rest contentedly. Not even RealPlayer 10 itself plays those, which means keeping a copy of RealPlayer 9 just for them. Yuck. Audio can be snagged with vsound, but that’s a pain in the ass.

  4. jerronimo says:

    That's a funny coincidence... I just found another link to a video by Client last night, and I'd never heard of them before... here's the other video:

    http://cliptip.blogspot.com/2005/12/client-here-and-now.html

    from here:

    http://www.livejournal.com/userinfo.bml?user=cliptip_rss

  5. if you add the flags -vc dummy -vo null -nosound then the stream will usually download faster than realtime as it doesn't try to display it or play the sound. vc sets the video codec, vo sets the video output, nosound does the same for sound. But it still dumps everything to disk.

  6. remonstrare says:

    http://savannah.nongnu.org/projects/mimms/

    I think it only works with mms:// URLs, but I could be wrong; they may have updated it.

    • jwz says:

      How is that any different from the mplayer incantation, above?

      • remonstrare says:

        MiMMS is a tool designed to rip only MMS protocol streams, mplayer's dumpstream is generic functionality. If mplayer fails to save something replayable, use MiMMS instead.

        In the past, I've had mplayer --dumpstream save unreplayable gibberish to disk, so I had to seek out protocol-specific stream rippers.