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. |
11th January 2008, 18:31 | #1 | Link |
Registered User
Join Date: Aug 2006
Posts: 15
|
Xvid encoding with ffmpeg
Hi everybody,
i'm using ffmpeg for encoding video with xvid. My problem is that i can't get out which options from ffmpeg i can use for xvid, because in the documentation the options are mostly not codec related. So perhaps i can find any experienced ffmpeg+xvid users here who can tell me some good options for xvid encoding. My current commandline looks like this: Code:
ffmpeg -y -i IN.avi -aspect 4:3 -vcodec libxvid -s 640x480 -r 25 -b 1000k -flags +trell -g 250 -me_method epzs -qmin 2 -qmax 15 -acodec libmp3lame -ac 2 -ar 44100 -ab 80k -benchmark OUT.avi Is the "flag +aic" an option which is supported by standalone players? Things if already tried are "gmc, qpel,4mv"... |
17th January 2008, 11:14 | #2 | Link |
Registered User
Join Date: Oct 2007
Posts: 43
|
Try for example (change in/out files):
Code:
ffmpeg -i "sara.mpg" -vcodec libxvid -trell -max_bframes=2 -s 576x432 -b 800k -r 23.976 -acodec libmp3lame -ac 2 -ar 48000 -ab 128k -y -f avi my_dog.avi For two pass encoding try for example Code:
ffmpeg -i "sara.mpg" -vcodec libxvid -trell -max_bframes=2 -s 576x432 -b 800k -r 23.976 -acodec libmp3lame -ac 2 -ar 48000 -ab 128k -y -pass1 "xvid.stats" -f avi my_dog.avi ffmpeg -i "sara.mpg" -vcodec libxvid -trell -max_bframes=2 -s 576x432 -b 800k -r 23.976 -acodec libmp3lame -ac 2 -ar 48000 -ab 128k -y -pass2 "xvid.stats" -f avi my_dog.avi FYI, qpel (and GMC partially) is incompatible with almost all standalone players. ffmpeg -h > ffmpeg_help.txt will dump help into file ffmpeg -formats help > formats.txt will dump info on formats into file, etc… Ffmpeg is constanly developed, so - ALL options vary from one revision/version to another. For instance, above examples works for ffmpeg.exe I've compiled for myself: Code:
FFmpeg version SVN-r10822, Copyright (c) 2000-2007 Fabrice Bellard, et al. configuration: --prefix=/mingw --enable-static --disable-shared -- enable-pp --enable-swscaler --enable-libmp3lame --enable-libfaac --e nable-libfaad --enable-libx264 --enable-libxvid --enable-libogg --en able-libvorbis --enable-liba52 --enable-gpl --enable-libamr-nb --ena ble-libamr-wb --enable-avisynth --extra-cflags=-g0 -O2 -D_GNU_SOURCE -ffast-math --enable-memalign-hack --disable-debug --enable-w32thre ads --extra-libs=-lwinmm -lavisynth --arch=prescott --cpu=prescott - -extra-ldflags=-static libavutil version: 49.5.0 libavcodec version: 51.46.0 libavformat version: 51.16.0 built on Oct 23 2007 23:57:14, gcc: 4.3.0 20070831CYBORG (experimental) (by_20-40) |
28th August 2010, 00:29 | #3 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
|
I have a similar issue ... http://ffmpeg.arrozcru.org/autobuilds/ offers a quite versatile and current build; unfortunately there are so many options that I am hardly able to filter which of them are relevant for Xvid encoding with ffmpeg at all.
Let's imagine I'd like to encode "anything" to MP4 with Xvid MPEG4-ASP video and LAME MP3 audio because that's quite the best size/quality ratio my mobile media player supports. To get rather optimal results, I'd try to have the video encoded with fixed quantizer (because Xvid does not really support a good "constant quality" algorithm like x264's CRF ... yet?) and the audio with a constant quality as offered by LAME's VBR mode. Which command line options of ffmpeg can I use / should I use for rather optimal results? It seems to me that ffmpeg does not support codec specific options (like "-xvidencopts" in mencoder) but offers a lot of generic options instead, which may be supported by a specific codec or not. So e.g. there is the command line option "-trellis #", and because Xvid supports trellis quantization, encoding to MPEG4-ASP using libxvid probably uses Trellis if I add this option -- but which (integer) parameter for this option would make sense? In case of Xvid possibly 0 and 1; in case of x264 possibly 0, 1 and 2. And in case of a constant quantization possibly not at all. There are just too many options and provided by ffmpeg (with too briefly documented value ranges), I am losing track of which have any relation to Xvid at all, and which range of values is useful in case of Xvid as video encoder. The same applies to LAME as MP3 encoder - although I try to use parameters which should create a quality based VBR MP3 audio stream, I am not certain if the result is as desired until I demultiplex the result and check it (and may the reason just be that ffmpeg writes a constant bitrate into its console output). So - which options would you recommend to get a quality based but small sized VBR result for a mobile media player (like a cell phone) in addition to my first try? ffmpeg.exe -y -i %1 -vcodec libxvid -bf 1 -qscale 4 -s 320x240 -acodec libmp3lame -aq 2 -ar 22050 -ac 2 -f mp4 "%~n1.mp4" |
28th August 2010, 21:29 | #4 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
|
I found a solution: There are ffmpeg GUIs (like FFCoder) which know more about command line options than me. They helped me building useful parameter sets.
So I found that B frames can confuse players and make MediaInfo report movies as "variable frame rate" even though they have constant frame rates. Probably only with certain containers (MP4, 3GPP) written by ffmpeg. Interesting that the latest ffmpeg builds contain an AAC encoder too. I thought the author of FAAC got nearly sued if he didn't stop his project ... even if the LAVC AAC encoder has low quality and needs to be enabled with "-strict experimental" -- be careful with license lawyers. Last edited by LigH; 28th August 2010 at 21:34. |
12th September 2010, 03:41 | #6 | Link | |
Registered User
Join Date: Apr 2006
Posts: 134
|
Quote:
If i use ffmpeg to cut it does the same but u can add "-bf 1" or howmany bframes u want......BUT it crashes my vbr mp3 and writes CBR in the header witch leads to play errors. Suggestions? Chris |
|
2nd November 2010, 15:32 | #7 | Link | |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
|
Quote:
|
|
2nd November 2010, 16:36 | #8 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
|
No panic. VBR audio is no problem for the AVI container. Alexander Noé proved it. AviMux-GUI and Avidemux can handle it. Even VirtualDubMod only warns if you don't disable the warning - a relic from Avery Lee's original VirtualDub.
|
5th November 2010, 04:51 | #9 | Link |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
|
The subject matter is to be cut a video with audio variable, a way to avoid trouble would pass the audio to CBR. Once I had problems joining two pieces of a avi with VBR audio, Not only the audio was not synchronized but also part of the sound at the beginning of the second piece was cut. I took to get a WAV and synchronized. In short, this proposal is just one solution, so that there may be others.
|
23rd February 2012, 19:06 | #10 | Link | |
Registered User
Join Date: Feb 2007
Posts: 12
|
Quote:
I have exactly the same question. Where can I check the available options for libxvid on FFmpeg? Thanks. |
|
9th March 2012, 04:19 | #11 | Link |
Registered User
Join Date: Aug 2006
Location: USA
Posts: 59
|
Xvid encoding with ffmpeg
I am also using ffmpeg a lot for encoding xvid (except when I have a 5.1 channel audio that I want to keep, in which case I have to use virtualdub).
I have been using 'libxvid' most of the time, and 'mpeg4' when I wanted to use b-frames -- I haven't been able to get a good result with b-frames and libxvid, for whatever reason. Here is a good site that offers a useful discussion of a number of xvid options for ffmpeg: http://helpful.knobs-dials.com/index...or%20divx/xvid. Naturally, the complete list that you get when you do 'ffmpeg -h' is not self-explanatory, but is helpful to verify syntax and spelling. Some commands have evolved with newer versions of ffmpeg, and the console gives all the information pertaining to your version of ffmpeg. There is also the Unofficial XVID FAQ: http://kaitsuburi.tripod.com/crusty_xvid_faq_v20040406.pdf , somewhat dated, but Xvid is not that new. It doesn't provide the ffmpeg commands, but, with a little guesswork, it is almost always possible to find out what is the command corresponding to the feature described. Hope that helps. Last edited by JeanMarc; 9th March 2012 at 04:44. Reason: Better link to xvid faq |
9th March 2012, 09:05 | #12 | Link | |
brontosaurusrex
Join Date: Oct 2001
Posts: 2,392
|
Quote:
say i'd like to convert "vpxenc -v --rt -p 2 --pass=1 --bias-pct=100 --fpf="$tmp.log" --threads=8 --target-bitrate=55000 --end-usage=cq --cq-level=20 --kf-min-dist=0 --kf-max-dist=100 --auto-alt-ref=1 --lag-in-frames=16 --drop-frame=0 --min-q=0 --max-q=60" to ffmpeg with some slightish guesswork?
__________________
certain other member |
|
9th March 2012, 14:24 | #13 | Link | |
Registered User
Join Date: Aug 2006
Location: USA
Posts: 59
|
Quote:
Now, my post was intended to help people like raymng understand the XVID options when encoding with ffmpeg. I wouldn't say anything about translating a webm command into ffmpeg, especially since I have never used vpxenc. Do you imply that ffmpeg can do the same encoding as your vpxenc command ? |
|
16th May 2012, 05:31 | #15 | Link |
Registered User
Join Date: Jun 2005
Posts: 236
|
I've just started trying to use ffmpeg (via MCEBuddy). Is there a way to set a target size for the final AVI? I'm used to using MeGUI, which automatically does it for you. I'd like to use MCEBuddy to automate my encoding, but I need to my files to be a set size. Can ffmpeg do this while taking the audio size into account, so I can get a final product that is, for example 700MB?
|
14th January 2013, 17:44 | #16 | Link |
Observer
Join Date: Jul 2008
Location: Kingston, Jamaica.
Posts: 113
|
Guys, I think that the "default" preset in xvidcore.dll (or xvidvfw.dll, for that matter) is pretty darn okey, just to fulfill in produce a descent video with desired bitrate/quantizer, which is still playble with most stand-alones.
However, running an ffmpeg encode with '-c:v libxvid' and switch(es) '-q:v' or '-b:v' does indeed produce an output with desired bitrate or quantizer, but it seems to disregard some of the settings from the "default" preset from the XviD library. For instance, it disables all B-frames, so I need to add '-bf 2' to make it fit my bill. Also, trellis is checked, and I'm not sure if it should be '-trellis 1' or '-trellis 2' to make the encode fit what Xvid library would have done per default. Also, in some ffmpeg command line examples I've seen even more switches being add, like '-subcmp' for instance. I'm not even sure what this does, or if the default (when not specified) encode from ffmpeg differs from how Xvid would do. Hey, here comes the short [TLDR] version. Could anyone who's skilled about this video stuff write a xvid_defaults.preset and upload it someplace, with settings that would match the actual Xvid encoding library in every aspect? Would be awesome. Cheers! |
10th April 2013, 11:34 | #17 | Link |
Registered User
Join Date: Jan 2008
Location: Kharkov, UA
Posts: 105
|
Hi all,
I have just tried to encode video with libxvid (using ffmpeg)... So, comparing to embedded ffmpeg's 'mpeg4' codec the quality has been significantly decreased.
__________________
Gentoo linux |
10th April 2013, 16:56 | #20 | Link | |
Registered User
Join Date: Jan 2008
Location: Kharkov, UA
Posts: 105
|
Quote:
$ ffmpeg -i input.avi -an -c:v mpeg4 -qscale 1.4 out.avi This topic is about ffmpeg and it doesn't recognize 'xvidenc' option.
__________________
Gentoo linux |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|