Here is a monkey patch to renice transcoders

1 view
Skip to first unread message

Kai Krakow

unread,
Nov 11, 2008, 6:59:01 AM11/11/08
to RVideo
We needed this to keep down server load on paralleled, backgrounded
rvideo processes. As a thank to the developers I'd like to give this
back to the community:

http://gist.github.com/23812

Maybe it's of interest for integration into RVideo...

Kyle Drake

unread,
Nov 11, 2008, 2:28:36 PM11/11/08
to rvi...@googlegroups.com
This is a very good idea to integrate, as I'm sure quite a few people
are monkey-patching to do this. All of my encoding tasks go through a
nice pipe so that I can control this. Great suggestion.

I'm not clear on how your change works. Can you configure the nice
number here from RVideo? I would like to be able to set that.

Thanks!

Kyle Drake
Net Brew Design
http://www.netbrewdesign.com

Kai Krakow

unread,
Nov 11, 2008, 3:31:31 PM11/11/08
to RVideo
I suppose that would be possible to do with further monkey patching
(so you can use a transcoder option to set that). For now just modify
the nice call in the patch. It's hardwired globally to your
application then however.

The monkey patch works by replacing the execution core of the
application tool interface to prepend "nice" to the final command and
undoing the change when the encoder returns (thus hiding its
activity). Just place it in RAILS_ROOT/config/initializers and you are
set to go. And just replace the prepended "nice" with "nice -5" oder
"nice -10" or any other value depending on how nice you want to be.

I'm also having a background dispatcher as module includable in a
video model which uses acts_as_state_machine to implement an encoder
queue (e.g. run 6 encoders in parallel max, fair queueing) and to
convert several versions of the same source stream (eg preview jpg, lq
flv, hq mp4). It uses the background plugin for rails to dispatch the
encoders into background. The queue management is guarded by a flag
and a transaction so it should be race-condition safe. It's apparently
not mature enough to be released yet (too integrated with our video
class which is application logic which we do not want to/cannot
release to public).

On 11 Nov., 20:28, "Kyle Drake" <kyledr...@gmail.com> wrote:
> This is a very good idea to integrate, as I'm sure quite a few people
> are monkey-patching to do this. All of my encoding tasks go through a
> nice pipe so that I can control this. Great suggestion.
>
> I'm not clear on how your change works. Can you configure the nice
> number here from RVideo? I would like to be able to set that.
>
> Thanks!
>
> Kyle Drake
> Net Brew Designhttp://www.netbrewdesign.com

Kai Krakow

unread,
Nov 13, 2008, 6:14:35 AM11/13/08
to RVideo
Here is another file added which allows using MP4Creator for hinting
mp4 files created by ffmpeg to make them streamable.

http://gist.github.com/23812

Just add

# mp4creator -optimize -interleave $output_file$

at the end of your encoder recipe.

Hope this tool will be added to RVideo. The developer should be able
to include my extension 1:1.

JDL

unread,
Nov 13, 2008, 11:02:10 AM11/13/08
to rvi...@googlegroups.com

Thank you. This looks like a really good idea.

-- James

Reply all
Reply to author
Forward
0 new messages