explain to me the video codecs

Dear Lazyweb,

I again have a few Quicktime videos that I can't import into iMovie. The problematic files seem to be "Sorenson Video" or "Sorenson 3 Video", and "QDesign Music 2 Audio".

They play fine in Quicktime Player Pro 7.0.3, but the "Save As" and "Export" menus are grayed out (only for these files: "Export" works fine with other files.) Neither ffmpegX 0.0.9t nor MPEG Streamclip 1.5.1 recognise these files as having video in them at all.

What do I need to do to convert them to something that iMovie can import, like DV?

Tags: , , , ,

26 Responses:

  1. duskwuff says:

    Tried mencoder? I've had some luck playing Sorenson AVI files in mplayer, so I suppose it might be able to do something useful here. Still, I'm afraid that you're probably in for a world of pain.

    No idea why Quicktime Player won't export them, though I imagine it might be some bizarre licensing issue.

    • jwz says:

      I thought ffmpegX was built on mencoder? At least, it insists on mencoder being installed...

      • thomtoffner says:

        ffmpegX is a frontend to both mencoder and ffmpeg. Each one has its faults and plusses, and ffmpegX tries to overcome the shortcomings of each by using both in different instances.

      • duskwuff says:

        From the name, I had guessed that it was built on ffmpeg. You learn something every day.

        A quick test shows mplayer understands the Quicktime wrapper, so I don't see any reason it wouldn't be able to convert it into some more tractable format. Getting it into a format that iMovie will accept, however? I dunno.

    • thomtoffner says:

      This would work under linux, but once again requires win32 dlls. I've no idea if OSX mencoder builds against the osx sorenson libraries, but nothing I've been able to find indicates that it does.

  2. tkil says:

    Looks like normally one can import/export sorenson3, but there are provisions for disabling export if that's what the author specifies. :(

    Whether hacking around this is as simple as opening it up in a binary editor and finding the appropriate key, I don't know.

    References:

    http://www.on2.com/support-resources/flix-tutorials/FlixExporter_Basic/
    (search for "grayed out")

    http://developer.apple.com/technotes/tn/tn2038.html
    "You can add a No Save user data item (type 'nsav') to your movies to prevent them from being edited or re-saved within the QuickTime environment."

    http://developer.apple.com/documentation/QuickTime/QT4WebPage/samplechap/special-8.html
    "You can set a movie characteristic that prevents the movie from being edited or saved by any QuickTime application."

    • tkil says:

      Mixed news on simple "nsav" hacking:

      http://lists.mac-mgrs.org:81/lists/mac-mgrs/Message/10570-P.txt
      "use Dumpster, a q&d little app from Apple, to examine the 'atoms' that
      make up a QT resource, and change the 'nsav' atom to all zeros: while
      apparently this worked on the Lord Of The Rings trailers, I didn't even find
      an 'nsav' resource/atom using this."

      http://www.videohelp.com/forum/userguides/124856.php
      '4.) Inside of the 'nsav' section, you'll see an editable value called "unknown data"
      5.) Change any non-zero value inside of "unknown data" to a zero.'

      http://koders.com/php/fid7261D17E32420121169BF7182B7057647592A04E.aspx
      $better = str_replace('nsav'."\x00\x00\x00\x01", 'nsav'."\x00\x00\x00\x00", $UncompressedHeader);

      http://www.greenspun.com/bboard/q-and-a-fetch-msg.tcl?msg_id=003qap
      'Look for a program called Dumpster. This will allow you to open the code of the MOV file and edit some programmed options. Look for the NSAV function and change the value to all 0's (zero's). This will remove the "not able to save" crap. However you will not find the NSAV on all MOV files but you will for most of them. The only one I've come across so far are the Movie Trailer that run at full screen and have all that extra junk on the top and bottom, but backing down to the lower resolution works good.'

      So it's worth a try. I'm curious to know if it works...

      • jwz says:

        Neither "Dumpster" nor "Atomic Dumpster" can open these files. "Atomic Dumpster" can't seem to open anything, and "Dumpster" grays out all but about 1 in 10 of the QT files I have. I guess it's really picky.

        FWIW, "grep -i nsav *.mov" ==> nothing.

        • sjn says:

          Apparently if you drag the movie onto the dumpster icon it will open them all,

          however

          At the top it says (Decompressed by Dumpster -- can't be edited)

          Also, I managed to get a DV stream using Final Cut HD, but it dropped the sound out after about 10 seconds.

          From what our video savvy guy can tell, they are using some sort of non-standard audio along side of the Sorenson compression to create their own sort of hybrid codec that works, sort of. We could not get it to play any of the samples all the way through. Varied success time wise on all of them for no apparent reason.

  3. m4dh4tt3r says:

    have a look at vlc. it says it supports the sorenson video codecs and the quicktime audio codec under OS X. you can select the output stream to be a host of different video/audio formats.

  4. johnsolo1701 says:

    You should really get a build of mencoder on your machine (I'm not talking about ffmpegx's mencoder). It appears libavcodec supports Sorenson 1 & 3. If you could try to convert these files and then give us an error message, it would help

    • jwz says:

      Well, I don't have any fuckin' idea how to use mencoder, and the man page is clear as mud. I can't tell the difference between "it doesn't work" and "the developers are space aliens".

      I got it to produce an output file -- containing noisy nonsense video and no sound -- using this:

        % mencoder kidney.mov -ovc libdv -oac lavc -vf scale=720:480
        MEncoder dev-CVS-050814-13:46-3.3 (C) 2000-2005 MPlayer Team
        Mac OSX static build for ffmpegX
        AltiVec found
        CPU: PowerPC
        File not found: 'frameno.avi'
        Failed to open frameno.avi
        success: format: 0 data: 0x0 - 0xc8000
        Quicktime/MOV file format detected.
        Compressed header uses zlib algo!
        Compressed header size: 23891 / 47183
        --------------
        MOV track #0: 947 chunks, 5679 samples
        Image size: 480 x 360 (24 bpp)
        Display size: 480 x 360
        Fourcc: 1QVS Codec: 'Sorenson Video'
        --------------
        MOV track #1: 474 chunks, 0 samples
        Audio bits: 16 chans: 2 rate: 44100
        Audio extra header: len=92 fcc=0x77617665
        MOV: Found unknown audio atom Fourcc: 2MDQ
        --------------
        MOV: longest streams: A: #1 (474 samples) V: #0 (5679 samples)
        VIDEO: [1QVS] 480x360 24bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)
        [V] filefmt:7 fourcc:0x31515653 size:480x360 fps:24.00 ftime:=0.0417
        ==========================================================================
        Opening audio decoder: [qtaudio] QuickTime Audio Decoder
        AUDIO: 44100 Hz, 2 ch, s16be, 128.0 kbit/9.07% (ratio: 15999->176400)
        Selected audio codec: [qdmc] afm:qtaudio (QuickTime QDMC/QDM2 audio decoders)
        ==========================================================================
        Opening video filter: [expand osd=1]
        Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
        Opening video filter: [scale w=720 h=480]
        ==========================================================================
        Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
        Selected video codec: [ffsvq1] vfm:ffmpeg (FFmpeg Sorenson Video v1 (SVQ1))
        ==========================================================================
        Building audio filter chain for 44100Hz/2ch/s16be -> 0Hz/0ch/s8...
        Building audio filter chain for 44100Hz/2ch/s16be -> 44100Hz/2ch/s16be...
        Writing AVI header...
        ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
        VDec: vo config request - 480 x 360 (preferred csp: Planar YVU9)
        VDec: using Planar YVU9 as output csp (no 0)
        Movie-Aspect is undefined - no prescaling applied.
        SwScaler: reducing / aligning filtersize 5 -> 4
        SwScaler: reducing / aligning filtersize 5 -> 4
        SwScaler: reducing / aligning filtersize 5 -> 4
        SwScaler: reducing / aligning filtersize 5 -> 4

        SwScaler: BICUBIC scaler, from Planar YVU9 to Packed YUY2 using AltiVec
        ODML: vprp aspect is 4:3.
        Pos: 1.0s 24f ( 0%) 3fps Trem: 0min 0mb A-V:0.084 [0:224]
        Skipping frame!
        Error while decoding frame! 3fps Trem: 0min 0mb A-V:0.069 [23040:224]
        Pos: 5.0s 124f ( 0%) 3fps Trem: 0min 0mb A-V:0.025 [23040:224]
        2 duplicate frame(s)!

        [... this is because I was working on a truncated copy of the source file...]

        Pos: 213.3s 5679f ( 0%) 131fps Trem: 0min 0mb A-V:0.041 [540:224]
        Flushing video frames

        Writing AVI index...
        Fixing AVI header...
        ODML: vprp aspect is 4:3.

        Video stream: 540.000 kbit/s (67500 bps) size: 14400000 bytes 213.333 secs 5679 frames

        Audio stream: 224.171 kbit/s (28021 bps) size: 155913 bytes 5.564 secs

      • johnsolo1701 says:

        ah DV. Not sure what your obsession is with that format. Do you enjoy non-square pixels and all the headaches that come with it? What the fuck - use mpeg2/mp2 at high bitrates then import it into your iMovie project. I assume you have acquired the QT Mpeg2 component by now.

        I'll include a command so your brain doesn't explode reading through such a large man page.

        mencoder kidney.mov -ovc lavc -oac lavc -lavcopts vcodec=mpeg2video:vbitrate=5000:acodec=mp2:abitrate=224

        ffmpeg also supports the video codecs you are trying to work with. Its man page is more terse, you might like that program better. mencoder is a beast.

        http://ffmpeg.sourceforge.net/ffmpeg-doc.html

        The real solution is of course for the Quicktime division at Apple to get off their high horse and support more than 2 fucking container formats, and a handful of codecs.

        • jwz says:

          ah DV. Not sure what your obsession is with that format.

          Well, since I want to go from "some random video I downloaded" to "something iMovie can import" to "a DVD-R", that's three format conversions. It seems that you'd want the middle one to be the lest-compresed format available, which is DV. Also, I've found that DV is the format the iMovie is most often willing to import: I've had trouble with most others at one time or another.

          I assume you have acquired the QT Mpeg2 component by now.

          Is that one of those things Apple expects me to pay for, again? If so, no, I don't.

          mencoder kidney.mov -ovc lavc -oac lavc -lavcopts vcodec=mpeg2video:vbitrate=5000:acodec=mp2:abitrate=224

          That incantation gives me a 63MB AVI from a 43MB MOV, so I guess it's the right size, but QuickTime plays it as blank white.

          I truncated a few of the troublesome MOVs I have to the first few seconds and put them here. Maybe you can make something of them...

          • johnsolo1701 says:

            mencoder kidney.mov -oac lavc -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=5000:acodec=mp2:abitrate=224:aspect=4/3 -of mpeg -mpegopts format=mpeg2 -vf harddup -srate 48000 -af lavcresample=48000 kidney.mpg

            This produced a standard mpeg2 file that imported into iMovie for me....although I think you might need the QT MPEG2 component to make iMovie understand it.

          • cacepi says:

            I know you're going to hate this, but (and don't hit me) Windows is really a good solution for these problems - primarily because all the anime fan subbing freaks use windows, and they have devised a number of ways to satisfy their favorite fetish.

            If you could stomach it, I could give a copy of one of these files to an anime freak of mine, and she could probably get this video in a shape that it could be imported into iMovie. I'll even clean the drool off it when I get it back from her.

            • cacepi says:

              I mailed the anime freak this morning, and this is the response I got back:

              "jwz?! I'm not helping that %$#*&^~! He called anime fans furries!"

              Your reputation proceeds you, Jamie.

              But that's why we like you.