Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 ASP

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th December 2012, 18:04   #1  |  Link
Wintershade
Registered User
 
Wintershade's Avatar
 
Join Date: Dec 2005
Location: Twin Peaks
Posts: 22
A bit confused with FFMPEG - I want something to play in my "Home Theater"...

Hi everyone. It's been quite a while since I've last been here, and even longer since I've done any serious video transcoding. I've changed my OS in the meantime (completely switched to Linux from Windows), and a few other things.

Now that I want to rip some DVDs (and similar) again, I feel a bit confused. Yes, I've read the documentations and googled extensively, and yet, I haven't found a solution to my problem which I could really trust.

Here's the thing - my parents own an LG home theater, which happily plays MPEG4 files (in .avi container), i.e. the XviD, DivX and similar media. However, now that I'm on Linux, I'm surrounded by a few different commandline applications, as well as their GUIs, and it's quite a change from what I am used to (back on Windows, I used to rip DVDs with MeGUI, and through your forum acquired quite a bit of understanding about all this stuff, particularly about XivD and AVISynth). There's no such application on Linux, and besides, I personally prefer to use command line here.

Thus, from what I understand, ffmpeg is the thing to use if I want to transcode media. I am looking for a solution to make standalone-compatibile video files (i.e. MPEG4+avi), with the video quality and size like I used to in MeGUI. Which usually means, full DVD resolution and framerate, and that everything looks quite nice if I put it on 2 CDs (1,4 GB or so - usually 1000-1500 kbps video).

However, I can't get that with ffmpeg. I am using the "mpeg4" as vcodec, and the flags which were recommended in the official documentation - and at the same bitrate as XviD in MeGUI, this produces videos of much worse quality. The difference in video quality is blatantly obvious, in favour of XviD. The video which ffmpeg produces is terribly blocky, and if I set the constant quantizer of e.g. 2 the video quality is OK, but the resulting file is huge (usually not much smaller than a DVD - way over 3 GiB for a 2h film).

So, what am I to do? Should I use libxvid as a video codec? Is there a source which can give me good info about using it? Should I just try to get all the flags which I have in MeGUI's "HQ Home Theater" profile? Or am I doing something wrong with ffmpeg+mpeg4? Is there any other viable solution (what is the actual state of mencoder, compared to ffmpeg)?

Thanks in advance! (and sorry if I write too much)
(edit: just realised I might be in the wrong subforum for this... if someone would be so kind and move it to the right forum, that would be grand! )



TL;DR - Linux - ffmpeg's mpeg4 video codec, or libxvid? How to get good video quality at a "reasonable" bitrate (1000-1500kbps)? Any good documentation and/or examples of using libxvid through ffmpeg? What about mencoder? TIA!
__________________
Only the best is good enough.

Last edited by Wintershade; 18th December 2012 at 18:07.
Wintershade is offline   Reply With Quote
Old 18th December 2012, 21:06   #2  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,868
Here are the settings I use (taken from WinFF profiles). They are for widescreen 16:9 content:

Quote:
-f avi -vcodec libxvid -vtag XVID -vf scale=704:384 -aspect 16:9 -maxrate 1800k -b:v 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -trellis 1 -flags +aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -b:a 128k -ac 2
And this is the fast version:
Quote:
-f avi -vcodec libxvid -vtag XVID -vf scale=704:384 -aspect 16:9 -maxrate 1800k -b:v 1500k -qmin 3 -qmax 5 -acodec libmp3lame -ar 48000 -b:a 128k -ac 2


Good luck
manolito
manolito is offline   Reply With Quote
Old 18th December 2012, 21:16   #3  |  Link
Wintershade
Registered User
 
Wintershade's Avatar
 
Join Date: Dec 2005
Location: Twin Peaks
Posts: 22
OK, so I'm supposed to use "-vcodec libxvid" over "-vcodec mpeg4" after all?

Thanks for the line, friend Will give it a go, and will post about the results.
__________________
Only the best is good enough.
Wintershade is offline   Reply With Quote
Old 19th December 2012, 14:29   #4  |  Link
mandarinka
Registered User
 
mandarinka's Avatar
 
Join Date: Jan 2007
Posts: 739
-vcodec mpeg4 would use FFMPEG's own mpeg4 ASP encoder, which is a different implementation from xvid. You might be able to get better quality from it if you overcome the loads of cryptical options, but it is also slower than xvid AFAIK.
mandarinka is offline   Reply With Quote
Old 21st December 2012, 00:30   #5  |  Link
Wintershade
Registered User
 
Wintershade's Avatar
 
