Tiny Core Linux

Tiny Core Extensions => TCE Tips & Tricks => Topic started by: dentonlt on June 06, 2015, 02:05:55 AM

Title: firefox: enable HTML5 video + audio
Post by: dentonlt on June 06, 2015, 02:05:55 AM
I had some trouble getting HTML5 av working in Firefox, but all set now. In case anyone else goes this way, this is what is working for me on an Acer C720 Chromebook running TC 6.x.

If anyone has luck without pulseaudio (ALSA only) or just has a faster/slimmer way, I'll be interested to hear.

1) Turn on dbus from ~/.X.d . I use:
Code: [Select]
/usr/local/share/etc/init.d/dbus start
2) Turn on pulseaudio from ~/.X.d . I use:
Code: [Select]
/start-pulseaudio-x11
3) Install extensions. Installation order sometimes matters. ffmpeg, gst-ffmpeg, and the gstreamer plugins need to be in place at the time firefox is started. Perhaps not necessary to on-boot, but this is what I do:

- dbus [onboot]
- alsa-config [onboot]
- alsa [onboot]
- pulseaudio [onboot]
- ffmpeg
- gst-ffmpeg
- gst-plugins-good0.10
- gst-plugings-ugly0.10
- firefox-official (I used firefox-get.tcz to create this)

4) Start firefox. Browse to about:config and change the following values:

media.fragmented-mp4* = true
media.fragmented-mp4.use-blank-decoder = false [if you're getting green video blocks, this is probably not set correctly]
media.mediasource.enabled = true
media.mediasource.mp4.enabled = true

5) Test via YouTube or an online HTML5 Video/audio test page. First bug check is to just restart firefox.

In my case, failed video was due to missing extensions: gst-plugins-ugly with x264 provides mp4 playback. Failed audio was due to an incorrect system audio setup: ALSA alone fails; gst-plugins-good gives firefox access to pulseaudio.

HTH
Title: Re: firefox: enable HTML5 video + audio
Post by: coreplayer2 on June 06, 2015, 08:28:49 AM
Great, thanks for this info

however...
Quote
firefox-official (I used firefox-get.tcz to create this)
firefox-get is outdated, instead use the updated firefox-latest extension (based on firefox-get) which will auto-detect and create a firefox-official extension based on the latest version of firefox, or a version of your choice if specified for both tc5.x & tc6.x  in  x86 & x86_64 repo's

The thought now crossed my mind to rename the firefox-latest to firefox-get  and continue with updates to that extension ?? 
Title: Re: firefox: enable HTML5 video + audio
Post by: dentonlt on June 07, 2015, 12:48:18 AM
Thanks for this, coreplayer. I think you're right - I would have used the firefox-latest extension. Typo on my part.

I'll fix the original text, above =)

EDIT: Hmm. Or maybe I won't - no edit tab there now. Must be new timeout policy since I was last in :p
Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 17, 2015, 02:35:14 PM
If anyone has luck without pulseaudio (ALSA only) or just has a faster/slimmer way, I'll be interested to hear.

[...]

In my case, failed video was due to missing extensions: gst-plugins-ugly with x264 provides mp4 playback. Failed audio was due to an incorrect system audio setup: ALSA alone fails; gst-plugins-good gives firefox access to pulseaudio.

Unfortunately the Firefox extensions in the Tiny Core Linux repos are not built with --enable-gstreamer=1.0 and therefore Firefox can only use the old and outdated GStreamer 0.10 instead of the new GStreamer 1.0 (1.x).

I've asked coreplayer2 to build the Firefox extensions with --enable-gstreamer=1.0 in the respective thread:

http://forum.tinycorelinux.net/index.php/topic,18943.0.html

On Ubuntu 15.10 for example, Firefox is built with --enable-gstreamer=1.0 and then gst-plugins-ugly does not seem to be needed. gst-plugins-base and gst-plugins-good seem to suffice when using GStreamer 1.0 (1.x), at least on Ubuntu.

So, it would be really nice if coreplayer2 would build the Firefox extensions with --enable-gstreamer=1.0.

Regards
Title: Re: firefox: enable HTML5 video + audio
Post by: dentonlt on October 17, 2015, 03:04:27 PM
Ah - of course. I think coreplayer2 has focused on wrapping pre-built binaries, but this definitely points in the right direction for a build script. I'll experiment with this.

Sent from my HTC_0P6B6 using Tapatalk

Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 17, 2015, 03:28:45 PM
Ah - of course. I think coreplayer2 has focused on wrapping pre-built binaries

The official Linux binaries from Mozilla are not built with --enable-gstreamer=1.0 yet, see:

https://bugzilla.mozilla.org/show_bug.cgi?id=947287

