Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] ffmpeg -vcodec mpeg4 -> bad quality?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 886
Location: Edinburgh, Scotland

PostPosted: Thu Oct 05, 2006 5:28 pm    Post subject: [SOLVED] ffmpeg -vcodec mpeg4 -> bad quality? Reply with quote

Hi guys. Any video encoding experts around? I've got a puzzle for you. I'm getting really bad output from lavc's mpeg4 codec when using ffmpeg. However if I use the same codec with all the equivalent options in mencoder, the result is crystal. The result is also crystal if I use ffmpeg with xvid instead of lavc. I'm using the 20060530 snapshot from Portage.

Code:
ffmpeg -i test.avi -pass 1 -acodec mp3 -ar 44100 -ab 128 -vcodec mpeg4 -b 1024 -bt 1 -qmin 2 -qmax 20 -lelim -4 -celim 9 -lumi_mask 0.05 -dark_mask 0.01 -bf 2 -r 25 -mbd 1 -me_range 1023 -s 640x480 -f avi /dev/null
ffmpeg -i test.avi -pass 2 -acodec mp3 -ar 44100 -ab 128 -vcodec mpeg4 -b 1024 -bt 1 -qmin 2 -qmax 20 -lelim -4 -celim 9 -lumi_mask 0.05 -dark_mask 0.01 -bf 2 -r 25 -mbd 1 -me_range 1023 -s 640x480 -f avi output.avi


Bad! (ffmpeg with mpeg4)

Code:
ffmpeg -i test.avi -pass 1 -acodec mp3 -ar 44100 -ab 128 -vcodec xvid -b 1024 -bt 1 -qmin 2 -qmax 20 -lelim -4 -celim 9 -lumi_mask 0.05 -dark_mask 0.01 -bf 2 -r 25 -mbd 1 -me_range 1023 -s 640x480 -f avi /dev/null
ffmpeg -i test.avi -pass 2 -acodec mp3 -ar 44100 -ab 128 -vcodec xvid -b 1024 -bt 1 -qmin 2 -qmax 20 -lelim -4 -celim 9 -lumi_mask 0.05 -dark_mask 0.01 -bf 2 -r 25 -mbd 1 -me_range 1023 -s 640x480 -f avi output.avi


Good! (same options but with xvid)

Code:
mencoder test.avi -o /dev/null -oac mp3lame -lameopts cbr:br=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1024:vhq:vpass=1:vqmin=2:vqmax=20:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01:vmax_b_frames=2 -af resample=44100 -vf scale=640:480 -ofps 25
mencoder test.avi -o output.avi -oac mp3lame -lameopts cbr:br=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1024:vhq:vpass=2:vqmin=2:vqmax=20:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01:vmax_b_frames=2 -af resample=44100 -vf scale=640:480 -ofps 25


Good! (equivalent options in mencoder with mpeg4)

Here's the test video. http://www.aura-online.co.uk/~chewi/test.avi Look out for artifacts trailing behind the globe and notice how the stars go very blurry. They should remain quite sharp. I know I've used a lot of options but I had very similar results even with much fewer options. I think I must be missing some important option. And I know reencoding this seems a little pointless but it's just a test for something much more exciting. Any help would be much appreciated. :)


Last edited by Chewi on Fri Oct 06, 2006 9:47 am; edited 1 time in total
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Thu Oct 05, 2006 5:50 pm    Post subject: Reply with quote

Xvid and lavc-mpeg4 don't really take the same options, so some of the things you specified don't actually have an effect with xvid.

As for the difference between ffmpeg and mencoder - I'm not sure, but it's possible that they have different defaults, so all options you haven't specified may have different values in mencoder than they do in ffmpeg.
Back to top
View user's profile Send private message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 886
Location: Edinburgh, Scotland

PostPosted: Thu Oct 05, 2006 6:14 pm    Post subject: Reply with quote

Yeah I guessed both of those might be the case. I don't think any of the options should be making it that bad though and I did try with fewer. I think it must be down to some option I'm missing.
Back to top
View user's profile Send private message
Chewi
Developer
Developer


Joined: 01 Sep 2003
Posts: 886
Location: Edinburgh, Scotland

PostPosted: Fri Oct 06, 2006 9:46 am    Post subject: Reply with quote

Aha. Figured it out. I misunderstood the meaning of bit tolerance (-bt), which is the only option I hadn't set in mencoder. Setting it higher is a good thing.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum