I saw a lot of articles here about HTML5, Theora and the video tag, but for the most part they revolve around theory. Recently on my site
MJV-ART.ORG - Anime Wallpaper I opened the section
JV-Video which is a small video hosting ala Youtube on anime theme based on HTML5 / Theora. Actually, I now want to talk about the problems that I have.
Browsers
Although the main browsers seem to support HTML5 and Theora, but usually with a fair amount of curvature. The most normal browser is still FireFox, but it also has enough glitches and oddities and therefore we will start with it.
Firefox
- In the first versions of the 3.5 branch, I did not perceive Aspect exposed in the ogg container, in recent versions of 3.5 this was fixed. Because of this, the picture dispersed especially when transcoding mpg files.
- FireFox 3.5. * Does not accept in the video / audio tags an indication of the display of the control menu via controls = "controls" (as written in the standard), you must use controls = "true". In branch 3.6, this has already been fixed.
- FireFox 3.5. * Refused to play a little “not correct” files which had “[theora @ 0xac90c0] Missing extradata!”. In 3.6, this problem was solved.
- In some videos, the sound is completely strange. This is both in 3.5 and in 3.6.
- Often the sound is late and the audio / video goes separately. And often such a rassinhron reaches 20 seconds, sometimes immediately, and sometimes in the middle of the track.
- Only in version 3.6 there was an opportunity to watch in full screen. Before that, you need to use the JS hack (the code is very simple and stupid):
document.getElementById('video_post').style.position='absolute';
document.getElementById('video_post').style.left=0;
document.getElementById('video_post').width=window.innerWidth;
return false;
Chrome
I will say right away, everything is fine in Chrome3 under Windows, in any case we didn’t find any problems, but we didn’t test it so much. All the main claims are against Chromium from 4 branches which is now available for all major OS.
- The main problem of Chromium 4 and 5 (Linux) is that the control menu (controls) does not work with it, the video sticks to the middle and goes into an endless loop. If anyone is interested in this bug: code.google.com/p/chromium/issues/detail?id=26036 . It is possible in Windows or MacOSX versions of this bug no. On my website, I define version 4 of chrome and disable controls, and instead insert the following code:
document.getElementById('video_post').play();return false;
To play.
document.getElementById('video_post').pause();return false;
For pause.
document.getElementById('video_post').controls='true';return false;
To enable contorls.
These pieces can be inserted into onlick for a, img and other tags. The use of such "pieces" makes it possible to watch videos with minimal control and check the controls at the next sync with SVN.
- Sometimes the video does not work completely or only the sound works.
- There is no full screen mode, you must also use the JS code, which I quoted above.
- There is no bilinear or similar filtering with resize because of this, pixels are visible.
')
Safari
Theora turns on only after you install
the QuickTime plugin, but after that everything works perfectly, this is the most problematic browser, although Theora is not built into it. Fullscreen is not present and as usual JS helps.
Opera
All stable versions do not see the video tag, but before alpha version 0.50_pre6177 (linux) already plays a video but with its own problems:
- The slider does not work in controls. Play and Pause work.
- The video periodically jerks as if it is slowing down (at the same time the processor is not loaded) it is very similar that they do not use double buffer.
QtWebkit
Browsers based on QtWebkit can play audio poorly (without video) if Gstreamer is enabled in Phonone under Linux, everything is bad enough with Xine.
Gtkwebkit
Did not check if anyone can then share! Very interesting.
Coding
I did not go very far and used ffmpeg2theora. After quite a long experiment, we found the most appropriate encoding parameters that produced no worse quality than youtube:
ffmpeg2theora --speedlevel 0 --optimize -S 0 -v 6 -a 3 -x 480 -H 44100
.
For coding purposes, Gstreamer could still be used, but I plan to perform such experiments in the future.
So what were the problems with this:
- In versions prior to 0.25, Aspect was often not quite rightly torn out (or, more precisely, simply ignored), and this problem exists regardless of the problems with Aspect from FireFox.
- MP4! Tolley container absolutely stupid whether the programs that make it stupid. But in the end, .mp4 is recorded for video by one FPS (which honestly takes ffmpeg2theora), and in the video stream itself another one is used. Because of this, there is a video / audio rassinhron. It helps to treat such videos (but not always!) .Mp4 parsing and rebuilding using standard Linux utilities. A player like mplayer uses the information from mp4 for the first seconds of playing a “broken” mp4 file, but then it is quickly synchronized according to the information from the video stream.
- I did not want to load the server yet with coding in Theora and therefore I created a very simple system of distributed coding. A folder is created on the server with a directory structure (pre_buf, pre, proc, err, out) and is mounted on NFS by those computers that must encode the video. When the video is uploaded to the server, it will be made in a separate folder in pre_buf after the final upload, transferred to the pre in one fell swoop. On processing machines, there is a script that works according to the “krone” which finds the first folder in the pre folder and transfers (if it works and it is not late) to the proc folder and then the processing begins. The result is placed in the out folder or err (for errors). On the server, the “out” and “err” folders are also viewed in “crown” and the database is being edited, and the out of the folders are transferred to their public place. Thus, it is possible to easily unload the main server.
Web server.
As it turned out, not every bundle allows you to normally provide video for viewing. At first, I used lighttpd-scgi-python / Pylons and the video was practically not played (there were jerks, artifacts, etc.) as a result I rendered all static files into a separate domain and implemented access directly through lighttpd. Here with Lighttpd (which also uses Youtube) directly everything turned out as it should. In addition, there is still the possibility that ogv, oga, ogg are not in mime-types of lighttpd - then they need to be added there.
It seems I have not forgotten anything :) and I hope this article will help you navigate the current problems of HTML5-video / Theora.