As you can read over there, currently it's still up to the distro maintainers to decide whether or not they build Firefox with --enable-gstreamer=1.0, since apparently some distros still are relying on the old and outdated GStreamer 0.10 and do not have the new GStreamer 1.x in their repos yet.

Ubuntu for example has GStreamer 1.x and it has Firefox built with --enable-gstreamer=1.0.

Since Tiny Core Linux also has GStreamer 1.x in it's repos already, it should also have it's Firefox extensions built with --enable-gstreamer=1.0 IMHO.

It would be really nice if someone would do it.

Regards
Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 17, 2015, 03:33:51 PM
PS:

Whoops, actually it seems like HTML5 video soon will be done via FFmpeg/Libav instead of GStreamer, see:

https://bugzilla.mozilla.org/show_bug.cgi?id=1212916
https://bugzilla.mozilla.org/show_bug.cgi?id=1207429
https://bugzilla.mozilla.org/show_bug.cgi?id=1213499

 ;)

Regards
Title: Re: firefox: enable HTML5 video + audio
Post by: dentonlt on October 17, 2015, 04:24:42 PM
All that makes sense - I think gstreamer-0.10 wasn't enough to get my current ff working with a/v. Had to add ffmpeg and such.

I'll see if I can whip up a flexible extension builder that downloads the current source.

Sent from my HTC_0P6B6 using Tapatalk

Title: Re: firefox: enable HTML5 video + audio
Post by: Juanito on October 17, 2015, 10:02:17 PM
FYI - html5 works with epiphany with the default deps
Title: Re: firefox: enable HTML5 video + audio
Post by: coreplayer2 on October 17, 2015, 11:42:45 PM
Firefox > YouTube > HTML5 - Video with sound has been supported for quite some time
(https://db.tt/pT7VbdXS)

I watch HTML5 video in Firefox all the time though I prefer using flash
Am I missing something?
Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 18, 2015, 02:12:38 AM
Firefox > YouTube > HTML5 - Video with sound has been supported for quite some time

I watch HTML5 video in Firefox all the time though I prefer using flash
Am I missing something?

Yes, you do seem to miss something, but let me explain ;):

First of all, I guess this thread is not really about HTML5 video in general, but rather specifically about MP4 (H.264 video / AAC audio) instead.

Yes, of course Firefox supports HTML5 video and audio for quite some time.

But there's a difference between WebM (VP8/VP9 video and Vorbis/OPUS audio) and MP4 (H.264 video and AAC audio).

Firefox for Linux supports WebM directly, but not MP4.

On Linux, Firefox currently relies on GStreamer to play MP4 (H.264/AAC) via HTML5.

Currently Firefox makes use of the old and outdated GStreamer 0.10 by default.

But since Firefox 30, it can also use the new GStreamer 1.x, see: https://bugzilla.mozilla.org/show_bug.cgi?id=806917.

But GStreamer 1.x currently is not being used by default, see: https://bugzilla.mozilla.org/show_bug.cgi?id=947287.

To make Firefox use the new GStreamer 1.x, you need to build it with:

Code: [Select]
--enable-gstreamer=1.0
;)

On Ubuntu for example, Firefox is built with --enable-gstreamer=1.0, so that it uses the new GStreamer 1.x.

So, it would be nice if firefox-ESR.tcz and firefox-getLatest.tcz would also be built with --enable-gstreamer=1.0, so that Firefox on Tiny Core Linux would also use the new GStreamer 1.x.

For the 5.x x86_64/6.x x86_64 repos this would even be mandatory for MP4 playback in Firefox, because the 5.x x86_64/6.x x86_64 repos do not have gst-ffmpeg.tcz (which would be for GStreamer 0.10). They only have gst-libav.tcz, which is for GStreamer 1.x.

By the way:

Starting with Firefox 43 or 44, Mozilla seems plan to do MP4 (H.264/AAC) HTML5 video on Linux directly via FFmpeg/Libav instead of GStreamer, so that GStreamer will no longer be needed, see:

https://bugzilla.mozilla.org/show_bug.cgi?id=1207429

Actually I have just tested the latest Firefox Nightly 44.0a1 on Ubuntu and set media.gstreamer.enabled to false in about:config and completely uninstalled GStreamer and Firefox Nightly 44.0a1 could still play MP4 (H.264/AAC) via HTML5 and all the boxes on youtube.com/html5 were still checked :) :D.

So, GStreamer indeed is no longer required with Firefox 44 to be able to play MP4 via HTML5 :). The only thing that needs to be installed is FFmpeg/Libav and then Firefox 44 can play MP4 via HTML5 :). From reading https://bugzilla.mozilla.org/show_bug.cgi?id=1207429 and all the associated bugs, it seems like this might actually even work on Firefox 43 already, but not sure, I've only tested Firefox 44.

