Skip to content

How to convert a video to OGV/MP4/WebM

I recently had to use the jquery.videoBG plugin for a site I work on. It is quite convenient as it does all the handling of various browser compatibility with different video formats so as to display a video in the background of the body or a div. However, of course, you have to provide it with the appropriate video formats, and that’s where things get a little bit more complicated.

My source file was .mov. For the various browsers, I needed an mp4 file, and ogv file, and a webm file.

MP4 is easy, my usual video compressing software, Handbrake, supports it (although I usually use it to obtain MKV).

Ogv and WebM are a bit less obvious, Handbrake doesn’t support them and apparently it’s easy to get lost in the jungle of video converters. I eventually settled for ffmpeg, which is command-line based but otherwise great (NB: as mentioned on the download page, “if you are confused about what build type you need just download a static build”).
A nice trick in ffmpeg is that you can demux and remux without re-encoding the streams. The syntax for this is, for instance:

ffmpeg -i inputfile.mkv -codec copy outputfile.mp4

So, all I need now is some video streams accepted by ogv and webm.
Ogv requires a Theora stream. And luckily Handbrake can provide that, so I can create an mkv file with a Theora video stream in it and then remux it to ogv with ffmpeg.
WebM requires a VP8 or VP9 stream. Handbrake can provide VP8 (sadly not VP9 yet), so again I can create an mkv file with VP8 video and then remux it to webm with ffmpeg.

Well, that’s all, problem solved. Here are what the commands would look like in ffmpeg although that’s probably obvious:

ffmpeg -i inputfile-with-theora-vid.mkv -codec copy outputfile.ogv
ffmpeg -i inputfile-with-vp8-vid.mkv -codec copy outputfile.webm

Posted in multimedia, open source.

Solving “Element link is missing required attribute property”

I use the W3C validator to check my HTML 5 documents, and somewhat recently this new error appeared, saying “Element link is missing required attribute property.”
After a bit of research, it turned out that, if a <link> tag is NOT inside the <head> section of the document but is in the <body>, then the validator wants an additional property attribute. Probably even easier with an exemple:

When inside the <head> section you would write:
<link rel=”stylesheet” type=”text/css” href=”css/myStyle.css”/>

But when inside <body> you’ll write:
<link property=”stylesheet” rel=”stylesheet” type=”text/css” href=”css/myStyle.css”/>

And voilà, no more error in the validator 😉

Posted in web development.

A possible workaround to Alt Gr not working in Windows

Since a few months, I’ve had that issue where Alt Gr randomly stops working in Windows 7. This is a major hassle because Alt Gr is needed for very common characters when programming (#, {, }…), and also, of course, for “@”. A first solution is to use Ctrl + Alt + [key] as a replacement for Alt Gr + [key], but this isn’t nearly as convenient.

According to various posts here and there, this can be caused by third party software, notably some drivers, stealing keyboard shortcuts. In my case I couldn’t identify a culprit: the issue appeared apparently without a recent update, shutting down running stuff didn’t help. Also the issue is really random (sometimes it occurs, sometimes it doesn’t) and is usually solved simply by rebooting.

I haven’t found a permanent solution, however I found a method much faster than a reboot: switching keyboard language back and forth. I have to keyboards layouts installed, and when I switch from one to the other (NB: the shortcut to do so is Ctrl + Shift), Alt Gr starts working again. So double switch brings me back to my current layout, with Alt Gr working. And so far, it then never disabled again until at least the next reboot.

Of course if you find a more permanent solution, such as a utility to find which program is responsible for causing this mayhem, I’d be glad to hear it in the comments.

Posted in Windows.

aToaD #14: ideone and codeboard

Well that’s 2 tools instead of one, but they seem a bit overlapping and a bit complementary at the same time. lets you submit small code snippets in order to test them (live compilation and run). They support about 60 languages (I didn’t count myself, but that seems quite accurate from their impressive list), from the classic C(++)/PHP/Java/Javascript/… to the more uncommon R/Octave/Scala/… and even quite a few I had never heard of before (bc/Unlambda/…) lets you work online on whole projects. They seem to be very recent (a project I created about a month about was ID 1500-ish while another project I created a few days ago was ID 4500-ish), and they only support 6 languages so far: C, C++, Eiffel, Haskell, Java, Python.

Nothing much to add… just give them a try whenever you need a quick way to test your code without setting up a whole development environment 😉

Posted in A Tool A Day, programming.

Bloquer les pubs sur OVS le retour – DEFCON 1

(NB: exceptionally, this article is written in French because it’s targeted at a French, non-English speaking audience – sorry for the inconvenience)

Il y a quelques mois, OVS chamboulait son systĂšme anti-anti-pub. AprĂšs quelques recherches, j’ai mis au point une mĂ©thode de contournement lourde mais imparable. Cependant entretemps OVS avait dĂ©jĂ  allĂ©gĂ© sa mĂ©thode, permettant un contournement simple, d’abord par l’usage de Ghostery seul Ă  la place de Adblock + Ghostery ou d’Adblock seul, puis par la simple mise Ă  jour des filtres AdBlock, qui ont Ă©tĂ© adaptĂ©s par le mainteneurs du projet. Je me suis donc contentĂ© de publier ces conseils, + un script Greasemonkey juste pour le fun.

Seulement voilà, ce matin surprise, Ghostery (ou Adblock Plus ou Edge avec les filtres mis à jour) sont détectés à nouveau. Il est temps de recreuser un peu les méthodes.

MAJ du 4 mai 2015 : la mĂ©thode 1) ne marche pas encore, la mĂ©thode 2) ne marche plus… reste la mĂ©thode 3) qui marche trĂšs bien : la seule raison pour laquelle je l’ai mise en 3) et qu’elle est un peu complexe pour un novice en informatique

