You are not logged in.

#1 2010-07-06 09:51:14

skazhy
Member
From: Riga, Latvia
Registered: 2009-07-01
Posts: 46

Best video quality with Mencoder?

Hi!

I am making a video from png images. I found a script on Mplayer page that does this:

mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc lavc \
    -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

I have 2 questions, because I am new to all under the hood stuff for video making:

-Is my script making the video in best possible quality (when the output file is not tooo huge)?
-How can I add an audiofile.mp3 to the video?

Last edited by skazhy (2010-07-06 09:52:29)

Offline

#2 2010-07-06 10:59:27

maevius
Member
From: Greece
Registered: 2009-09-10
Posts: 135
Website

Re: Best video quality with Mencoder?

Maybe try adding -audiofile music.mp3 prior to -oac, sth like this:

mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc lavc \
    -lavcopts vcodec=mpeg4:mbd=2:trell -audiofile music.mp3 -oac copy -o output.avi

Also check this page, maybe you'll get helped.

Offline

#3 2010-07-06 11:17:19

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Best video quality with Mencoder?

There is no "best". It's all compromises and depends on what you want to achieve. Also, what codec do you wish to use. If it's MPEG4 ASP, then Xvid is better than the libavcodec ASP encoder. But both pale in comparison to x264, which is a MPEG4 AVC/h264 encoder.

In your command-line, you don't even specify bitrate, so I have no idea what will be the result. To help you further, you need to answer these: Who is the target audience of the video, where will they play it (computer or standalone player), and what kind of video is it (animation, computer game, CGI, live action...)? Knowing that, we'll decide between xvid or x264 and the appropriate options.

Offline

#4 2010-07-06 13:36:38

skazhy
Member
From: Riga, Latvia
Registered: 2009-07-01
Posts: 46

Re: Best video quality with Mencoder?

If this helps:
the video is composed from many png images (a time-lapse video). It is for playing on PCs and it will be uploaded to vimeo or youtube.

The images are from webcam, so they are not in very high quality.

Offline

#5 2010-07-06 15:00:51

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Best video quality with Mencoder?

You could give h264enc (AUR) a try. That's a shell script which includes many many quality presets etc.

Offline

#6 2010-07-06 15:06:05

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Best video quality with Mencoder?

Youtube (and probably vimeo too) will re-encode the video, and you say the pics are not very high quality. So in order for the end result to not look like a total mess, we'll provide youtube with the highest quality possible - which means we're going with x264:

mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc x264 -x264encopts preset=slow:tune=film:crf=20 -of rawvideo -o video.264

If you have a fast processor (dual or quad core), you can use slower or veryslow for the preset to squeeze out even more quality. crf is constant ratefactor, also called constant quality, and with it x264 will use as much bits as necessary to achieve the specified ratefactor. 20 is a ballpark figure that I've found provides good quality with not-too-large filesizes. Lower crf means bigger file with better quality, higher crf means smaller file with worse quality.

Once you have the video, install mkvtoolnix to combine video and audio:

mkvmerge -o yourvideo.mkv  --default-duration 0:25fps -d 0 video.264 -a 0 audiofile.mp3

Offline

#7 2010-07-07 10:01:21

skazhy
Member
From: Riga, Latvia
Registered: 2009-07-01
Posts: 46

Re: Best video quality with Mencoder?

Thank you very much, Gusar, for your help smile

Offline

Board footer

Powered by FluxBB