Hacker News new | past | comments | ask | show | jobs | submit login

Has anyone had experience optimizing for webm? I really want to support this codec, but it's insanely slow in my experience. I'm finding that it's generally around 4x slower than mp4, but I've also had cases where it's taken up to a minute to encode a file where h264 take under 10 seconds.

My use case is to have the best performance/quality ratio for a 30 second video under 3mb.

These are my ffmpeg flags:

h264: "-vcodec libx264 -crf 28"

webm: "-c:v libvpx -qmin 0 -qmax 50 -crf 5 -b:v 1M -c:a libvorbis -aq 4"

The video I tested with these setting last night took 5 seconds on h264 and 35 seconds for webm, both outputting to a 2.6mb file.

System Specs: - Intel Core i7 4770 Quad-Core 3.4GHz - 16gb 1866mhz memory - ssd drive - 64bit ubuntu 12.04 lts

What further frustrates this is that I can use OpenCL to improve encoding times even more, but only with h264 in ffmpeg (as far as I know).




WebM FAQ

Encoding WebM videos seems really slow. What are you doing about that?

Today, encoding VP8 in “best quality” mode is the slowest configuration. Using “good quality” mode with the speed parameter set between 0 and 5 will provide a range of speeds.


Regarding speed, I've had experience with very large batch WebP conversions, and I know firsthand that encoding speed has improved dramatically over time. Perhaps the same may happen with WebM.


I don't know the details, but how is the quality on both? I can image that webm takes longer, but if it creates a file that has a higher visual quality for the same filesize that is great. I think nearly all streaming providers would take an increase in processing time for a decrease in bandwith, while quality stays the same..


I'm pretty sure h264 is the superior codec in all regards except for that pesky license issue. It encodes faster and creates smaller files that look better. From (lead x264 developer and HN user) DarkShikari[1]:

"Overall, VP8 appears to be significantly weaker than H.264 compression-wise. The primary weaknesses mentioned above are the lack of proper adaptive quantization, lack of B-frames, lack of an 8×8 transform, and non-adaptive loop filter. With this in mind, I expect VP8 to be more comparable to VC-1 or H.264 Baseline Profile than with H.264. Of course, this is still significantly better than Theora, and in my tests it beats Dirac quite handily as well.

...

Finally, the problem of patents appears to be rearing its ugly head again. VP8 is simply way too similar to H.264: a pithy, if slightly inaccurate, description of VP8 would be “H.264 Baseline Profile with a better entropy coder..."

I won't pretend to know what all of those terms mean off the top of my head, but if the lead x264 developer sees absolutely no technical advantage in WebM vs. h264, that sounds pretty damning to me.

As for why x264 encodes h264 so much faster than ffmpeg or whatever encodes WebM, the simplest explanation would be that there is much greater demand for an optimized h264 encoder. WebM has some admittedly large users (Wikimedia Foundation, Youtube for browsers with no h264 support and no flash player, and now 4chan), but they're still vanishingly small in comparison to the users of h264 ("the entire video industry").

[1] http://x264dev.multimedia.cx/archives/377


I think you are underplaying the support of H.264. Almost every single camera (video or photo), console, handheld device, browser, editing tool, effects tool, phone, tablet, OS, digital video player, website available today supports H.264.

People complain about it being closed but actually it is far more open on the hardware side since each of the big manufacturers are part of the H.264 process.


If I came across as downplaying the adoption of H.264, it wasn't my intent.

Pretty sure Firefox doesn't support H.264 out of the box on Linux, though. I couldn't wrangle the gstreamer plugin into displaying it either.


h.264 has several profiles. Support for particular profiles in hardware varies. If you want to do low latency encoding with a hardware "h.264 encoder" for video conferencing you may find that you're out of luck. Since there is only one VP8 profile, hardware VP8 means hardware VP8.


> a pithy, if slightly inaccurate, description of VP8 would be “H.264 Baseline Profile with a better entropy coder..."

and

> Overall, VP8 appears to be significantly weaker than H.264 compression-wise.

don't seem to go very well together, to me. How can VP8 be a better H.264 and worse than H.264 at the same time?



H.264 defines a number of profiles and levels that define the acceptable tools from the overall suite that a conforming decoder implementation can rely on. "Baseline" uses very few of these tools, relative to the more sophisticated profiles.


Oh, I didn't know about that, thanks!


They are of comparable quality. I find the h264 slightly better, but I have not done extensive testing.

I did try dropping the quality significantly with my webm profile, but it had a trivial performance improvement.


My hypothesis for the performance disparity is that h264 encoding is hardware accelerated and webm is not.


x264 does not use GPU hardware, so they're both using just the CPU. WebM fails to use more threads or 256bit or 128bit registers correctly.


recent versions of x264 do use GPU hardware via OpenCL, but the performance gain is questionable.

http://www.planet3dnow.de/vbulletin/showthread.php/406096-Be...


The last time I did any testing was about 6 months ago, but libvpx is terrible at multi-core. x264 scales pretty much linearly with more cores.

I am generally batch encoding thousands of short videos, so I just run the encoder in single thread mode, and create a queue for each core.

IME, VP8 is about half as fast as x264. If you are trying to encode a single video on a 24 core server, then it is about 20 times slower than x264.


I was under the impression that one is hardware accelerated while the other is not?


While some systems do have H.264 encoders, bstar77 is using x264 which runs only on the CPU and produces much higher quality output than any hardware encoder[1].

1 - http://www.compression.ru/video/codec_comparison/h264_2012/#...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: