Wednesday, July 20, 2011

2 6 4 H what browser do we 'preciate

So Lion came out today and as expected it only serves to make Macs stupid. So maybe we were the smart ones for sticking with PowerPC after all. Still, Walt Mossberg likes it, in the way he likes most things Apple puts out, as I found out from watching his H.264 video at the Wall Street Journal. ... Oh, snap! Did I not tell you? Let's watch H.264 videos from TenFourFox! Not even Firefox can do this trick!

Because Flash or Safari are obviously the only ways to watch H.264 video online from a Power Mac, and we're trying to jettison Flash, an idea I'd had kicking around for awhile was to enable a QuickTime window so that you could watch the video, at least, even if it wasn't composited into the browser. While fiddling around with 6.0, I realized that Firefox's js-ctypes module could allow the browser to do this kind of manipulation in JavaScript. Better still, it could be implemented as an add-on so that people who want to play with it can. Even better still, Mozilla had a supported example of feeding images to iPhoto which I could modify to feed videos to QuickTime. It just needed to be updated to be a restartless Jetpack, which I've done too.

The trick is QuickTime Media Links (.qtl), a little-used feature of QuickTime classic -- but notably not QuickTime X -- which lets you build lightweight Internet "media shortcuts" and feed them to QuickTime Player, which then goes and fetches the video online for you. So this add-on is, in essence, quite simple: select a media element (video, audio and images are supported), determine its source and write up a temporary .qtl file, and then feed that to QuickTime Player. QuickTime handles all the streaming and playback. No mucking around with AppleScript, just "clean" CoreFoundation code. In practice it's not quite that simple, but we'll talk about the limitations in a bit after you've had a chance to play.
  1. Download the add-on. Don't install it yet. Remember, this is alpha software. It has not been well-tested on 10.5 or on a large number of sites.
  2. These make good demos: either Walt Mossberg's Lion video review, which won't play at all in TenFourFox, or this HTML5 video test, which will normally play WebM in TenFourFox (but has H.264 as an alternate). Open it up for the standard behaviour to see what it does without the add-on.
  3. Drop the add-on on the TenFourFox window. This extension is only supported for TenFourFox 6. I do not plan to support it in 5 or 4. You will be prompted to confirm its installation. It will install without a restart.
  4. Now, right-click or Ctrl-click the video. There's a new choice: Open Media in QuickTime. Click it. A dialogue will tell you the new destination (mostly for debugging purposes). Then QuickTime Player will open, and ...
  5. OMG!
The extension works for images, HTML5 audio and HTML5 video (although audio is not well tested yet). It will scan the available choices and prefer MPEG-4 (or MPEG-4 in an MOV container) since MPEG-4 can be hardware accelerated in QuickTime; otherwise it will go with what it can get. Images work too, mostly for purposes of demonstration. I'm considering making it prefer MP3 audio, but haven't decided about that yet.

Here's what doesn't work:
  • WebM video for some reason won't play, even with Perian 1.2.2 installed, and I'm not sure why (QuickTime objects to the video format). I'm not really too concerned about this since the browser can play it, but it would be nice because it would expand the number of machines that can handle WebM video. I'm wondering if its media sniffing code is failing and I have to hint it a bit more.
  • Autoplay doesn't work, even though I'm asking QuickTime to do it.
  • Not all elements are detected by Firefox's context menu code as qualifying selectors, so some video elements will not offer you the option. I may need to simply ask for 'everything' and then filter it myself rather than relying on the browser.
I don't plan to make this a part of the browser for awhile, mostly because it needs a lot more testing and because even when it will be working it's still somewhat of a hack. Still, it does work, and gives us another way to keep our Power Macs supported with modern Web video. Please give it a try and let me know your thoughts. Remember, this is very alpha and very unfinished.

I have not heard much noise from Mozilla about the next 6.0 release. I am presently in the process of moving to a new house, so I will not able to generate builds for about a two-week period starting next week as the G5 is in transit. With luck this should coincide with the 6.0RC, since there have been no major problems reported thus far. Your patience is appreciated.