Anyway:

Since it will take quite a few more weeks for firefox-getLatest.tcz to reach version 43 or 44 and even months for firefox-ESR.tcz to reach version 45 (the next ESR version (https://wiki.mozilla.org/Enterprise/Firefox/ExtendedSupport:Proposal#Version_Numbers)), it would still be nice if firefox-ESR.tcz and firefox-getLatest.tcz would be built with --enable-gstreamer=1.0 until then.

If that would be easy, then it would be nice if you could do it.

But if it would involve a lot of extra work, then I'd say it might probably be better to simply leave it as is and simply wait for Firefox to reach version 43 or 44 and for Firefox ESR to reach version 45, since it will no longer need GStreamer then ;).

Regards
Title: Re: firefox: enable HTML5 video + audio
Post by: coreplayer2 on October 18, 2015, 12:13:24 PM
html5 video is supported, however I agree H.264 support is not yet supported, but I believe that's just a matter of time.



Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 18, 2015, 12:47:10 PM
html5 video is supported, however I agree H.264 support is not yet supported, but I believe that's just a matter of time.

Sorry, but did you even read my post :o :-\?

If you would have read my post, then you would know that H.264 is already supported...

All you need to do is install:

ffmpeg.tcz
gstreamer0.10.tcz
gst-plugins-base0.10.tcz
gst-plugins-good0.10.tcz
gst-plugins-bad0.10.tcz
gst-plugins-ugly0.10.tcz
gst-ffmpeg.tcz

and making sure that media.gstreamer.enabled is set to true in about:config, then Firefox can do MP4 (H.264/AAC)...

That was even explained in post #1 by dentonlt...

What I asked you to do is building Firefox with --enable-gstreamer=1.0, so that one can use the NEW 1.x versions of:

gstreamer.tcz
gst-plugins-base.tcz
gst-plugins-good.tcz
gst-plugins-bad.tcz
gst-plugins-ugly.tcz
gst-libav.tcz

instead of the OLD 0.10 versions...

Regards
Title: Re: firefox: enable HTML5 video + audio
Post by: coreplayer2 on October 18, 2015, 02:04:40 PM
I'm talking about native support, which I think is inevitable..
 

Additionally, the goals of firefox-getLatest.tcz are:

1: provide an effective means to install the latest firefox release from scratch
2. provide ability to update a previous installed firefox version to the latest release
3. minimize the confusion from having various firefox versions in the repo

We accomplish this with a script "firefox-getLatest.sh" which downloads the latest stable prebuilt Firefox binary release (and if specified in a users language) direct from Mozilla.  Then package the extension per tinycore's specifications for immediate use.   

To cut a long story short; While Mozilla continue to provide prebuilt stripped and stable firefox binaries, we have no requirement to compile our own binaries.  therefore compiling with the --enable-gstreamer=1.0 option is a request for upstream Mozilla.

regards


Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 18, 2015, 02:22:04 PM
Okay.

therefore compiling with the --enable-gstreamer=1.0 option is a request for upstream Mozilla.

https://bugzilla.mozilla.org/show_bug.cgi?id=947287

I'm talking about native support, which I think is inevitable..

Well, as already mentioned, beginning with Firefox 43 or 44, GStreamer will no longer be needed (only FFmpeg/Libav will be needed):

https://bugzilla.mozilla.org/show_bug.cgi?id=1207429

Regards
Title: Re: firefox: enable HTML5 video + audio
Post by: dentonlt on October 18, 2015, 10:52:11 PM
Just to keep beating the horse and all ...

I'm working on a build script that works with gstreamer-1.0. x86_64 repo doesn't currently have all the 0.10 plugins, and, though I've packaged all those already, I'm not sure it's worthwhile putting up the older plugins when the 1.0 stream may be more valuable long-term.

At the very least, this will remind me of why building firefox is not ... desirable. (big/time-consuming build)

I think we can safely say the original topic is closed here :p
Title: Re: firefox: enable HTML5 video + audio
Post by: hiro on October 31, 2015, 06:19:52 AM
Is there something that can use vaapi?
Or even better a button like in the fifth browser which just starts mplayer for video and sounds?
Or perhaps best a conversion of video and audio objects into simple <a href> links...
Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 31, 2015, 06:40:31 AM
Is there something that can use vaapi?

Yes, there is. You need gstreamer-vaapi.tcz, it's in the 64-bit Tiny Core Linux 6.x repo now, as requested over there:

http://forum.tinycorelinux.net/index.php/topic,18998.0.html

It's performance is suboptimal though, see:

https://bugzilla.mozilla.org/show_bug.cgi?id=894372

Or even better a button like in the fifth browser which just starts mplayer for video and sounds?

There is a "Watch with MPV" Firefox add-on available, see:

"https://addons.mozilla.org/en-US/firefox/addon/watch-with-mpv/

mpv.tcz is now available in the 64-bit Tiny Core Linux 6.x repo, see:

http://forum.tinycorelinux.net/index.php/topic,16246.0.html

 ;)
Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on October 31, 2015, 06:45:01 AM
PS:

Or perhaps best a conversion of video and audio objects into simple <a href> links...

Might also want to have a look at:

https://addons.mozilla.org/en-US/firefox/addon/yt2player/

 ;)
