Sunday 23 May 2010

More on WebM video format

MIRO Video Convertor


The MIRO Video Convertor for Windows can be downloaded from

http://www8.getmiro.com/blog/2010/05/miro-video-converter-is-the-first-webm-vp8-converter/

This convertor displays a basic window where the user can drag the source video to be converted. Underneath is a drop-down list of output format choices:
  • Theora
  • WebM (VP8)
  • MP4 Video
  • MP3 (Audio only)
followed by a choice of devices: Android, Apple and Other.

What it can do

  • displays both the actual command line of and output from the ffmpeg.exe program - very useful for problem tracking
  • convert my tiny Matroska test video rgbwbmpx264resize128x96.mkv to Theora
  • convert 1440x1080recalq1vdub6s.avi, a 1080p video dubbed with VirtualDub 1.9.8
  • convert cal16x16check_vdnocnoafr1len2.avi.vlc.ogv, a 16x16 one frame per second Theora video, to another Theora
  • convert Mars Phoenix Sol 151 weather.ogv to another Theora, downgrading quality slightly, and to WebM
  • convert Test_avi_64kbps_video_32kbps_audio.ogv to another Theora
  • convert Cal_2flip2_click1in4track8secsmono22khz16bit8khzvbr_vlc3.ogv to another Theora, but not to WebM
  • converts Betty Boop in Boop-Oop-A-Doop 1932 - HQ.flv to Theora; the FLV contained h264 video and AAC audio streams

Problems

  • hangs on some video input, for example Test_avi_64kbps_video_32kbps_audio.ogv to WebM; this same file also causes FlixWebM to crash, but ffmpeg.exe handles it Ok **
  • hangs when converting Cal_2flip2click8khzvbr_vlc.ogv to WebM or MP4, but is Ok to Theora; however oggz-tools/validate.exe reports packet order errors. For source video see http://commons.wikimedia.org/wiki/File:Cal_2flip2click8khzvbr_vlc.ogv
  • hangs when converting Cal_2flip2_click1in4track8secsmono22khz16bit8khzvbr_vlc3.ogv to WebM; oggz-tools/validate.exe also reports packet order errors
  • reports Unknown format when given any WebM input from the Sorenson Squeeze/Squish online service - input plays Ok in Chromium, Media Player Classic and the new VLC version "1.1.0-rc The Luggage"

The above video is the test file File:Cal 2flip2click8khzvbr vlc.ogv uploaded to Blogger.

Edited on 2010-05-23 17:30 UTC to add the following:
** this problem appears to occur when the input contains a single audio channel -- ffmpeg then reports "[vorbis @ 0x16006d0]Current FFmpeg Vorbis encoder only supports 2 channels."; Test_avi_64kbps_video_32kbps_audio.ogv can however be converted to WebM using the following ffmpeg.exe command line:

ffmpeg.exe -i Test_avi_64kbps_video_32kbps_audio.ogv -f webm -vcodec libvpx_vp8 -ac 2 Test_avi_64kbps_video_32kbps_audio.webmvp8_ac2.webm

Edited on 2010-05-23 18:30 UTC to add the following:

1080p videos

I have now converted some 1080p videos testing ffmpeg both via the MIRO Video Convertor (MIROVC) and via the command line, creating both Theora and WebM outputs. I used a 134 megabyte one second Mandelbrot zoom source video created with zero quality loss (rendered with XaoS, 24 bit true colour, antialiasing, and recalculating every frame). These videos are a serious test for lossy compressors so I was not expecting anything fantastic and indeed there were noticeable artifacts. MIROVC created a 613 kilobytes Theora and a 234 kilobyte WebM.

SMPlayer played the Thora smoothly while Media player classic played the WebM smoothly.

However, the Chromium browser played both the WebM and the Theora jerkily, and Firefox played the Theora also jerkily, but then so did YouTube's flash player. Generally I find actual streamed video data plays well in an external player (I save the whole stream and then replay it), but badly in all browsers (reading directly from local disk so there should be no network buffering).

Below are two the encodings from MIROVC: the Theora first, followed by the WebM.




Above is the video encoded as a 613 KB Theora, below is the same video encoded as a 234 KB WebM:



They are both 1080p but I have no idea how Blogger will render them here.

Edited at 21:15 2010-05-23 UTC to add the following:

It appears that both Blogger and YouTube do not correctly render videos encoded with ffmpeg2theora version after 0.24. Therefore below I have uploaded the Theora video encoded with version 0.24:



The same video can be seen full size at YouTube here: http://www.youtube.com/watch?v=CDuc5J2Jhuk fmpeg2theora 0.24 Theora transcoding Mandelbrot zoom