24 comments:

  1. Oh, here's another tip. Try, say,

    http://www.mozilla.com/en-US/firefox/video?video=brand

    You have to start the video playing, but then you can right-click on it and select the H.264 version (which is much nicer than WebM). So this will probably help for those videos that don't immediately get recognized as videos.

    ReplyDelete
  2. Very nice idea. This is probably the only way to get videos to play on slow Macs, because in the browser, performance will always be worse. Not so speak about hardware acceleration in QuickTime Player. The add-on seems to work just fine in 10.5.

    Two problems with Youtube (plugins in TFF are disabled): 1) When you're in the html5 trial, YouTube serves html5 video. Okay. If the video video is not encoded in webm (only in h.264), Youtube tries to serve the flash version. But I don't have flash. Now it doesn't tell me about a "missing plugin" or about "webm vs. h.264", it tells me to upgrade my flash player to v10. If I switch the useragent string to, let's say, Safari Mac on 10.6, it *does* tell me that my browser doesn't recognize the video format. So YouTube is just stupid. I have no chance to watch the video because I never get a link or anything that points me to the h.264 version. 2) If the video *is* available in webm, the right-click menu in TFF is disabled, so I can't try to send it to QuickTime Player even if that played webm via Perian.

    About webm not playing in QuickTime Player: If I go here: http://tinyvid.tv/show/1e8a96g909ycv, the video+audio plays fine in TFF (webm). "Open Media in QuickTime" (Perian installed) does nothing. If I remove Perian and use the old XiphQT (decoders).component, it plays only the sound (but at least that tells me that the QT Player knows what to do). So I don't know if hinting is the problem. These QuickTime components just don't seem to work right with ogg. http://media.tinyvid.tv/1e8a96g909ycv.ogg plays without problems in VLC (1.1.11). If I try this one: http://double.co.nz/video_test/test2.html, it works! So there seem to be ogg versions that Perian can't handle.

    ReplyDelete
  3. Ups. http://double.co.nz/video_test/test2.html only works with XiphQT (decoders).component installed. Sorry. Perian just doesn't play ogg (couldn't find a single ogg video that works with Perian).

    ReplyDelete
  4. Isn't that the same as https://addons.mozilla.org/en-US/firefox/addon/flashvideoreplacer/
    Flash video replacer. It is even compatable with FlashBlock ;)
    Cheers

    Angel Paraskov

    ReplyDelete
  5. I've never used that extension, but it serves a different purpose anyway: it works to rewrite Flash player apps on specific sites as HTML5 video. It doesn't appear to do anything with already existing video tags, and the author says it cannot launch an external player on Mac on their development page. However, the two extensions might be able to work together.

    Chris, I saw that same issue with YouTube. I'm half tempted to make the extension fudge a "Safari" into the UA string so that H.264 sites think it's Safari and offer up H.264 media. This will probably help Vimeo too. I might do that for the next test version. I'm glad to hear there were no issues on 10.5, though -- I was a little worried the ctypes skulduggery wouldn't work quite right on it.

    ReplyDelete
  6. Forgive me in advance for being terribly naive here. Or querying what may have been covered extensively in previous posts.

    I don't care for Flash. I'm impressed that TenFourFox 6 may have the facility to play HTML5 audio and HTML5 video. At present I am running TenFourFox on an iMac G5 PPC, Tiger. With no plans to 'upgrade' to Intel. Or Leopard, even.

    The demise of extension support concerns me a great deal: that 6 might break existing extensions. I have already lost useful extensions which ran in FF 3.6. 1Password, in particular, although Abine has plugged that gap to a certain extent.

    On the other hand, I don't wish to be left behind with a browser full of security holes.

    If I download 6 in Beta, launch it on the same FF profile, might it irreparably damage backwards compatibility ?

    QuickJava, FlashBlock, Better Privacy, Ghostery and Javascript Deobfuscator are some further extensions I would hate to lose.

    ReplyDelete
  7. Of course, could be I'm simply confusing Extensions with Plugins. In which case I have even more egg on my face.

    ReplyDelete
  8. @ib: You can switch between TFF5 and TFF6b1 on the same user profile without breaking anything. Switching between, let's say, 3.5 and 6 may be a problem, though. And yes, you were confusing extensions with plugins. Extensions (as long as they don't require an Intel processor) are supported. Plugins (flash, quicktime, real player, pdf-viewer etc.) are going away, although in TFF6 they still work (mostly).

    @Logout: QuickTime and QuickTime Player are part of Mac OS X, so eveybody has it installed. To be honest, I never even heard of Movist. VLC might me an alternative, though, but it doesn't seem to use hardware acceleration (not sure).

    ReplyDelete
  9. Also, I'm pretty sure that there are technical differences in letting QuickTime Player vs. any other player know which video it's supposed to play.

    ReplyDelete
  10. Correct on both counts. Add-ons (Mozilla's preferred term for what used to be called extensions) remain supported as long as they don't have any binary components that require Intel. Plugins like Flash are what 6.0 will deprecate and there are some signs 7.0 will make this worse: more when Aurora stabilizes.

    I would not recommend switching between 3.5 (or any unsupported version) and any currently supported version. You can update, of course, but the reverse process can corrupt your profile. 3.6 is still supported by Mozilla and you can freely jump back and forth with that, so I would update to 3.6 first.

    The extension uses a QuickTime-specific feature to pass the movie URL and relies on QuickTime to actually do the streaming playback. If another app supported .qtl files or possibly a similar "shortcut" format, it should work; give me suggestions and pointers to the media shortcuts it supports, and I'll look into it.

    I've discovered jetpacks don't let you do things like alter the user agent as easily, so for now I'd just use one of the existing user agent add-ons and set it to Safari for those sites you know are sniffing Firefox and not offering H.264 content.

    ReplyDelete
  11. Logout said...
    on almost every PowerPC Mac VLC is slow as hell.


    VLC 1.1.10.1 plays back videos (in pretty much every case) better than QuickTime Player v7.6.9 on my iMac G5 running Leopard. VLC only really got good at version 1 though... of course, Tiger users are stuck on VLC 0.9.10.


    Logout said...
    Movist on the other hand is very fast - probably the only solution for "modern" video formats like x264 inside MKV container, which is what most 720p and 1080p movies from BR disc are encoded into, when saved to harddrive. Quad G5 can with Movist play any MKV video, my dual G5 2.0 can play at least 720p, so I consider it faster than either QT Player or VLC.


    On the iMac G5 I mentioned before (2.1 GHz PowerPC G5; 2.5 GiB DDR2 SDRAM; ATI Radeon X600 XT), QuickTime Player somewhat struggles with 720p H.264 MKV videos even with all other applications closed, while VLC will play the same video perfectly (only with all other applications closed, though; it stutters too if a few other apps are open as well). I'm am somewhat curious to see how well Movist will do on this hardware... but in any case, VLC is certainly not as bad as you seem to claim.

    ReplyDelete
  12. @Logout
    try http://mplayer-osx-ppc.mac.informer.com/
    with additional parameters:
    -really-quiet -framedrop -lavdopts skiploopfilter=all:skipframe=nonref -vo quartz
    or www.xbmc.org

    You'll be able to play 1080p mkv on single core 1.8 GHz G5

    ReplyDelete
  13. Coreplayer is the best solution I've found for HD on PPC. Its proprietary software decoder is truly awesome.Its payware, doesn't seem to be being updated, but worth the twenty bucks IMHO. With it I have no problem playing 720p on my lowly 1.2 ghz ibook G4. I shudder to think of what it could do on a dual core G5. Oh, wait here is a youtube vid from some dude in I think Romania where he compares coreplayer and vlc on a G5.He has another where he compares the same HD file on an ibook as well.

    http://www.youtube.com/watch?v=M5vaUIW6XOs

    I am anxious to try out that mplayer hack. I tried the trick via ppcluddites blog and couldn't get videos to play from the non gui mplayer like he could though.

    ReplyDelete
  14. Is it not possible to use Twitter in TenFourFox 5.0? I'm running 10.5.8 on a PowerPC G4 and I receive nothing but blank pages on any Twitter page I attempt to load. I assume this is attributable to the lack of Java support. What's the workaround?

    ReplyDelete
  15. The Twitter problem is due to a change in their code that exceeds default regex memory bounds (issue 77). A putative fix is in 6.0b1, which appears to work. You are welcome to download it and see if it works for you, but because of the nature of the fix, I do not plan to backport it to 5.

    ReplyDelete
  16. @dr.dave
    I agree with you.
    CorePlayer is my next purchase with my next salary :)
    I'm sure I'll be able to get 1080p on my Powerbook G4 1.67GHz, and it is not even using the video card.

    ReplyDelete
  17. @dr.dave, @Logout
    Check this - http://www.youtube.com/watch?v=aHhWsrWz2Ns
    iBook G4, 1.33GHz PowerPC is capable to run 1080p fluid!
    WOW

    ReplyDelete
  18. We're off-topic, so I'll keep it short: It's the compression method that matters, not so much the video resolution.

    ReplyDelete
  19. Oh, I'm not concerned about the topicality. This has been a very interesting discussion. I'm looking at CorePlayer closely, though QuickTime plays 1080p well enough on my quad (admittedly with a 7800GT).

    Just an FYI, my new ISP is still sitting on my line, so there will be a few days downtime, which I'm quite unhappy about. I'll post a blog note when I know more. It shouldn't delay the final release however.

    ReplyDelete
  20. Because of the many tips here concerning video players I also tried out various files with various players in their latest releases; QuickTime (with Perian), Mplayer OS X Extended, VLC, XBMC.
    I tested with several encodings of "Big Buck Bunny" (http://download.blender.org/peach/bigbuckbunny_movies/).

    The results for fluid playback on a PB G4 1,5 GHz, GeForce FX are:

    Mplayer:
    MPEG4 up to 480p (720p constantly dropping a few frames)

    QuickTime:
    MPEG4 up to 480p
    H264 up to 360p (480p stutters a little when picture changes a lot)

    VLC:
    MPEG4 up to 720p
    H264 up to 480p (720p stutters when picture changes a lot)

    XBMC:
    MPEG4 up to 720p (1080p stutters when picture changes a lot)
    H264 up to 480p (720p stutters a little when picture changes a lot)

    So XBMC is the fastest one (I attribute it to directly using the shaders of the GeForce FX to do the color space conversion and the scaling).
    VLC surprises with excellent perfomance in it's later versions (I switched off the loop filtering in the advanced settings and enabled all the "hurry up" checkboxes).
    QuickTime with Perian surprises with relatively bad performance.
    Mplayer OS X Extended simply cannot compete (I manually added "-really-quiet -framedrop -lavdopts skiploopfilter=all:skipframe=nonref" to the mplayer options).

    Note that not only the codec determines up to which resolution the playback is fluid but also framerate and quality chosen for encoding. For example my camera can make 720p and 1080p H264 movies which don't play well not even in XBMC because they are encoded with 30 fps whilst "Big Buck Bunny" is encoded with 24 fps.

    Having CoreAVC plugins for VLC and/or XBMC surely would be great - but it isn't open source.

    ReplyDelete
  21. DivX Player:
    MPEG4 up to 480p
    H264 up to 360p

    In total a little bit slower than QuickTime.

    ReplyDelete
  22. @Logout:

    What are your results with XBMC (current version)? ( http://mirrors.xbmc.org/releases/osx/ppc/xbmc-10.1-ppc.dmg )
    It should definitely be faster than Movist!

    ReplyDelete
  23. I tested the H264 video extension in TFF 4.0.3 on Mac OS X 10.4.11 and it works perfectly.

    It may not be supported, but it does work.

    ReplyDelete
  24. Howdy!

    I just bought CorePlayer 1.3.6 on Mobihand but the serial isn't working. Mobihand hasn't solved the problem and the developer doesn't answer. How did you guys get your CorePlayer serial working?

    ReplyDelete

Due to an increased frequency of spam, comments are now subject to moderation.