Index

RTranscoder: jpeg to mpeg

Some days ago I made some tests using mencoder to create a mpeg4 video with some jpeg images.

Then I tried to use RTranscoder to achieve the same result with ruby but it's kind of tricky to get it running correctly, because you can get an "error parsing command line" error if you don't give RTranscoder the correct information.

After a lot of attempts, my code got like this:

 MEncoder.encode do |mencoder|
   mencoder.input = "mf://*.jpg"
   mencoder.mf.fps = 25
   mencoder.mf.type = "jpg"
   mencoder.output_video_codec = :lavc
   mencoder.lavc.vcodec = "mpeg4"
   mencoder.lavc.mbd = 2
   mencoder.lavc.trell = true
   mencoder.output_audio_codec = 'copy'

   mencoder.output = 'output.avi'
 end

As you can see, instead of doing something like mencoder.mf = "fps=25:type=jpg" (my error) you have to do it with mencoder.mf.fps and mencoder.mf.type respectively, the same with lavc and everytime you need to pass an argument with suboptions separated by ":".

Here is the page of Rtranscoder.