Sunday, March 31, 2019

TenFourFox FPR14b1 available (now with H.264 video)

TenFourFox Feature Parity Release 14 beta 1 is now available (downloads, hashes, release notes).

I had originally plotted three main features for this release, but getting the urgent FPR13 SPR1 set me back a few days with confidence testing and rebuilds and I have business trips and some vacation time coming up, so I jettisoned the riskiest of the three features (a set of JavaScript updates and a ugly hack to get Github and other sites working fully again) and concentrated on the other two. I'll be looking at that again for FPR15, so more on that later.

Before we get to the marquee features, though, there are two changes which you may not immediately notice. The first is a mitigation for a long-standing issue where some malicious sites keep popping up authentication modals using HTTP Auth. Essentially you can't do anything with the window until the modal is dealt with, so the site just asks for your credentials over and over, ultimately making the browser useless (as a means to make you call their "support line" where they can then social engineer their way into your computer). The ultimate solution is to make such things tab-modal rather than window-modal, but that's involved and sort of out of scope, so we now implement a similar change to what current Firefox does where there is a cap of three Cancels. If you cancel three times, the malicious site is not allowed to issue any more requests until you reload it. No actual data is leaked, assuming you don't type anything in, but it can be a nasty denial of service and it would have succeeded in ruining your day on TenFourFox just as easily as any other Firefox derivative. That said, just avoid iffy sites, yes?

The second change is more fundamental. For Firefox 66 Mozilla briefly experimented with setting a frame rate cap on low-end devices. Surprise, surprise: all of our systems are low-end devices! In FPR13 and prior, TenFourFox would try to push as many frames to the compositor as possible, no matter what it was trying to do, to achieve a 60fps target or better. However, probably none of our computers with the possible exception of high-end G5s were probably achieving 60fps consistently on most modern websites, and the browser would flail trying to desperately keep up. Instead, by setting a cap and enforcing it with software v-sync, frames aren't pushed as often and the browser can do more layout and rendering work per frame. Mozilla selected a 30fps cap, so that's what I selected as an arbitrary first cut. Some sites are less smooth, but many sites now render faster to first paint, particularly pages that do a lot of DOM transforms because now the resulting visual changes are batched. This might seem like an obvious change to make but the numbers had never been proven until then.

Mozilla ultimately abandoned this change in lieu of a more flexible approach with the idle queue, but our older codebase doesn't support that, and we don't have the other issues they encountered anyway because we don't support Electrolysis or APZ. There are two things to look at: we shouldn't have the same scrolling issues because we scroll synchronously, but do report any regressions in default scrolling or obvious changes in scroll rate (include what you're doing the scrolling with, such as the scroll bar, a mouse scroll wheel or your laptop trackpad). The second thing to look at is whether the 30fps frame rate is the right setting for all systems. In particular, should 7400 or G3 be even lower, maybe 15fps? You can change this with layout.frame_rate to some other target frame rate value and restarting the browser. What setting seems to do best on your machine? Include RAM, OS and CPU speed. One other possibility is to look at reducing the target frame rate dynamically based on battery state, but this requires additional plumbing we don't support just yet.

So now the main event: H.264 video support. Olga gets the credit here for the original code, which successfully loads our separately-distributed build of ffmpeg so that we don't run afoul of any licenses including it with the core browser. My first cut of this had issues where the browser ran out of memory on sites that ran lots of H.264 video as images (and believe me, this is not at all uncommon these days), but I got our build of ffmpeg trimmed down enough that it can now load the Vimeo front page and other sites generally without issue. Download the TenFourFox MP4 Enabler for either G4/7450 or G5 (this is a bit of a misnomer since we also use ffmpeg for faster MP3 and VP3 decoding, but I didn't want it confused with Olga's preexisting FFmpeg Enabler), download FPR14b1, run the Enabler to install the libraries and then start FPR14b1. H.264 video should now "just work." However, do note there may be a few pieces left to add for compatibility (for example, Twitter videos used to work and then something changed and now it doesn't and I don't know why, but Imgur, YouTube and Vimeo seem to work fine).

There are some things to keep in mind. While ffmpeg has very good AltiVec support, H.264 video tends to be more ubiquitous and run at higher bitrates, which cancel out the gains; I wouldn't expect dramatic performance improvements relative to WebM and while you may see them in FPR14 relative to FPR13 remember that we now have a frame rate cap which probably makes the decoder more efficient. As mentioned before, I only support G4/7450 (and of those, 1.25GHz and up) and G5 systems; a G4/7400 will have trouble keeping up even with low bitrates and there's probably no hope for G3 systems at all. The libraries provided are very stripped down both for performance and to reduce size and memory pressure, so they're not intended as a general purpose ffmpeg build (in particular, there are no encoders, multiplexers or protocols, some codecs have been removed, and VP8/VP9 are explicitly disabled since our in-tree hyped-up libvpx is faster). You can build your own libraries and put them into the installation location if you want additional features (see the wiki instructions for supported versions and the build process), and you may want to do this for WebM in particular if you want better quality since our build has the loop filter and other postprocessing cut down for speed, but I won't offer support for custom libraries and you'd be on your own if you hit a bug. Finally, the lockout code I wrote when I was running into memory pressure issues is still there and will still cancel all decoding H.264 instances if any one of them fails to get memory for a frame, hopefully averting a crash. This shouldn't happen much now with the slimmer libraries but I still recommend as much RAM as your system can hold (at least 2GB). Oh, and one other thing: foxboxes work fine with H.264!

Now, enjoy some of the Vimeo videos you previously could only watch with the old PopOutPlayer, back when it actually still worked. Here are four of my favourites: Vicious Cycle (PG-13 for pixelated robot blood), Fired On Mars (PG-13 for an F-bomb), Other Half (PG-13 for an F-bomb and oddly transected humans), and Unsatisfying (unsatisfying). I've picked these not only because they're entertaining but also because they run the gamut from hand-drawn animation to CGI to live action and give you an idea of how your system performs. However, I strongly recommend you click the gear icon and select 360p before you start playback, even on a 2005 G5; HD performance is still best summarized as "LOL."

At least one of you asked how to turn it off. Fortunately, if you never install the libraries, it'll never be "on" (the browser will work as before). If you do install them, and decide you prefer the browser without it, you can either delete the libraries from ~/Library/TenFourFox-FFmpeg (stop the browser first just in case it has them loaded) or set media.ffmpeg.enabled to false.

The other, almost anticlimactic change, is that you can now embed JavaScript in your AppleScripts and execute them in browser tabs with run JavaScript. While preparing this blog post I discovered an annoying bug in the AppleScript support, but since no one has reported it so far, it must not be something anyone's actually hitting (or I guess no one's using it much yet). It will be fixed for final which will come out parallel with Firefox 60.7/67 on or about May 14.