1) Solution triviale mais pas immédiate, et incomplÚte

Attendre qu’AdBlock mette Ă  jour ses filtres 😀

2) Solution rapide, facile mais incomplĂšte Ă©galement

Utiliser Ghostery et dĂ©sactiver AdBlock. Dans Ghostery, mettre en liste blanche pour OVS le tracker “SMART Adserver”.
Screenshot parametres Ghostery
Vous serez désormais pistable par, mais vous ne verrez pas ou peu de pubs.

2.bonus) DĂ©tails techniques pour les curieux

Une des 2 protections anti-anti-pub consiste à créer un object smartadserver et à vérifier son existence:

sas.setup({ domain: ''});
if(typeof sas === 'undefined'){document.location='ovsadblock.php?test=sas&nav='+window.navigator.userAgent;}

La seconde est dans le mĂȘme genre, mais teste simplement un objet diffĂ©rent:

if (!(document.getElementById("my-smartads")))

3) Solution lourde mais ultime

Avec cette mĂ©thode, vous pourrez toujours vous en sortir mĂȘme quand 1) et 2) seront, Ă©ventuellement, mis en Ă©chec (il faudra juste adapter le script le cas Ă©chĂ©ant). En revanche elle nĂ©cessite l’installation d’un logiciel supplĂ©mentaire, voire d’un navigateur aditionnel si vous ne voulez pas interfĂ©rer avec votre surf sur les autres sites. Par souci de complĂ©tude je vais donc ici prĂ©senter la mĂ©thode avec l’utilisation d’un navigateur aditionnel.

3.1) Installer Firefox ou un dérivé (fork)

Je connais 2 grands forks de Firefox qui ont la caractĂ©ristique intĂ©ressante de pouvoir tourner en parallĂšle avec lui: Cyberfox et Palemoon. Selon ce que vous utilisez dĂ©jĂ , installez un de ces 3 navigateurs, puis configurez-le, dans les paramĂštres rĂ©seau, pour utiliser un proxy HTTP (la capture d’Ă©cran ci-dessous provient de Firefox 37).
Screenshot parametres proxy HTTP Firefox

3.2) Installer Fiddler

Fiddler est un freeware qui permet, entre autres, d’intercepter et modifier le traffic web. Nous l’utiliserons donc pour intercepter le traffic provenant d’OVS et retirer le(s) code(s) de protection anti-anti-pub avant de charger les pages dans le navigateur. Ainsi, la protection saute et on peut naviguer tranquillement :)

Fiddler est téléchargeable gratuitement ici. Le site demande un e-mail, mais vous pouvez laisser la case vide.

Installer Fiddler (Ă  l’heure oĂč j’Ă©cris ces lignes, la version actuelle est, puis dans Tools → Fiddler Options → Connection, configurer “Fiddler listens on port:” Ă  9901. Cf la capture d’Ă©cran ci-dessous.
Screenshot parametres Fiddler

Dans la fenĂȘtre gĂ©nĂ©rale, allez sur l’onglet “FiddlerScript”, et remplacez le contenu du script par le contenu de ce fichier: OVS-Fiddler-CustomRules-20150501.js.txt. N’oubliez pas de cliquer sur “Save Script” ensuite (vous devriez entendre un bip).

Et voilĂ , le tour est jouĂ©, vous devriez pouvoir charger OVS dans votre nouveau navigateur (n’oubliez pas d’y installer AdBlock et/ou Ghostery, selon vos prĂ©fĂ©rences, sinon Ă©videmment vous auez les pubs :D)

3.3) Remarques (lisez si ça ne marche pas) et détails additionnels

