[theora-dev] optimization of theora contract job

Basil Mohamed Gohar abu_hurayrah at hidayahonline.org
Mon Nov 15 17:41:22 PST 2010

On 11/15/2010 06:01 PM, Todd Weaver wrote:
> Theora-devs:
> I am in seek of a theora (but possibly vorbis/ogg/ffmpeg) dev to optimize the encoding in a realtime software product.
> We do live encoding and transcode into ogg/theora/vorbis at various resolutions and frame rates. The higher resolutions cannot process in realtime and we are pushing the boundaries of hardware (cpu) encoding with the existing theora/ffmpeg.
> Right now we have to downsample 1080 to 480 before we can transcode, so it becomes a two-step ffmpeg process to get a 480 ogg/theora/vorbis done in realtime:
> One proc:
>    ffmpeg -deinterlace -sws_flags bilinear -i - -vcodec mpeg2video -f mpegts -vb 3000000 -s 852x480 -acodec copy -v 0 -async 2 -croptop 5 -padtop 5 -padcolor 000000 -
> Another proc:
>    ffmpeg -sws_flags bilinear -i - -vcodec libtheora -f ogg -vb 704000 -r 14.00 -s 852x480 -aspect 16:9 -acodec libvorbis -ar 44100 -ac 2 -ab 64000 -v 0 -async 2 -
> This would be a contract job hourly starting within a week, and would likely turn into an ongoing relationship for contracted work, as we will continue to push the envelope, starting with 480p, then 720p, and hopefully 1080p.
> Please provide an approach to optimizing, hourly rate, and availability.
> Thanks so much!
> P.S. (I asked if it was appropriate to post a job on this mailing list from #theora irc, and got the nod that it was ok.)
> Todd Weaver
> todd at ivi.tv

Actually, before even getting into code, there appears to be many things
you can do.

For starters, it's not clear why you need the two steps, unless it is
due to parallelism (i.e., doing the steps in two separate, but parallel,
CPU processes).  In that case, you might consider gstreamer, which is
fully capable of doing everything you've indicated by the commands
you've given as examples above.

Another point is to go ahead and make use of Ptalarbvorm, which is the
current development version of libtheora which is going to be released
as libtheora 1.2.  It currently has an additional speed level as well as
improvements to the other speed levels that give more flexibility to the
encoding process in terms of time/efficiency tradeoffs.

Finally, you can try to use ffmpeg2theora instead of straight ffmpeg, as
it exposes more of libtheora's native features (e.g., the speed level
options) than the stock ffmpeg utility does.

I'm sure there are other bits of advice that can apply, and I hope
others will share, and this is all before actually getting into code. 
For example, encoding to mpeg2video in the middle is an unnecessary step
- you can just use the yuv4mpegpipe format with rawvideo to send the
video forward to a theora encoder, for example.

Hope some of that helps!

More information about the theora-dev mailing list