20 comments:

  1. [ChrisT.] MP4 playback is a valuable addition to the browser since lots of information on the web is hidden within videos nowadays, many of which are MP4 only.

    Testing MP4 playback with the usual suspects on my 1.67 GHz G4 PowerBook:

    YouTube: Works. YT seems to prefer webm with this browser. If webm is disabled (and mediascource.mp4 enabled for additional playback options), H.264 videos play nicely with performance on par or slightly better than VP9. The notable difference is that when I click Pause while the page is still loading, the video pauses instantly and doesn't start playing by itself again.

    Vimeo: works, no problems encountered.

    Facebook: works, no problems encountered (go to FB's preferences and choose Videos>SD only).

    Instagram: Would likely work if we didn't have some CSS problem right now that prevents the poster frame and Play button from showing up in the first place. [This has occurred recently and has nothing to do with mp4 support per se. Until a few days ago you'd at least get the poster frame and a dysfunctional play button.] If you click View>Page Style>No Style the poster frame and Play 'button' ('Play Control' JS link) become visible; if you click 'Control' the video plays fine. Right-clicking the video reveals the usual playback options. It's better to do this with the video loaded in a new tab instead of the overlay. (Videos in Stories do work as-is.)

    Twitter: I can't get videos or "GIFs" to work at all in the Twitter stream, mobile or desktop.

    Some high profile sites from my neck of the woods like spiegel.de, heise.de, plus a few German Public TV media portals I tested (including live streaming), also work.

    Switching to the lowest available quality is advisable. For videos that automatically use the full width of the browser window it helps a lot to make the window a lot smaller. Installing G4FanControl is also advisable to keep temperatures in notebooks below 56 ºC/133F when excessively watching videos with this newly gained capability.

    I'll have a look at layout.frame_rate later.


    ReplyDelete
    Replies
    1. Good to hear Facebook works, at least. The YouTube bit sounds like we might need to toggle on a few more options, but I don't want to turn off WebM by default, so I'll have to ponder this one. I'll look at Instagram separately.

      Delete
  2. [ChrisT.] layout.frame_rate: The feature works as advertised. You can test this by setting it to 1 per second and then observe the result :-) I set it to the European TV standard of 24 frames and didn't notice a difference compared to the default of 30 frames. However, setting it to 15 I got the (unscientific) impression that the browser is actually doing additional work to enforce this limit (?) and thereby getting slower than it needs to be. At least the UI seemed a slower to react to clicks.

    ReplyDelete
    Replies
    1. Noted. Then I think we're better off leaving it at 30 for the time being. Maybe we'll consider 24 for G3 or 7400, but definitely not 7450 or G5.

      Delete
    2. AFAIK, except if there was a very recent change ;-) the European TV standard is 25 frames per sec (24 is for cinema) — I'm French and have worked as a video editor for a decade, if you have any doubt. :-)

      Delete
  3. [ChrisT.] Twitter video:

    So Twitter seems to use at least two different types of embedding video in their streams. Those embedded directly play fine provided that mediasource.mp4 is enabled. Those embedded in a 'PlayableMedia-container' with a myriad of divs inside do not play. Of each there are at least two sub-types yielding different results.

    Examples:

    https://twitter.com/hoemoticon/status/1113631574594084864
    -> 'ext_tw_video', presented as video with play count and play time, autoplays, plays OK

    https://twitter.com/OPfandom/status/1114212352180854785
    -> direct tweet video, presented as 'GIF' (but is mp4), autoplays, plays OK

    https://twitter.com/faIIoutbay/status/1112745929474564096
    -> hidden inside PlayableMedia-container, presented as video with play count and play time, poster frame loads ok, Play button displayed for a second then vanishes, doesn't autoplay, doesn't react to clicks, results in poster frame displayed continuously

    https://twitter.com/hoemoticon/status/1112759496877752320
    -> hidden inside PlayableMedia-container, presented as video with play count and play time, poster frame plus Play button displayed for a second, tries to autoplay, doesn't react to clicks, results in grey screen 'The media could not be played.'

    ReplyDelete
    Replies
    1. I guess the second two are using some feature we don't currently support. I can see what you're seeing. MSE doesn't seem to make a difference, so I don't think it's that. I don't see anything in the logs so I'm not sure what else we're missing yet.

      Delete
  4. Hi, I've just tested FPR14b1 on my iMac G5 2ghz with the H.264 video support and it works a bit better than VPx for me, so it's great. For now on, the primary role of my IMac G5 will be to play music, as it has amazing speakers. I have not tested FPR14b1 on my dual-core 2.3ghz PowerMac G5, but it should work quite well. Much much faster than the iMac.

    I have a 12 inch PowerBook G4 1ghz 1.25gb of Ram that I would like to donate to you, to thank you for your hard work on supporting PPC Macs. I installed in it a 32gb SD Card in a SD-to-IDE adapter, as a ''SSD''. If you are interested, tell me and I'll happily send it to you!

    -Alexandre

    ReplyDelete
    Replies
    1. That's very kind of you, but I've already got a couple 12" systems (and I'm typing this reply on a 12" iBook G4). I appreciate the thought though!

      Delete
  5. I set layout.frame_rate to 30. For some reason mine was '-1'.. This is a big difference on my Quad just in starting up TFF with 1 blank tab. The interface is much quicker. What does '-1' end up doing? As many as possible?

    In regard to h264, thank you. Not the best devices to use these day for online video, but the option is good. :)

    Is it in anyway possible to simply not play videos higher than say 480p or 360p? I assume the webpages determine what resolution using a somewhat common method and use of information.

    ReplyDelete
    Replies
    1. I believe -1 is the default. If I had to guess it means either "off" or "no limit".

      I've set it to 30 on my Quad G5 and 20 on my 1Ghz 17" PowerBook G4.

      Delete
    2. Although -1 is indeed "no limit" the code has an internal hard cap to not allow past 30, and to enforce software v-sync, so I'm not sure what you're seeing here. Previously it was 60fps but no vsync so that was effectively "as fast as possible." The vsync caps the frame rate. There's no harm in doing what you're doing (it's setting it to the rate it's already capped to), but it shouldn't be necessary and I'd like to get more data points.

      Delete
    3. In answer to your other question you're kind of at the mercy of the web page, unfortunately. At least YouTube and Vimeo let you pick video quality (the gear icon). I'd go as low as you can stand.

      Delete
  6. i can't install in osx 10.4.0 i have an ibook G4 7450 and it says: the application "tenfourfox7450" can not be used with this version of Mac OS X. what can i do?

    ReplyDelete
    Replies
    1. You need to update your Mac to 10.4.11. The combo installer is still available from Apple: https://support.apple.com/kb/DL170?locale=en_US

      Delete
  7. While it's nice to be able to switch this H.264 off for the main browser, it ROCKS in FoxBoxes. Bravo to you and Olga for this.

    ReplyDelete
  8. [ChrisT.]Look what I found: legacycollector.org
    Under 'Legacy Mozilla Firefox extensions' they have a gazillion non-webextension add-ons, many with several versions each, most of which should be compatible with TFF.

    ReplyDelete
  9. Hello

    Just updated my PB G4 12" to 1.25GB (previously 756MB).
    Tenfourfox is much faster now.

    Or maybe the entire system is faster in general.


    Only question, I still see a lot of VM usage from TenFourFox (2.18GB in this moment), when the "real memory" usage is low (312MB). Is this normal ?

    Thanks
    Marco Nice FR

    ReplyDelete
    Replies
    1. Probably the entire system. That's not a lot, even for Tiger.

      TenFourFox maps at least 1GB of memory for the stack. This is mapped and not populated initially, but it's set aside so that JavaScript will not overrun the browser stack allocation and it can be used if there is a complex set of scripts running. I'd say the amount you're reporting is pretty typical for most sites.

      Delete

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