Ca fait longtemps que j’ai rĂ©alisĂ© ma premiĂšre installation de Fiddler, du coup je ne me rappelle plus des paramĂštres par dĂ©faut. Il est possible en particulier que le script modifiĂ© ne soit appliquĂ© qu’au redĂ©marrage de Fiddler (donc si le script ne semble pas appliquĂ©, redĂ©marrez Fiddler, ça l’appliquera alors Ă  coup sĂ»r).

Il y a, dans la barre d’outils, un gros bouton “Stream” (pas visible sur ma capture d’Ă©cran car le menu ouvert est devant) : assurez-vous qu’il est dĂ©cochĂ©. Sinon, le traffic sera envoyĂ© au navigateur AVANT d’y appliquer les modifications du script (oui, moi aussi ça me semble un peu idiot comme paramĂštre… mais bon c’est comme ça).

Si malgrĂ© tout, ça ne marche toujours pas, n’hĂ©sitez pas Ă  poser vos questions en commentaires (avec captures d’Ă©cran si possible, vous pouvez les hĂ©berger facilement sur par exemple).

Last but not least, Ă  propos de mon script Fiddler, en fait la seule zone qui change par rapport au script par dĂ©faut, c’est le contenu de static function OnBeforeResponse, autour de la ligne 278. C’est lĂ  que sont rĂ©alisĂ©s les traitements sur la page avant de la transmettre au navigateur.

Enjoy! :)

Posted in privacy, programming.

Tagged with .

Epson Perfection 1660 Scanner Driver for Windows 7 64 bits

So I have this very old scanner (Epson Perfection 1660 PHOTO), which still works great but for which no drivers are provided for Windows 7. Somehow, a long time ago, on an old PC of mine which I still have, I did manage to install some kind of driver, on Windows 7. I really don’t remember how/where I found it, though (maybe I managed to install a version targeted at another OS – but I tried that again and it didn’t work), and I wasn’t able to find the proper installer.

Gladly, there are programs that allow you to extract installed drivers. The one I used is Double Driver. Download links on the official website are broken, so I mirrored the latest version (4.1.0 portable) here. There is also Driver Extractor, but I find it a lot less convenient (I didn’t even manage to find the scanner in their “ordered” list).

Finally, if you need the Windows 7 x64 drivers for your Epson Perfection 1660, here is the version extracted by Double Driver. I didn’t manage to install it directly. What I did was I plugged the scanner, then I went to “devices and printers”, right-clicked the scanner, then PropertiesHardware tab → Properties button → Driver tab → Update Driver (or just “Update”) button, then chose “browse my computer for driver software” and navigated to where I unpacked my archive with the driver. The wizard should then pick the right file and be able to install the driver.

Driver version is and is dated 2006-12-21 as shown in screenshot below.

Screenshot of Epson Perfection 1660 PHOTO driver tab

PS: from what I read while looking for a way to obtain the driver (before getting the idea to grab it from the old PC), it seems fairly likely that this driver may also work on Windows 8 or 8.1.

Posted in drivers, Windows Se7en.

LaTeX: solving “pdflatex.EXE (file t1-zi4r-0): Font t1-zi4r-0 not found”

Got that puzzling error, “pdflatex.EXE (file t1-zi4r-0): Font t1-zi4r-0 not found“, which was blocking me when trying to build an R package. At a higher level in the code, the error message was a more obscure “Warning: running command Rcmd.exe Rd2pdf had status 1“.

Anyway, that second one means there’s been an error, and the first one is the clue: a font is missing. Problem: Latex is supposed to fetch missing files on the fly, and for some reason in this case it didn’t. No obvious solution to this, LaTeX was working very fine apart from that. So I just tried the random thing to do: update it (hadn’t updated it since install time about 2 years ago – oops).
And that turned out to be it. The install was so old that I needed to run the update program twice, once to update the update program and core, and once to perform the hefty amount of package updates. After the update, running the R package builder again made LaTex successfully fetch the missing font (said hello to the firewall 😉 ), and all worked. Tada :)

Posted in LaTeX.

How to enable hibernate mode in Windows 7

I’m a HandBrake occasional user and I’m having trouble making my computer suspend operation when an encoding job is running: when in sleep mode, handbrake keeps running (!!), emptying the battery about just as fast as when not in sleep mode (and making about just as much noise).

