I am transcoding DVD's to mp4 files before my toddler destroys them all. I am using FFmpeg via Linux terminal, but I started with the code generated by WinFF. I understand about 40% of the options in the code, and I have not been able to find good explanations of the other options using man ffmpeg, of ffmpeg -help full, or x264 --fullhelp, so I am hoping that I can complete my understanding with your help.
Here is the code line I am using now (transcoding takes ~ 1 hour for one movie):
/usr/local/bin/ffmpeg -y -i "/home/justin/Videos/movie.mkv" -crf 10 -vcodec libx264 -filter:v scale=720:480 -preset veryslow -acodec ac3 -ar 48000 -b:a 256k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 "/home/justin/Videos/movie-dvd-ac3.mp4"
Here is my summary of the options:
-y overwrite output files. (main option)
-i input file. (main option)
-crf Constant Rate Factor. Values: 0-51. 0 is lossless, don't go above 20. Consider adding "crf_max 20".
-vcodec specify the video encoder. (video option)
-filter This is applying a filter to stream v. (See the ffmpeg-filters manual for more information about the filtergraph syntax.) (main option)
-preset This is a quality setting. Slower speeds give higher quality, and maybe smaller file sizes. (main option)
-acodec specify the audio encoder. (audio option)
-ar Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options. (audio option)
-b Bitrates. -b:a for audio stream and -b:v for video stream
-coder ?
-flags +loop = use loop filter #what does this mean?
-cmp ?
-partitions ?
-me_method set motion estimation method (from INT_MIN to INT_MAX) (default 5)
-subq sub-pel motion estimation quality (from INT_MIN to INT_MAX) (default 8)
-me_range limit motion vectors range (1023 for DivX player) (from INT_MIN to INT_MAX) (default 0)
-g set the group of picture (GOP) size (from INT_MIN to INT_MAX) (default 12)
-keyint_min minimum interval between IDR-frames (from INT_MIN to INT_MAX) (default 25)
-sc_threshold scene change threshold (from INT_MIN to INT_MAX) (default 0)
-i_qfactor QP factor between P- and I-frames (from -FLT_MAX to FLT_MAX) (default -0.8)
-b_strategy strategy to choose between I/P/B-frames (from INT_MIN to INT_MAX) (default 0)
-threads (from 0 to INT_MAX) (default 1)
These are the options I do understand:
-y overwrite output files. (main option)
-i input file. (main option)
-crf Constant Rate Factor. Values: 0-51. 0 is lossless, don't go above 20. Consider adding "crf_max 20".
-vcodec specify the video encoder. (video option)
-filter This is applying a filter to stream v. (See the ffmpeg-filters manual for more information about the filtergraph syntax.) (main option)
-preset This is a quality setting. Slower speeds give higher quality, and maybe smaller file sizes. (main option)
-acodec specify the audio encoder. (audio option)
-ar Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options. (audio option)
-b Bitrates. -b:a for audio stream and -b:v for video stream
Is there a source / document I can go to in order to learn what the other options mean? I am hoping this will bring other useful options to light for me as well. If not, can anyone explain what teh other options are, what the defaul settings are, and pros & cons associated with the different settings for these options?
Thank you in advance!
+ Reply to Thread
Results 1 to 7 of 7
-
-
"-coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0"
Those are libx264 options, since you are using "-preset veryslow" those extra options don't need to be explicitly set unless you want to change the default preset setting, and there's really no need to change any of the defaults.
Here's the link to the libx264 settings used in Ffmpeg: http://www.ffmpeg.org/ffmpeg-all.html#libx264_002c-libx264rgb -
Two notes.
-crf 10. Constant Rate Factor is a "quality" factor. The lower the value the higher the quality (and larger file size). Normally a value of 18-22 would be used.
-acodec ac3. Your target is MP4. Typically you would prefer to use AAC codec for MP4. -
Thanks for your help, but be prepared to see how ignorant I really am
I am using the ac3 codec because that is the only audio codec my tv will play. The operator manual for my tv says it will play mp3 & aac embedded into mp4, but it does not work.
At any rate, I'll begin with one option, namely "-coder 1". This is what I have been able to find:
In Linux terminal, "x264 --fullhelp" gives a long output, but not contain any information on "coder".
In terminal, "ffmpeg -help full" gives this information, under the heading ault 0):
-coder <int> E..V.... (from INT_MIN to INT_MAX) (default 0)
vlc E..V.... variable length coder / Huffman coder
ac E..V.... arithmetic coder
raw E..V.... raw (no encoding)
rle E..V.... run-length coder
deflate E..V.... deflate-based coder
How do I figure out what the effect of different numbers will be? How do I figure out what the effect of different strings (i.e. vlc, ac, raw, rle, deflate) will be?
From the ffmpeg documentation site (http://www.ffmpeg.org/ffmpeg-all.html#libx264_002c-libx264rgb):
coder
Set entropy encoder. Possible values:
‘ac’
Enable CABAC.
‘vlc’
Enable CAVLC and disable CABAC. It generates the same effect as x264’s --no-cabac option.
From the libx264 documentation website:
(There wasn't any documentation, just a mailing list.)
So, for this particular option, I can see what the different settings are, but I cannot find a description of what the different settings do.
What is the option "-coder" for, and what effect do the various settings have on the output video? -
This page is a bit outdated, but most of the items are still relevant
https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping
Most people now use -x264opts to call any x264 specific options in ffmpeg libx264
There used to be a minimal explanation page for x264, it should be archived on the wayback machine still
http://mewiki.project357.com/wiki/X264_Settings
In terms of CABAC, you get about 10% more efficient compression. You should always use it if possible. The negatives are higher CPU usage (esp. decoding), not compatible with all devices and profiles (really only "baseline" profile devices - early generation idevices like ipods. Anything modern within the last 5-6 years is "high" compatible) -
Also, If your DVD's are "theatrical", e.g. Hollywood movies, or TV drama series - they should be IVTCed (inverse telecine, to return the original film frames at 23.976FPS instead of interlaced 29.97) before encoding . If they are interlaced (maybe some sports DVD's for example), you should encode interlaced
-
Thanks for all your help! Starting with the links providing and googling portions of those links, I was able to find these three sites describing most, if not all, the options I am looking at. These sites give pros & cons, as well as recommended settings. The first site is particularly helpful because it gives the names of the options per FFmpeg & libx264.
https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping
http://www.avidemux.org/admWiki/doku.php?id=tutorial:h.264
https://en.wikibooks.org/wiki/MeGUI/x264_Settings
Extra info:
https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC
http://akuvian.org/src/x264/overview_x264_v8_5.pdf
https://trac.ffmpeg.org/wiki/Encode/H.264
https://support.octoshape.com/entries/25126002-Encoding-best-practices-using-ffmpeg
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-dvd-mpeg4.htmlLast edited by Justin832; 28th Aug 2015 at 23:39. Reason: added another link
Similar Threads
-
x264 and ffmpeg equivalent commandline options ?
By hydra3333 in forum Video ConversionReplies: 7Last Post: 21st Apr 2014, 22:19 -
ffmpeg help - buffer options, output details?
By JDługosz in forum Video ConversionReplies: 20Last Post: 13th Feb 2014, 01:04 -
? normalizing audio volume using new ffmpeg options
By hydra3333 in forum AudioReplies: 6Last Post: 2nd Dec 2013, 22:08 -
Missing options in FFMPEG ? ex: cartoon for libxvid .. Please help!
By hugzzz in forum Video ConversionReplies: 1Last Post: 23rd Feb 2012, 12:10 -
Which ffmpeg options are used behind the scenes by ffmpeg?
By roberto.aloi in forum ffmpegX general discussionReplies: 1Last Post: 26th Jul 2011, 05:09