Archive

Archive for the ‘firefox’ Category

convert mp4 to webm and ogv

November 5, 2016 Leave a comment

Problem
I wanted to share an .mp4 file on my webserver but Firefox didn’t play it. It turned out Firefox prefers the .webm and .ogv formats, while Chrome can play .mp4.

Solution

Convert mp4 then:

.mp4 to .webm

ffmpeg -i input.mp4 -vcodec libvpx -acodec libvorbis -b:v 600k -cpu-used 4 -threads 8 output.webm

To change the quality, play with the “600k” value (bitrate).

.mp4 to .ogv

ffmpeg -i final.mp4 -vcodec libtheora -acodec libvorbis -b:v 600k -cpu-used 4 -threads 8 final.ogv

Here the difference is the codec (libtheora instead of libvpx).

Maybe I missed something, but the .webm file seemed to me to have better quality than .ogv. So I think it’s enough to support two formats only: .mp4 for Chrome and .webm for Firefox. By the way, in my test the input file (.mp4) had the best quality and smallest filesize, but again, I may miss something.

And here is an HTML5 code that can play your video:

<video controls preload="metadata" width="1024" height="768" poster="images/front.jpg">
    <source src="video.mp4" type="video/mp4">
    <source src="video.webm" type="video/webm">
    <p>Please use a modern browser to view this video.</p>
</video>
Categories: firefox Tags: , , , , , ,

Firefox: sync add-ons on your machines

October 13, 2016 Leave a comment

I knew that Firefox could do synchronization with multiple machines but I never tried it. It changed today. I got fed up with the manual sync so I looked after it and found this nice description of the process: https://support.mozilla.org/en-US/kb/sync-your-add-ons-another-copy-firefox . For this you need a free Firefox account.

Categories: firefox Tags: ,

Firefox shortcuts

October 4, 2016 Leave a comment

List of Firefox shortcuts: https://www.accessfirefox.org/Firefox_Keyboard_and_Mouse_Shortcuts.html .

Examples

  • Re-open closed tab: Ctrl + Shift + T
Categories: firefox Tags:

How to speed up Firefox

October 3, 2016 1 comment

Problem
I love Firefox but I suffered a lot recently because of its slowness. It ate up my CPU and thus it became very slow. I even started to use Chrome parallely with some sites where Firefox was very slow. Strangely, Chrome was much faster on certain sites. How to speed up my Firefox?

Solution
It turned out that it became slow because of one (or more) add-on(s). The best way to speed up your Firefox is to disable ALL your add-ons. Now I’m enabling just some add-ons that I really need, but I do it one by one, and monitor Firefox if it’s still fast or not.

With my add-ons disabled Firefox has become very fast, like Chrome. I should have done it much earlier…

Steps to follow: https://support.mozilla.org/en-US/kb/firefox-uses-too-many-cpu-resources-how-fix .

Categories: firefox

A “read it later” add-on for Firefox

September 29, 2016 Leave a comment

Problem
At my workplace I found two interesting links that I decided to read at home. I didn’t want to save their URLs and e-mail them to me, so I made a search if there is a good “read it later” add-on for Firefox. And then I got surprised.

Solution
It turned out that Firefox has such an add-on by default! That is, such an add-on is included in Firefox and it is called Pocket. Read more about it here.

So I put its icon next to my search bar and started to use it. It’s awesome! It also has a mobile app. so I can read the saved articles anywhere.

Hmm, I’m sure there are lots of other gems in the softwares that we use on a daily basis and we have no idea about them…

Categories: firefox

view the generated HTML source in Firefox

July 20, 2016 Leave a comment

To view the generated HTML source in Firefox, use this bookmarklet:

javascript: var win = window.open(); win.document.write('<html><head><title>Generated HTML of  ' + location.href + '</title></head><pre>' + document.documentElement.innerHTML.replace(/&/g, '&amp;').replace(/</g, '&lt;') + '</pre></html>'); win.document.close(); void 0;

This tip is from here.

limit the CPU usage of Firefox / Dropbox / etc.

June 24, 2016 Leave a comment

Problem
I have an older dual core laptop where Firefox sometimes uses 120%-130% CPU and slows down the machine completely. Restarting Firefox solves the problem for a few minutes but then again, it eats up the CPU. What to do?

Solution
I don’t have many tabs open but I still have this problem. I also uninstalled the Flash plugin but it didn’t solve the problem.

However, I found a nice tool called cpulimit:

Cpulimit is a tool which limits the CPU usage of a process (expressed in percentage, not in CPU time). It is useful to control batch jobs, when you don’t want them to eat too many CPU cycles. The goal is prevent a process from running for more than a specified time ratio. It does not change the nice value or other scheduling priority settings, but the real CPU usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly. The control of the used CPU amount is done sending SIGSTOP and SIGCONT POSIX signals to processes. All the children processes and threads of the specified process will share the same percentage of CPU.” (from the README of the project)

The following setting worked for me:

$ cpulimit -l 80 firefox

Firefox uses several threads but as mentioned in the documentation, they will will share the same percentage of CPU.

The CPU usage may jump higher than the specified value, but cpulimit will push it back in a few seconds.

My old laptop has become useable again :)

Update (with Dropbox)
I noticed that Dropbox also loves my CPU. Here is how I could limit this greedy beast. Originally, I started “$HOME/.dropbox-dist/dropboxd” automatically at each startup. Create the file “$HOME/bin/cpulimit_dropboxd.sh” with the following content:

#!/usr/bin/env bash

cpulimit -l 50 $HOME/.dropbox-dist/dropboxd

Make it runnable (chmod u+x cpulimit_dropboxd.sh) and call this script (cpulimit_dropboxd.sh) when your system comes up. Here I give 50% CPU for Dropbox but you can play with that value.

Categories: bash, firefox Tags: ,