Videos iTunes won't play

Dear Lazyweb, why would some H.264 MOV videos not play in iTunes, but play fine in Quicktime Player 7 and 10? And even worse, only fail on one machine?

On my home machine (iMac 10.6.7, iTunes 10.3.1, Perian 1.2.2) these videos play fine in iTunes and everywhere else.

On the "music videos" Mac Mini at DNA Pizza, (different hardware, but same versions of OS and all software) in iTunes, some videos play solid black video (though audio is fine). But they play fine in both versions of QT Player.

If I do "Get Info" on the video in iTunes when it is not playing, it says "Video Dimensions: 640x480". If I do "Get Info" while it is playing black, it says "0x0".

Fails the same in either full-screen or windowed mode.

For these videos, iTunes also can't generate a cover-flow preview image.

Get Info in QT Player shows a completely normal looking set of sizes and codecs: H.264 (Perian), 640 x 480, Millions; AAC, Stereo, 44.100 kHz; FPS 29.96; Data Size 22.39 MB; Data rate: 914.34 kbits/s.

The files were encoded with either Handbrake or MPEG Streamclip. Identical files on both machines.

I am completely at a loss at to how iTunes could be having a problem with these files when QT Player does not, or why it would be different on the two machines, or what I can do to work around it.

Any suggestions?

Tags: , , , ,