I later read that there are actually 2 different “suspend” modes: hibernate and sleep. To summarize the difference very quickly (more details there), sleep mode keeps the RAM powered and suspends most computer operations, while hibernate is supposed to write the RAM to disk, shutdown the computer completely and then load the RAM with what was saved on the disk when you turn the computer back on.

Hibernate and sleep can both be access from the start menu, in the drop-down button next to “Shut Down”. Except that for some reason, in my case hibernate didn’t show. Apparently in such (common) case, you need to enable it first, and there’s no GUI for that: you need to use the command line. In start menu, run “cmd” (without the quotes – or [windows key] + R works too) and then type powercfg /hibernate on.
If after that you still don’t have the hibernate option (wasn’t my case), reportedly you’ll need to disable hybrid sleep mode in the power options : in start menu, search for “edit power plant” then click “change advanced power settings” and browse to Sleep → Allow hybrid sleep.

Now you should have the hibernate option. If you don’t, you may want to check Microsoft’s FAQ entry about that, but I found it quite helpless.

Last but not least, hibernate seems to crash my computer (and not suspend handbrake anyway), so in the end that was a bit useless :/

Update (2015-03-15): not only Handbrake seems to defeat hibernation, also hibernation will create a huge file to store the RAM’s content. This file, C:\hiberfil.sys will always take up the equivalent of a large proportion of your RAM’s size (I have 20 GiB RAM, the hiberfil.sys file is 15 GiB). So when you don’t need it and want to reclaim some disk space, I believe it’s worht disabling it 😉

Posted in Windows Se7en.

Tools to download APKs from Google Play Store

Android is the most brilliant example of how to do a closed system based on something open. The complete entrapment of APKs on the Play Store, even though it’s “soft” (developers could distribute their own APKs themselves, or at least on alternative stores, but most of them don’t bother), is one among the many ways Google uses to try and track everyone.
Gladly, some people worked on tools to manually fetch APKs. They remain limited due to all the restrictions imposed by Google, but are still better than nothing.

The first kind of tools requires you to have a device with Google services installed and linked to a Google account. I’m not really sure how useful this is, then: sure you can download APKs, but you are still tracked by the GMail man and you still have Google stuff on your device. Still, here is a brief list (I only found 2):

Long story short, those programs run locally on your PC, you need to provide them with your device ID and your Google account (I’d recommend creating a Google Account just for the occasion – if you do have a normal one even though you shouldn’t :p), and then they pretend to be your smartphone and grab what you want from the Play Store (I think it doesn’t work with paid apps though).
I tried APK downloader about 2 years ago, just after I rooted and “cyanogened” my phone, it worked fine. But since then I lost my device ID (:x) or maybe it got unlinked from my Google account anyway. Or maybe I forgot which Google Account I used to fetch APKs. I don’t know why I didn’t save those data. Duh.

Anyway, the second kind of tools is quite the same principle, although they are provided as a web service and you don’t have to use your own device ID and Google account as the service provides some. Sadly there isn’t a lot of them either:

These will definitely not grab paid APKs: as you can understand, they probably don’t want to get into piracy issues. My advice on paid APKs is buy them from some other shop so as to discourage the Play Store monopoly. Aptoide, Amazon, SlideME… you have plenty to choose from and Wikipedia has a list. Enjoy.

Posted in Cyanogenmod, Google, software.

phpThumb: how to switch error messages on

phpThumb is a free, open source (GPL) image thumbnail generator. Even though the site feels like the beginning of the century, development is still going on as can be seen on Github.

This software has weird configuration options to enable the display of errors. To be able to see errors, you should set the following in phpThumb.config.php:

$PHPTHUMB_CONFIG['error_die_on_error']          = true;     // die with error message on any fatal error (recommended with standalone phpThumb.php)
$PHPTHUMB_CONFIG['error_silent_die_on_error']   = false;    // simply die with no output of any kind on fatal errors (not recommended)
$PHPTHUMB_CONFIG['error_die_on_source_failure'] = true;     // die with error message if source image cannot be processed by phpThumb() (usually because source image is corrupt in some way). If false the source image will be passed through unprocessed, if true (default) an error message will be displayed.

But also, and this is the tricky one as it’s away from the other error parameters, you need to enable (or rather, “not disable”) debug mode:

$PHPTHUMB_CONFIG['disable_debug'] = false;

Now phpThumb’s output will still seem like an image to your browser, but if you save it and open it with notepad or equivalent, you’ll be able the read the error message.

Posted in software, web development.