Remember that YouTube will display the above video in a WEBM player if you have joined the HTML5 beta *and* if you are using a browser that is HTML5 WEBM "compatible". As of today YouTube's WEBM videos are limited to 720p size, so to see the video at full size of 1080p, either leave the beta or use a non-compatible browser version.

Friday 21 May 2010

Viewing and converting to WebM video

Here are my notes on using the newly released WebM video format sponsored by Google and released on 19 May 2010. See http://webmproject.blogspot.com/2010/05/introducing-webm-open-web-media-project.html

WebM viewer programs for Windows

Chromium build 47798
Labs Opera build 21868
Media Player Classic build 1.1.796.0 MPC Compiler VS 2005 FFmpeg Compiler GCC 4.3.2

WebM encoding methods

Download the DirectShow filters from http://code.google.com/p/webm/downloads/list and register them as described in http://www.webmproject.org/tools/

Download the ffmpeg.exe Windows binary from http://micksam7.com/blog/index.php/?p=743 linked from http://tempvariable.blogspot.com/2010/05/converting-video-to-webm-format.html

You now have a few ways to transcode existing videos to WebM:

ffmpeg command line

ffmpeg.exe -i test.avi -b 50k -aq 30 -threads 2 -ab 32k -aq 60 -ac 2 testavi.webm


The "-ac 2" appears to be essential when the audio stream is mono, the other options can be varied.

ffmpeg.exe -i test.avi -vstats_file file.vstats -v 1 -loglevel 1 -ac 2 nullout.webm


The above command line logs each encoded frame's video statistics to the file.vstats


ffmpeg.exe -i stereo.flv -b 400k -ab 60k stereoflvb400ab60.webm


The above command line encodes a stereo FLV input into a 400 kbps VP8 video strean and a 60 kbps Vorbis audio stream

ffmpeg.exe -i stereo.flv -vb 120k -ab 96k -ac 2 stereoflvb120ab96.webm


The
above command line encodes the same stereo FLV input into a 120 kbps VP8 video strean and a 96 kbps Vorbis audio stream

GraphEdit

This is more difficult; all that works for me is transcoding video without sound, all my attempts at including vorbis lead to assertion errors in the DirectShow filters. An example and more details are at http://www.youtube.com/watch?v=voLjKGU3VSQ

Sorenson Squish

You need to subscribe to Sorenson for a free Developer account and then install first Java and then the Sorenson plugin that lets you transcode videos to webm. This is awkward as the plugin uploads the result to the 360 web site which you then need to download again to your computer. However I found it worked for more videos than did GraphEdit, but fewer than the recently built ffmpeg.exe binary.

Wildform Flix WebM

Wildform is offering a free webm encoder. Download it from http://www.wildform.com/products/flix/ . It has a windows interface but it uses a set of preset encodings which you need to examine and change to suit the input video you are encoding. In particular as a default it changes the frame rate, frame size, and bitrates. Click the "Vid/Aud" tab and change these to your required settings before clicking the encode button. I enabled "Use Source Dimensions" and "Use source FPS". Click File/Save settings as" to save the settings for future encodings. I found it produced playable output videos with these limitations:
  • FLV input causes it to crash
  • pressing play in the interface can cause it to crash, so always use an external player
  • output size appears to be larger than ffmpeg.exe produces, I am unsure why
Edited at 06:00 2010-05-22 UTC to add the following:

VLC with WebM support


A Windows installer for the Video LAN media player is available at http://people.videolan.org/~jb/webm/
It tests well with WebM videos I transcoded using the new ffmpeg.exe, but I have not yet tested how well it encodes videos to WebM.

YouTube WebM support

* The first 23 seconds of Big Buck Bunny uploaded as 1080p transcoding to YouTube as http://www.youtube.com/watch?v=jdqvZ2dP6AQ - YouTube only shows 360 and 720p choices

The above is the uploaded WebM transcoding but embedded in a low resolution Flash player, click the following link to go directly to the YouTube page with more choices: Big Buck Bunny at 1080p WebM

* The same 23 seconds uploaded as the original Theora OGG to http://www.youtube.com/watch?v=qzfWVYJNmAM - YouTube shows four choices: 360, 480, 720p and 1080p


The above is the uploaded Theora OGG clip (not WebM) embedded in a Flash player, click the following link to get a choice of all four sizes: Big Buck Bunny at 1080p

Command lines used to transcode the OGG to WebM:

oggz-chop.exe --end 23.083 --output b_23_083.ogv big_buck_bunny_1080p_stereo.ogg

ffmpeg.exe -i b_23_083.ogv -acodec copy -aspect 16:9 -b 4000k bbb23_083aspect16_9b4000.webm