Title: Re: firefox: enable HTML5 video + audio
Post by: hiro on October 31, 2015, 08:20:04 AM
i don't want mpv. and i don't want 64-bit.
i already submitted mplayer with vaapi support, and it works perfectly with high performance and low cpu usage, so i'd like to use that.
Title: Re: firefox: enable HTML5 video + audio
Post by: Misalf on October 31, 2015, 08:30:08 AM
I'm using FlashGot plugin + youtube-dl + (S)MPlayer.
Title: Re: firefox: enable HTML5 video + audio
Post by: pq5190362 on November 01, 2015, 05:50:59 AM
i don't want mpv. and i don't want 64-bit.

Maybe RTFM before complaining about an advice given to you by another user?

The descriptions of both add-ons:

https://addons.mozilla.org/en-US/firefox/addon/watch-with-mpv/
https://addons.mozilla.org/en-US/firefox/addon/yt2player/

tell you straight away that you can specify pretty much any external player, not just a specific one (if the player works with YouTube).
Title: Re: firefox: enable HTML5 video + audio
Post by: hiro on November 01, 2015, 07:05:29 AM
Sorry if it sounded like a complaint. be sure i'm trying to just cooperate efficiently.

So far i've been using opera. in there when i right-click->n->enter it pushes the current page's url to xdg-open.

quvi and mplayer would be run automatically from xdg-open (in my case it's just a 10 lines shell-script).
But quvi broke regularly and required a lot of updating so far, it is site-specific and i hope in the time of html5 video there's a chance it will become unnecessary to use programs like quvi and youtube-dl, which would spare me from having to update them all the time.

my last workaround was running fifth from xdg-open instead which then shows me a nice "stream" button in html5 video objects that would then give on the url to mplayer.
But even that was broken by youtube.

That's why I'm on the lookout for more alternatives.
Title: Re: firefox: enable HTML5 video + audio
Post by: curaga on November 01, 2015, 08:35:25 AM
my last workaround was running fifth from xdg-open instead which then shows me a nice "stream" button in html5 video objects that would then give on the url to mplayer.
But even that was broken by youtube.

It was? I last downloaded a video from there two days ago, though I can't use the stream function on Youtube (mplayer doesn't support https). It's just a pain that Google changes their SSL certs several times a week.
Title: Re: firefox: enable HTML5 video + audio
Post by: hiro on November 01, 2015, 10:32:37 AM
You're right, sadly it doesn't work with mplayer directly. I used to run
wget -O - | mplayer -
but now that also broke because of some seek issues.
It should be trivial though to change it to
wget -q -O /tmp/yt & (sleep 3; mplayer /tmp/yt)

I'll give you an example of my issue with youtube though: I get a rendering that looks like CSS is disabled and the message "This video is unavailable."

This now triggered deeper investigation. It might be related to the SSL problem you mentioned. I removed the whole .fifth folder and youtube started working again (perhaps cause the javascripts and css files come with a different certificate?).

Now with new SSL providers giving out certificates that are good for only few weeks certificate pinning sadly got less useful for the general internet :(

One issue I have on youtube still is that clicking the "Stream" button is kind of difficult cause there's that defunct play button from youtube blocking most of it ;)
Title: Re: firefox: enable HTML5 video + audio
Post by: curaga on November 01, 2015, 12:05:49 PM
Some sub-sub-resources don't trigger the SSL error screen for some reason. Youtube serves CSS and images via two subdomains, s.ytimg.com and i.ytimg.com. So, as a temp workaround, you could change the fifth startup script to delete ~/.fifth/certs/{*google*,*ytimg.com} before starting it.

Adding an insecure mode, even in the form of site/domain exceptions, would be bad security design, easily hijackable by malware or misclicks.

edit: Creating an insecure minitube-like app using webkitfltk would be easy though, only for youtube use. Might I interest you in webkit app making?  ;) See the testapp in webkitfltk sources, it's a single-window browser sample, with the same video functionality, but without a SSL callback it will accept all certs.
https://github.com/clbr/webkitfltk/blob/fltk/Source/WebKit/fltk/testapp/testapp.cpp

Tweaking the style's z-order so the buttons are always on top is a TODO, in the long long TODO list...