37 Responses:

  1. peterix says:

    Differences in video rendering acceleration support? Can't think of anything else really.

  2. No idea, but some other information you can check is which h.264 /profile/ the different files were encoded with: main, or basic? Some profiles receive hardware accelleration on certain operating system versions and hardware configurations, whilst others don't. One possible theory is that iTunes is ATTEMPTING hardware accelleration on the machine that is not available, and silently failing.

    if quicktime pro is available, movies have some editable metadata relating to dimensions. You can check the values of those.

    With my extensive playing around with quicktime and itunes on mac, with HD video, I discovered that iTunes performs significantly and noticably better playing HD video than the quicktime player, or even a barebones cocoa app with nothing but a QT kit view in it, which *suggests* that there's some specialised optimisations with regards to video playing present in iTunes that aren't in play with quicktime player or the standard OS control. It's not entirely unprecedented for apple to make code that simply fails silently and badly while attempting some fancy hardware specific thing.

    • jwz says:

      How do you tell what profile it is?

      The video I'm using as an example right now is 640x480 so there's nothing funny about its size, even in the Cmd-J crud.

      • The tool we use is the CLI release of mediainfo (http://mediainfo.sourceforge.net).

        It provides a great little output that can be plugged into a script:

        $ mediainfo ~/samplecontent/fileSequence300.ts
        General
        ID : 1 (0x1)
        Complete name : /Users/josh/samplecontent/fileSequence300.ts
        Format : MPEG-TS
        File size : 2.14 MiB
        Duration : 9s 943ms
        Overall bit rate : 1 799 Kbps

        Video
        ID : 257 (0x101)
        Menu ID : 1 (0x1)
        Format : AVC
        Format/Info : Advanced Video Codec
        Format profile : High@L3.0
        Format settings, CABAC : No
        Format settings, ReFrames : 2 frames
        Codec ID : 27
        Duration : 8s 984ms
        Width : 720 pixels
        Height : 368 pixels
        Display aspect ratio : 2.35:1
        Frame rate : 23.976 fps
        Color space : YUV
        Chroma subsampling : 4:2:0
        Bit depth : 8 bits
        Scan type : Progressive
        Color primaries : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
        Transfer characteristics : BT.709-5, BT.1361
        Matrix coefficients : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

        Audio
        ID : 258 (0x102)
        Menu ID : 1 (0x1)
        Format : AAC
        Format/Info : Advanced Audio Codec
        Format version : Version 4
        Format profile : LC
        Muxing mode : ADTS
        Codec ID : 15
        Duration : 9s 856ms
        Bit rate mode : Variable
        Channel(s) : 2 channels
        Channel positions : Front: L R
        Sampling rate : 48.0 KHz
        Compression mode : Lossy

  3. Mic Edwards says:

    I'm curious about the "(Perian)" in the Get Info. Why would Quicktime by handing this off to the Perian codec package for H264?

    • jwz says:

      Good question.

    • Good catch. Another thing to try would checking the contents of [~]/Library/quicktime and possibly removing some or all of the components in the folder, and trying it out. I've found that some badly programmed codecs can really gum things up. (ogg theora codec, I'm looking at you. *deathglare*)

  4. Well, I don't know how to check in a video that's already been created, I would have to google, but at encode time, in handbrake, there's various options you can tweak related to profiles. You could get a very small sample file, try different settings, and see what works and what doesn't. A time consuming and annoying process to be sure, but if there's no other leads of investigation....

  5. Roger says:

    One thing I have experienced on Macs before is bizarre behaviour if the filesystem is not HFS (eg on an external disk that happens to be FAT32).

  6. Patrick says:

    Could I ask if there's a reason you seem to be putting a lot of effort into cramming a square peg into iTunes' round hole? There has got to be a better match somewhere, even if it's Movist in playlist mode. I'm just curious if I'm missing a reason I should be using iTunes for video more than I grudgingly do. And I like iTunes generally.

    • jwz says:

      There's nothing square peg about the iTunes hole. Randomly playing tracks from a large set is what it does. And iPhone Remote works, and and and.

      Obviously I have a lot of complaints about iTunes, but every other media player sucks even more. I would rather eat glass than use VLC.

      • Patrick says:

        Fair enough. I wasn't sure if you were using it for buy-in purposes - iTunes playing directly to one screen and feeding AppleTVs that run other screens, say. Agreed about VLC, though. Occasionally it's the only tool that will play a particularly munged video, but usually something else works.

        It's just that it feels like Apple only put enough support for video into iTunes to make the video store work, and kind of abandoned it after that. I'd love for iTunes to be the destination for my DVDs, but every time I've tried I've run into so many quirky weird problems (i.e. how does it sort TV episodes? By magic, apparently) that I just throw up my hands and go with something else. And even when I used third party solutions like MetaX, it still never quite came together properly.

        It's enough to make one weep. I finally have enough CPU to make video as easy as audio, and the library tools are still circa Winamp v1. Boxee isn't half bad, and Plex has promise, but I don't think either is really suitable for your purposes.

        Oh crud, I'm on a soapbox. S'cuse.

        • My prayer, unlikely to be answered, is that now that the whole "sync hub for all of your apple-branded digital devices" functionality is moving from iTunes to iCloud (and thank god), that someday, possibly, just maybe, someone at apple will decide to actually fix some of the bugs in iTunes related to organizing and playing media, it's alleged stated purpose.

          (Trivia question: how long did it take apple to fix the bug wherein iTunes mangles m3u playlist files if they have unix rather than mac line endings, present in iTunes 1.0 and possibly in SoundJamMP as well? Bzzzt, sorry, trick question: it still does that.)

      • If you are playing videos and using a remote from an iPhone then I recommend XBMC, which now seems to run on everything, has a reasonably nice interface, and plays everything I've seen thrown at it.

  7. pawliger says:

    Does qt_info from http://www.omino.com/sw/qt_tools/ shed any light as to whether the file has anything interesting? qt_thing will also list known QT components it finds so may point out where things differ across the two machines when they otherwise appear like they should be the same.

  8. Joe Crawford says:

    I'm curious to know if you have a similar difference in playability in VLC.app on one machine vs. another?

    I've had similar problems playing podcasts on my old iPod - plays fine in iTunes, seemingly normal .mov or .m4v file, will not play on iPod. Typically I do the "Create iPod or iPhone version" and that resolves it. For higher rez, I expect you might try "Create iPad or AppleTV version" and see.

  9. Matt Ridenour says:

    Remove the Perian QuickTime component and try it again. Perian often preempts the native Apple provided codecs and then fails to deliver.

    • Mic Edwards says:

      Exactly ... (rewind 10 comments) ...

    • jwz says:

      I'll try it, but I do have some videos in there that require Perian to play, so a real solution will need to be more nuanced than that...

      • Components can interfere with each other like a bunch of thistles crammed into your sock. Removing quicktime components and then re-adding them one by one is a useful diagnostic measure. It may be another component interfering with everything, and leading to perian stepping in and failing to deliver- rather than perian itself being purely the problem. Quicktime components are just weird that way.

      • Matt Ridenour says:

        I foresee transcoding in your future...

    • jwz says:

      So, I did a bunch of qt_info/perl/applescript dicking around and categorized all of my videos into playlists by codec. (That was fun.) There was no smoking gun. Assuming that I found them all, it turns out that all of the videos that don't play properly are reported by qt_info as the codec "H264 - " (yes that's a space-dash-space at the end.) However, 11% (hundreds) of my videos are reported as that same codec, and the vast majority of them play fine, so that doesn't really tell me anything.

      Uninstalling Perian doesn't fix it, because it turns out that Perian is required to play "H264 - " videos at all.

      So it's unfortunate that such a large percentage of my videos are in that codec. This must be one of codecs that Youtube uses. I'm guessing it's also what I'm getting out of either Handbrake or MPEG Streamclip under some circumstances (I'm not sure which, yet.)

      I tried to identify all of the "bad" videos by nuking the iTunes thumbnail database and scrolling through Cover Flow until I saw a video with no preview. Videos with no preview don't play right. It's possible that there are also videos that have previews but that don't play right, but I didn't happen to come across any of those.

      • Matt Ridenour says:

        Can you provide a link to a problematic movie file? I can't find or create a "H264 – " video on my own.

        Reinstall Perian and diff the output of qt_thing on the mini and your home Mac.

        Are you using TubeSock to yoink the YouTube rips?

        • jwz says:

          Mailed you a link, since it's big.

          I use my thing to download from Youtube, which grabs the highest resolution version they have available. I'm pretty sure that is still a re-encoded version, not the original upload.

          No change in output on home Mac whether Perian is installed or not. Not able to try it on the Mini right now.

          • Matt Ridenour says:

            I was hoping for a rare Cabaret Voltaire video but that will do...

            I'm unable to reproduce the problem on my home Macs. Everything works even with older versions of the OS and iTunes running on an older Mac Mini. What is the model number of your mini; I may have one at the office?

            I suspect the "H.264 - " string is a red herring and that the problem is something application related on your Mac Mini. Reinstalling iTunes would be a good next step.

            • jwz says:

              I did upgrade iTunes the other day, which I assume does a full re-install rather than a patch, and that didn't change it.

              So wait, you're saying that video plays for you in Quicktime Player without Perian installed? Because it doesn't for me, on either machine. QT Player 7 and 10 both show error dialogs.

              Model Identifier: Macmini2,1
              Processor Name: Intel Core 2 Duo
              Processor Speed: 2 GHz
              Number Of Processors: 1
              Total Number Of Cores: 2
              L2 Cache: 4 MB
              Memory: 2 GB
              Bus Speed: 667 MHz
              Boot ROM Version: MM21.009A.B00
              SMC Version (system): 1.19f0

              System Version: Mac OS X 10.6.7 (10J869)
              Kernel Version: Darwin 10.7.0
              Secure Virtual Memory: Not Enabled
              64-bit Kernel and Extensions: No

              Chipset Model: GMA 950
              VRAM (Total): 64 MB of Shared System Memory
              Vendor: Intel (0x8086)
              Device ID: 0x27a2
              Revision ID: 0x0003

              Displays:
              SAMSUNG:
              Resolution: 1920 x 1080 @ 60 Hz
              Pixel Depth: 32-Bit Color (ARGB8888)

              • Matt Ridenour says:

                I'm have my doubts about how cleanly/completely the iTunes packages from Software Updates do installs. Download the full iTunes installer from the Apple website. I've needed to do that to fix iOS driver problems in the past. You may want to move your current iTunes library and prefs out of the way as well to see if clean ones do any better.

                No, I did use Perian 1.2.2 on all machines.

                I think I have a Macmini2,1 somewhere at work I can test on come Monday.

            • jwz says:

              When I encode a video with either Handbrake or MPEG Streamclip using my usual options, I get "avc1 H.264" that is unplayable without Perian. So apparently those "H264 - " files came from Youtube. (Would be nice to know how to create H.264 videos with Handbrake that are playable without Perian, though.)

              Handbrake:

              MP4 file container, H.264 (x264) Video AAC (faac) Audio
              Picture Size: Source: 640x480, Output: 640x480, Anamorphic: 640x480 Loose, Modulus: 16
              Frame Rate: Same as source (Variable frame rate) Constant Quality: 0.75
              x264 options: ref=2:bframes=2:subq=5:me=umh

              MPEG Streamclip:

              H.264, Quality 65%, MPEG-4 AAC, unscaled, Frame Blending, Better Downscaling, Interlaced Scaling.

              Here's a Youtube video that gives you 488x360 "H264 - " inside an FLV container. If you open it in Quicktime Player and just do "Save", you get a MOV without re-encoding:

              youtubedown 'http://www.youtube.com/watch?v=0MRvPzDxEko'

              Neither of those play without Perian, of course.

              • Matt Ridenour says:

                Do you have the x264 QuickTime component installed? It uses the same implementation of the h.264 that Handbrake does.

                • jwz says:

                  No, I have:

                  /Library/QuickTime/:
                  AC3MovieImport.component/
                  AppleIntermediateCodec.component/
                  AppleMPEG2Codec.component/
                  Perian.component/

                  /System/Library/QuickTime/:
                  ApplePixletVideo.component/
                  AppleProResDecoder.component/
                  AppleVAH264HW.component/
                  QuartzComposer.component/
                  QuickTime3GPP.component/
                  QuickTimeComponents.component/
                  QuickTimeFireWireDV.component/
                  QuickTimeH264.component/
                  QuickTimeIIDCDigitizer.component/
                  QuickTimeImporters.component/
                  QuickTimeMPEG.component/
                  QuickTimeMPEG4.component/
                  QuickTimeStreaming.component/
                  QuickTimeUSBVDCDigitizer.component/
                  QuickTimeVR.component/

                  (That's on the Mini. The iMac has a bunch of other crap in addition to that, but no "x264".)

              • Matt Ridenour says:

                I still can't replicate the problem.

                I DL'd the Le PJHarveyerettes with your script and got it playing on a Macmini2,1 with Perian 1.2.2 but with older versions of iTunes 10.2.1 and Leopard Server 10.5.8.

                The only QT components installed on my mini are the Perian.component and the AC3MovieImport.component. Try pulling out the other components and if that works, add them back until it breaks again.

                I stopped by on Saturday and I gazed a gazely stare at your mini while chewing on my pizza. Did that involve a Ceiling Steen?

                We're running out of column...

  10. Ian says:

    If you're curious what's different between the videos that work and the ones that don't, you could try looking at them with mediainfo. It's the best tool I've found so far for reading container metadata:

    http://mediainfo.sourceforge.net/en

    (The GUI is to be avoided, however. The command-line tool works just fine.)

  11. devon says:

    I did a bunch of video encoding with handbrake recently and had it create subtitle streams for the mp4 files. There was some surprising hiccups on various media players, and I think itunes choked completely on them and quicktime didn't. I don't recall the exact specifics, other than learning "don't bother with subtitle streams". Maybe it's a similar issue? sadly, off hand, I don't know how to determine if an mp4 file has subtitle streams or not.

  12. Jubal says:

    For identifying the h.264 profile, tried mp4info? Part of the MPEG4IP distro... it's been discontinued, but has been ported to OSX so there may be binaries for download somewhere. (The website is up, but downloads are kaput; obtaining from the debian repo might be a better bet.) Anyway, mp4info will show the profile and tracks. For your particular issue, I wonder if iTunes doesn't like the way the dimensions are specified (strict, loose or non-anamorphic, etc.) Hope this helps!

    % mp4info --version
    mp4info - mpeg4ip version 1.6

    This movie I had was encoded with AppleTV 2 as the target profile (Mac Mini should be equivalent, I'd think):

    % mp4info movie.m4v
    mp4info version 1.6
    movie.m4v:
    Track Type Info
    1 video H264 High@3.1, 8296.913 secs, 2695 kbps, 960x704 @ 23.976026 fps
    2 audio MPEG-4 AAC LC, 8296.981 secs, 119 kbps, 48000 Hz
    3 audio ac-3, 8296.960 secs, 640 kbps, 48000 Hz
    4 sbtl
    Tool: HandBrake 0.9.5 2011010300