Join Date: Dec 2005
Location: Twin Peaks
Posts: 22
Sorry for taking so much time for the feedback. real life kicks in on a daily basis

So I've tried the proposed settings for ffmpeg, and I still didn't get the quality/compression I was looking for. To clarify things a bit, I'm trying to encode a few videos at 720x400px resolution, at the bitrate of around 1200kbps for video.

Now, I got much better results with mencoder (quality-vs-compression-wise), but I've used different options (mostly taken/translated from a MeGUI profile), as follows:
Code:
[xvid-HQ-HT-pass1]
profile-desc="XviD for Home Theater, HQ - pass 1"
ovc=xvid=1
xvidencopts=pass=1:bitrate=1200:turbo=1:trellis=1:max_key_interval=250:max_bframes=1:threads=1:vhq=4:me_quality=6:chroma_me=1:chroma_opt=1:
    lumi_mask=1:min_iquant=2:max_iquant=10:min_pquant=3:max_pquant=20:min_bquant=3:max_bquant=20:bquant_ratio=162:bquant_offset=0:
    keyframe_boost=100:kfthreshold=1:kfreduction=20:overflow_control_strength=25:max_overflow_improvement=10:max_overflow_degradation=33:
    curve_compression_high=15:curve_compression_low=30:quant_type=h263
    passlogfile=xvid-pass1.log
nosound=1

[xvid-HQ-HT-pass2]
profile-desc="XviD for Home Theater, HQ - pass 2"
ovc=xvid=1
xvidencopts=pass=2:bitrate=1200:turbo=1:trellis=1:max_key_interval=250:max_bframes=1:threads=1:vhq=4:me_quality=6:chroma_me=1:chroma_opt=1:
    lumi_mask=1:min_iquant=2:max_iquant=10:min_pquant=3:max_pquant=20:min_bquant=3:max_bquant=20:bquant_ratio=162:bquant_offset=0:
    keyframe_boost=100:kfthreshold=1:kfreduction=20:overflow_control_strength=25:max_overflow_improvement=10:max_overflow_degradation=33:
    curve_compression_high=15:curve_compression_low=30:quant_type=h263
passlogfile=xvid-pass1.log
oac=mp3lame=1
af=resample=44100
lameopts=aq=0:vbr=4:q=5
On top of that, I am using crop, hqdn3d and scale filters (in that order) on both ffmpeg and mencoder (and I am only using crop and scale for videos whose resolution is above 720x400).

This has given me far better (i.e. enjoyable to my eyes) video at that bitrate and resolution. However, mencoder's encoding speed leaves something to be desired (I suppose).
I have a (rather old, I know) Intel core2duo CPU @2GHz, and mencoder yields around 23-27 fps and around 15ish fps, for the 1st and 2nd pass, respectively. To compare, ffmpeg had the encoding speed of around 30-50 fps for both passes.

Now, I understand that the options I've used in mencoder might have slowed it down quite a bit, and am content on using it as is, if this looks right. But I am now wondering - does it really look right? Should they have such impact on performance, or am I doing something wrong? I remember having about the same speed with my old computer on MeGUI, and it was an AMD AthlonXP (single core, 32bit, compared to this which is dual-core, 64bit, on a 64bit OS with 64bit mencoder and ffmpeg), so forgive me if it looks a tad bit suspicious to me.
(just a quick reminder - I'm currently on Linux, and I admit that I'm not a Linux guru by any criteria)

If this is all good and well, then my next question will be - can I use such settings in ffmpeg when calling libxvid? If I understand Linux correctly, this is exactly the same libxvid when invoked by either of the two apps, so it should (in theory) accept the same options and flags... but how to do it?

Sadly, "ffmpeg -h long > ffmpeg.txt" has provided me with a plaintext file with no information on libxvid options whatsoever... Anyone have any ideas regarding that?
As well as the cryptic mpeg4 options in ffmpeg (mentioned by @mandarinka)... I'd like to see them and play with them a bit as well.

Thanks everyone, and again, thanks in advance!


TL;DR - tried the settings; not completely happy with the outcome (720x400px video @1200 kbps); tried mencoder with settings stolen from a MeGUI profile - much happier with the results, but the speed is much lower - is that normal? how to use such settings in ffmpeg? any documentation regarding libxvid and mpeg4 codecs for ffmpeg? TIA
__________________
Only the best is good enough.

Last edited by Wintershade; 21st December 2012 at 00:33. Reason: I've chopped down the xvidencopts lines in the codes, so the post is easier to read. Bear that in mind if you're c/p-ing them
Wintershade is offline   Reply With Quote
Reply

Tags
ffmpeg, libxvid, mencoder, mpeg4, xvid

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.