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-2 Encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th June 2017, 06:36   #21  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Thanks for the B-Frame strategy explanation, I think I understand it now. Well, one thing I still don't understand:
For the second pass b_strategy is not defined. Which means that the default b_strategy = 0 (max number of B_Frames) is used for the second pass. Does b_sensitivity have any effect at all if b_stragey is not = 1?
Quote:
Adjusts how sensitively vb_strategy=1 detects motion and avoids using B-frames
What I want to say is that for the second pass b_strategy should be set to 1 if using b_sensitivity=10. If b_stragety is not set then b_sensitivity has no effect. Or am I misundestanding something here?

//EDIT//
Oops, I totally overlooked this one:
Quote:
vb_strategy=<0−2> (pass one only)
So if b_strategy cannot be used for the second pass what does b_sensitivity actually do for the second pass?
I hate the FFmpeg documentation...


For the GOP size the FFmpeg default is 12 which I use anyways, no matter if my target is PAL, NTSC or Pulldown. Using a GOP size of 15 or 18 I found that the slightly better compression for larger GOP sizes does not make up for the loss in quality, especially for GOP 18. It would be nice if FFmpeg had an Auto-GOP feature like HCenc...


Cheers
manolito

Last edited by manolito; 7th June 2017 at 06:50.
manolito is offline   Reply With Quote
Old 7th June 2017, 09:53   #22  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
After a couple of test conversions I can confirm that using the b_sensitivity parameter for the second pass has no effect at all. It should be removed from the second pass.

Otherwise comparing a couple of encodes using either the Fishman parameters or the GMJCZP parameters showed that generally the GMJCZP encodes had a lot less B-Frames. And these encodes also showed a very slight tendency to undersize. For the visual quality I still cannot point my fingers on any differences. Both encodes looked damn good to me.


Cheers
manolito


//EDIT//
I reuploaded a modified version of my test bench script here:
http://forum.doom9.org/showthread.ph...32#post1808832
Please redownload...

Last edited by manolito; 7th June 2017 at 16:24.
manolito is offline   Reply With Quote
Old 7th June 2017, 16:57   #23  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Quote:
For the GOP size the FFmpeg default is 12
Thanks manolito.

Quote:
Using a GOP size of 15 or 18 I found that the slightly better compression for larger GOP sizes does not make up for the loss in quality, especially for GOP 18. It would be nice if FFmpeg had an Auto-GOP feature like HCenc...
Set de GOP size change the frame structure, IMHO is more safe put g=12, 15 or 18, given the fps of the video input, and I agree with you that FFMPEG should also have the AUTOGOP feature. That's why I use sc_threshold and b_sensitivity for "manually" set the GOP and thus try to emulate the AUTOGOP function of HCEncoder.

For curiosity, here is a extract of the HCEncoder help:

Quote:
*AUTOGOP
parameter goplength (8 – 18) type integer
Status not required
Default 15 (12 for 23.976 fps)
Example *AUTOGOP 12
This command sets the maximum GOP length to be used by the autogop algorithm.
Running in AUTOGOP mode means the encoder tries to distribute the I, P and B frames in an
optimal manner based on the activity of the frames.
Encoding using AUTOGOP will be DVD-compliant if the next values are used:
• For NTSC source to be pulldowned, use values 12 – 14.
• For PAL source a maximum value of 15 should be used.
• For 29.97 NTSC source the maximum of 18 can be used.
Quote:
I hate the FFmpeg documentation...
Lol, I recommend the MPlayer help for these things.

Quote:
I reuploaded a modified version of my test bench script
Thanks, I'll have a look at it.
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 18th June 2017 at 16:59.
GMJCZP is offline   Reply With Quote
Old 8th June 2017, 21:46   #24  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Coding to DVD with FFMPEG

Code:
@echo off

@REM -----------------------------------------------------------------------------------------------
@REM
@REM                             FFMPEG MPEG2 Profile (video output only)
@REM                                  GMJCZP, version 4.2, 27/06/2021
@REM
@REM -----------------------------------------------------------------------------------------------

@REM Script based in "DVDs ¿crees que tu codificador es el mejor ENTONCES DEMUÉSTRALO!!! (versión 2.0)" page 2, and tests of Fishman0919, manolito and mine
@REM Thanks to ALEX-KID, manono, Didée, hank315, Fishman0919 and manolito!



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                                Source and target files
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

@REM Source file (if source file is not a avs file then define for output file in the second pass frame size and frame rate, see Other settings)
set E_SRC="input.avs"

@REM Target file
set E_VID="video.m2v"



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                             Rate control settings
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

@REM Medium bitrate (b)
set E_BR=3000k

@REM Maximum Bitrate (maxrate) (Use 9800k max for DVD compatibility)
set VBV_MBR=9800k

@REM Maximum buffer size (bufsize) (Use 1835k max for DVD compatibility)
set VBV_MBS=1835k

@REM Fixed quality VBR (q) (Fishman0919's suggestion)
set E_FQ=2.0

@REM Minimum quantizer (qmin) (2 is good value for low bitrate, b<=1800k)
set E_MQ=1.0

@REM Minimum frame-level Lagrange multiplier (lmin) [0.01;255.0] (Fishman0919 suggests a value of 0.75)
set E_MLM=0.75

@REM Minimum macroblock-level Lagrange multiplier (mblmin) [0.01;255.0] (Fishman0919 suggests a value of 50.0)
set E_MBL=50.0

@REM Quantizer variability (qcomp) [0.00;1.00] (0.75 is good value) (Fishman0919 suggests a value of 0.7)
set E_VQ=0.70



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                                   GOP structure
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

@REM Maximum interval of I-frames or Keyframes (g) (Use 15 for DVD PAL, 18 for DVD NTSC, 12 for Pulldown)
set E_MIK=12

@REM Maximum number of B-frames (bf) [0;4] (Use 2 for DVD compatibility)
set E_MBF=2

@REM Adaptive B-Frames strategy (b_strategy) [0;2] (Pass one only, 0 is deactivated, 1 is fast and 2 is slow. Fishman0919 suggests a value of 2)
set E_ABF=2

@REM Slow adaptive refinement of B-frames (brd_scale) [0;3] (0 is full search, higher is faster; only valid if b_strategy=2. Fishman0919 suggests a value of 2)
set E_SBF=2

@REM Motion detection for B-frames (b_sensitivity) [>0] (Only valid if b_strategy=1)
set E_DBF=40

@REM Threshold for scene change detection (sc_threshold) [−1000000000;1000000000] (Negative values indicate that it is more likely to insert an I-frame when it detects a scene change)
set E_TSD=-30000



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                    Motion estimation settings
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

@REM Range for motion estimation (me_range) [0;9999]
set E_RME=0

@REM Optimization of rate distortion (mbd) [0;2] (2 is the best value)
set E_RDO=2

@REM Diamond size (and pre-pass too) (dia_size, pre_dia_size) [-99;6] (Negative values are for adaptive diamond)
set E_DIA=-4

@REM Comparison function for the macroblock decision (mbcmp) [0;2000] (0 is SAD, 1 is SSE2, 2 is SADT, +256 for chroma motion estimation, currently does not work (correctly) with B-frames)
set E_CMB=2

@REM Comparison function for pre pass, full, and sub motion estimation (precmp, subcmp, cmp) [0;2000] (0 is SAD, 1 is SSE2, 2 is SADT, +256 for chroma motion estimation, currently does not work (correctly) with B-frames)
set E_CMP=2

@REM Comparison function for frame skip (skip_cmp) [0;2000] (0 is SAD, 1 is SSE2, 2 is SADT, +256 for chroma motion estimation, currently does not work (correctly) with B-frames)
set E_CMS=2

@REM Amount of motion predictors (last_pred) [0;99]
set E_AMP=2



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                                    Other settings
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

@REM Aspect Ratio (aspect) (4/3 or 16/9 for DVD compatibility)
set E_DAR=4/3

@REM Frame size (s) (b up to 2500 kbps =>s=704x480 (NTSC), b greater than 2500 kbps =>s=720x480 (NTSC))
set E_SZE=720x480

@REM Frame rate (r) (use 25 for PAL, 24000/1001 or 30000/1001 para NTSC)
set E_FPS=24000/1001

@REM DC precision (dc) [8;10] (b up to 1800k =>dc=8, between 1800k and 3500k =>dc=9, greater than 3500k =>dc=10)
set E_DC=9



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                                    Matrices
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

@REM MPEG (default matrix for any bitrate)
set E_INTRA=8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83
set E_INTER=16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,24,18,19,20,21,22,23,24,25,19,20,21,22,23,24,26,27,20,21,22,23,25,26,27,28,21,22,23,24,26,27,28,30,22,23,24,26,27,28,30,31,23,24,25,27,28,30,31,33

@REM MPEG Standard (for any bitrate, the default matrix of FFMPEG, there are matrices better than this)
@REM set E_INTRA=08,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83
@REM set E_INTER=16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16

@REM FOX New Matrix (manolito's suggestion, for bitrate>=3000k)
@REM set E_INTRA=08,08,09,09,10,10,11,11,08,09,09,10,10,11,11,12,09,09,10,10,11,11,12,12,09,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16
@REM set E_INTER=08,08,09,09,10,10,11,11,08,09,09,10,10,11,11,12,09,09,10,10,11,11,12,12,09,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16

@REM FOX Home Entertainment
@REM set E_INTRA=08,08,09,11,13,13,14,17,08,08,11,12,13,14,17,18,09,11,13,13,14,17,17,16,11,11,13,13,13,17,18,20,11,13,13,13,16,17,20,24,13,13,13,16,17,20,24,29,13,12,13,17,19,23,28,34,12,13,17,19,23,28,34,41
@REM set E_INTER=08,08,08,09,09,09,09,10,08,08,09,09,09,09,10,10,08,09,09,09,09,10,10,10,09,09,09,09,10,10,10,10,09,09,09,10,10,10,10,11,09,09,10,10,10,10,11,11,09,10,10,10,10,11,11,11,10,10,10,10,11,11,11,11

@REM FOX1
@REM set E_INTRA=08,08,09,11,13,13,14,17,08,08,11,12,13,14,17,18,09,11,13,13,14,17,17,19,11,11,13,13,14,17,18,20,11,13,13,14,16,17,20,24,13,13,14,16,17,20,24,29,13,13,14,17,19,23,28,34,13,14,17,19,23,28,34,41
@REM set E_INTER=08,08,08,09,09,09,09,10,08,08,09,09,09,09,10,10,08,09,09,09,09,10,10,10,09,09,09,09,10,10,10,10,09,09,09,10,10,10,10,11,09,09,10,10,10,10,11,11,09,10,10,10,10,11,11,11,10,10,10,10,11,11,11,11

@REM FOX2
@REM set E_INTRA=08,08,09,11,13,13,14,17,08,08,11,12,13,14,17,18,09,11,13,13,14,17,17,19,11,11,13,13,14,17,18,20,11,13,13,14,16,17,20,24,13,13,14,16,17,20,24,29,13,13,14,17,19,23,28,34,13,14,17,19,23,28,34,41
@REM set E_INTER=08,08,09,09,10,10,11,11,08,09,09,10,10,11,11,12,09,09,10,10,11,11,12,12,09,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16

@REM FOX3
@REM set E_INTRA=08,08,09,11,13,13,14,17,08,08,11,12,13,14,17,18,09,11,13,13,14,17,17,19,11,11,13,13,14,17,18,20,11,13,13,14,16,17,20,24,13,13,14,16,17,20,24,29,13,13,14,17,19,23,28,34,13,14,17,19,23,28,34,41
@REM set E_INTER=16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16

@REM Didée's SixOfNine-HVS (HVS:Human Visual System, for bitrate>=3000k)
@REM set E_INTRA=08,11,12,12,13,15,16,17,11,11,12,12,14,15,16,17,12,12,13,14,15,16,17,18,12,12,14,16,17,18,19,19,13,14,15,17,19,20,20,20,15,15,16,18,20,21,22,22,16,16,17,19,21,22,23,24,17,17,18,19,20,22,24,24
@REM set E_INTER=12,11,12,12,13,14,15,16,11,11,12,12,13,14,14,16,12,12,12,13,14,15,16,17,12,12,13,15,16,17,18,18,13,13,14,16,18,19,19,20,14,14,15,17,19,20,22,22,15,14,16,18,19,22,23,24,16,16,17,18,20,22,24,24

@REM manono1 (the manono's favorite matrix)
@REM set E_INTRA=08,08,08,09,11,13,14,17,08,08,09,11,13,13,14,17,08,08,11,12,13,14,17,94,09,11,13,13,14,17,17,94,11,11,13,13,14,17,94,94,13,13,14,16,17,20,94,94,13,13,14,17,94,94,94,94,13,14,17,94,94,94,94,94
@REM set E_INTER=12,12,13,14,15,16,22,26,12,13,14,15,16,22,26,32,13,14,15,16,22,26,32,41,14,15,16,22,26,32,41,53,15,16,22,26,32,41,53,94,16,22,26,32,41,53,70,94,22,26,32,41,53,70,94,94,26,32,41,53,94,94,94,94

@REM manono2
@REM set E_INTRA=08,12,13,14,15,16,19,22,12,13,14,15,16,19,22,26,13,14,15,16,19,22,26,32,14,15,16,19,22,26,32,41,15,16,19,22,26,32,41,53,16,19,22,26,32,41,53,70,19,22,26,32,41,53,70,94,22,26,32,41,53,70,94,127
@REM set E_INTER=12,12,13,14,15,16,19,22,12,13,14,15,16,19,22,26,13,14,15,16,19,22,26,32,14,15,16,19,22,26,32,41,15,16,19,22,26,32,41,53,16,19,22,26,32,41,53,70,19,22,26,32,41,53,70,94,22,26,32,41,53,70,94,127

@REM manono3 (according to manono, for cases when the movie doesn't compress well at all)
@REM set E_INTRA=08,10,10,12,13,15,16,20,10,10,12,15,17,19,20,20,10,12,15,17,19,20,20,23,12,15,17,19,20,20,25,25,13,17,19,20,23,25,25,27,15,19,20,23,25,27,27,30,16,20,20,25,25,27,30,35,20,20,23,25,27,30,35,45
@REM set E_INTER=12,14,17,18,19,20,24,28,14,16,17,18,19,23,27,32,17,17,18,19,20,27,30,37,18,18,19,20,27,30,35,37,19,19,20,27,30,35,37,40,20,23,27,30,35,37,40,44,24,27,30,35,37,40,40,44,28,32,37,37,40,44,44,48

@REM HVS Best (for low bitrate)
@REM set E_INTRA=08,16,16,16,17,18,21,24,16,16,16,16,17,19,22,25,16,16,17,18,20,22,25,29,16,16,18,21,24,27,31,36,17,17,20,24,30,35,41,47,18,19,22,27,35,44,54,65,21,22,25,31,41,54,70,88,24,25,29,36,47,65,88,115
@REM set E_INTER=18,18,18,18,19,21,23,27,18,18,18,18,19,21,24,29,18,18,19,20,22,24,28,32,18,18,20,24,27,30,35,40,19,19,22,27,33,39,46,53,21,21,24,30,39,50,61,73,23,24,28,35,46,61,79,98,27,29,32,40,53,73,98,129

@REM AVAMAT7 (for low bitrate, also called AUTO-Q2)
@REM set E_INTRA=08,16,19,22,26,28,32,38,16,16,22,24,28,32,38,44,19,22,26,28,32,38,44,48,22,22,26,32,38,44,48,54,22,26,32,38,44,48,54,64,26,32,38,44,48,54,64,74,32,38,44,48,54,64,74,84,38,44,48,54,64,74,84,94
@REM set E_INTER=16,20,24,28,36,42,46,52,20,24,28,36,42,46,52,58,24,28,36,42,46,52,58,62,28,36,42,46,52,58,62,68,36,42,46,52,58,62,68,78,42,46,52,58,62,68,78,88,46,52,58,62,68,78,88,99,52,58,62,68,78,88,99,99



@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@REM >>                                   FFMPEG CLI
@REM >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

ECHO.--------------------------------------------------------------- 
ECHO.First pass ... 
ECHO.---------------------------------------------------------------
ffmpeg.exe -i %E_SRC% -pass 1 -passlogfile Pass.log -vcodec mpeg2video -maxrate %VBV_MBR% -bufsize %VBV_MBS% -g %E_MIK% -bf %E_MBF% -bidir_refine 0 -b_strategy %E_ABF% -brd_scale %E_SBF% -b_sensitivity %E_DBF% -dc %E_DC% -q:v %E_FQ% -intra_vlc true -intra_matrix %E_INTRA% -inter_matrix %E_INTER% -an -f mpeg2video -y NUL


ECHO.--------------------------------------------------------------- 
ECHO.Second pass ... 
ECHO.---------------------------------------------------------------
ffmpeg.exe -i %E_SRC% -pass 2 -passlogfile Pass.log -vcodec mpeg2video -b:v %E_BR% -maxrate %VBV_MBR% -bufsize %VBV_MBS% -g %E_MIK% -bf %E_MBF% -bidir_refine 0 -sc_threshold %E_TSD% -b_sensitivity %E_DBF% -me_range %E_RME% -mpv_flags mv0+naq -mv0_threshold 0 -mbd %E_RDO% -mbcmp %E_CMB% -precmp %E_CMP% -subcmp %E_CMP% -cmp %E_CMP% -skip_cmp %E_CMS% -dia_size %E_DIA% -pre_dia_size %E_DIA% -last_pred %E_AMP% -dc %E_DC% -lmin %E_MLM% -mblmin %E_MBL% -qmin %E_MQ% -qcomp %E_VQ% -intra_vlc true -intra_matrix %E_INTRA% -inter_matrix %E_INTER% -f mpeg2video -color_primaries 5 -color_trc 5 -colorspace 5 -color_range 1 -aspect %E_DAR% -y %E_VID%

IF EXIST "Pass*.log" DEL "Pass*.log"


@pause
@REM THE END
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 27th June 2021 at 19:24. Reason: Update to version 4.2
GMJCZP is offline   Reply With Quote
Old 10th June 2017, 15:46   #25  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 2.0 (10/06/2017):

- Added Colorimetry and color range to MPEG values (SMPTE 170 M for FFMPEG) according to HCEncoder BT.470 BG and the program ReStream.
- Changed the following default values:
E_BR=1600000 (b) (for experimental purposes only)
E_VQ=0.70 (qcomp)
E_DBF=5 (b_sensitivity)
E_TSD=-60000 (sc_threshold)
E_AMP=3 (last_pred)
The default matrix is now HVS Best (b<1800 kbs) (the FOX New matrix is throwing visual defects, while this will not be used).
- Other minor changes
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 12th June 2017 at 03:17.
GMJCZP is offline   Reply With Quote
Old 17th June 2017, 14:23   #26  |  Link
Fishman0919
FishmanMod Android Dev
 
Fishman0919's Avatar
 
Join Date: Apr 2004
Location: Somewhere else, maybe Arizona Bay
Posts: 1,143
Quote:
Originally Posted by manolito View Post
These GMJCZP parameters really got me excited. I did quite a few tests myself, but I always had a hard time picking an encode which I liked better. Old age probably...

So I made a quick and dirty test bench which makes it real easy to compare FFmpeg encodes made with either the Fishman XHQ parameters or the GMJCZP params. Download here:
http://www117.zippyshare.com/v/HVZbGHUT/file.html

Extract the files into a folder, then edit the "Convert.bat" file and enter your settings. Your input file can be entered by Copy&Paste or by Drag&Drop on the batch file.

The input file must have an audio track, a video only file will crash the script.


I modified the GMJCZP parameters slightly. The params for the first pass are from Fishman, the resulting log file worked well in my tests. I also forced the use of the "Fox New" matrix, the FFmpeg default matrix is not so nice IMO.

//EDIT//
I reuploaded a modified version of this test bench. This time the first pass params are separate, this makes sure that the GMJCZP B-Frame tweaks for the first pass are taken into account. Please redownload...



So everyone interested in optimizing FFmpeg for great quality DVD conversions please test some of your critical source files using this script and post your comments...


Cheers
manolito
I did a quick test and PM you.

All the other test I did came out the same way.


Quote:
Originally Posted by Fishman0919
I did a few quick test and I noticed right away detail missing and more macro blocking in GMJCZP videos.

I know comparing video with stills is not a true comparison but with this clip, it's like this thru the whole thing.

1) Where the wall is with the number "47", it should have good detail in it.

2) The windows above the gentlemen's left shoulder walking in the middle with a white shirt. The tree should have good detail. The tree in the video is waving in the wind and with GMJCZP video is very blocky.

3) You should be able to see the lines in the bricks in the walkway OK with Mepg2. With GMJCZP video, they are mostly washed out. MY video fairs a little better.


Original



Fishman



GMJCZP




Again, this was just a real quick test... I'll do a bit more this weekend.
__________________
"Cinderella story, out of nowhere,
former greenskeeper, now about
to become the Masters champion.
It looks like a mirac- it's in the hole!"
Fishman0919 is offline   Reply With Quote
Old 17th June 2017, 15:11   #27  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Thanks very much Fishman...

I had this suspicion before, it's good to have it confirmed by an expert.

So for me there is no reason to change my XHQ plugin parameters for AVStoDVD and for DVDStyler. Thanks again for taking the time to test this...


Cheers
manolito
manolito is offline   Reply With Quote
Old 17th June 2017, 17:43   #28  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 3.0 (17/06/2017):

- Changed the ratecontrol method (rc_strategy). Now it's XVID control!
- Enabled intra_vlc tables for MPEG2 (intra_vlc) (as in HCEncoder)
- Changed the following default values:
E_BR=3000k (b) (Medium Bitrate)
E_DC=9 (dc) (As a consequence of the bitrate change, b)
E_DFQ=2.00 (qsquish) (Variable added)
E_RQA=2.00 (rc_qmod_amp) (Variable added)
E_MLM=236 (lmin)
E_MBL=236 (mblmin)
- The default matrix is now MPEG Standard (It is suggested to consider the other options according to the bitrate, see "Matrices" in "Other settings" section)
- Other cosmetic changes.

PD: IMHO now I can say that with version 3.0 of my script HCEncoder does have a rival to encode to low bitrates: FFMPEG!
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 19th June 2017 at 05:23.
GMJCZP is offline   Reply With Quote
Old 18th June 2017, 13:51   #29  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
And here comes the competition using Fishman's parameters:
http://www102.zippyshare.com/v/ivWYugog/file.html

Cheers
manolito
manolito is offline   Reply With Quote
Old 19th June 2017, 03:23   #30  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
I was trying the Fishman script which uses the Fox New matrix and does not throw visual flaws like my script. Although in itself is not relevant in the performance of FFMPEG I have to find out which or which parameters cause the problem.
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 19th June 2017 at 03:25.
GMJCZP is offline   Reply With Quote
Old 19th June 2017, 05:23   #31  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 3.1 (19/06/2017):

- Removed the trellis parameter that caused visual artifacts when using the FOX New matrix (now its default value is 0). As a consequence of this the coding speed in the second pass has been increased.
- The FOX New matrix now suggests its use for bitrates greater than or equal to 1800k.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 21st June 2017, 17:43   #32  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 3.2 (21/06/2017):

- Disabled for the first pass several parameters, so the encoding speed has been increased drastically.
- Added variable E_FQ (q) (Fishman0919 suggestion).
- Changed the following default values:
E_MLM = 0.75 (lmin)
E_MBL = 50.0 (mblmin)
E_RME = 0 (me_range)
- Other minor changes.
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 21st June 2017 at 17:48.
GMJCZP is offline   Reply With Quote
Old 30th June 2017, 14:59   #33  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 3.3 (30/06/2017):

- Added variable E_DM (dark_mask) (Encoding enhancement in dark scenes).
- Other minor changes.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 30th June 2017, 16:44   #34  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 3.4 (30/06/2017):

- Regression to rc_strategy = 0 (undersize problems), at least for now.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 11th July 2017, 13:43   #35  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 744
Version 4.0 (11/07/2017):

Several changes, the most important are:
- Changed by default b_strategy to 2, improving encoding in dark areas. This change has generated a domino effect on the GOP structure, including reducing the default value of sc_threshold to -30000.
- Changed the size of the diamond to -4, the negative value is to reduce the impact on the coding speed.
- Changed the default matrix, now it is MPEG.
- Also a group of matrices has been included to be applied depending on the bitrate, the source or the taste of each one.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 10th September 2019, 08:00   #36  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 72
When using the -sc_factor in with these options, I get this error:

Unrecognised option 'sc_factor'.
Error splitting the argument list: Option not found

Also, if using the -me_method option, I get this error:

Codec AVOption me_method (Set motion estimation method) specified for output file #0 (out.mpg) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
WSC4 is offline   Reply With Quote
Old 10th September 2019, 14:14   #37  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
The FFMpeg devs removed the "sc_factor" param a while ago, so just delete it from your command line.

For the "me_method dia" I have no idea what exactly this error message means. But it never harmed my encodes so far, so I kept this parameter. It may be because of this:
https://trac.ffmpeg.org/ticket/6771


Cheers
manolito
manolito is offline   Reply With Quote
Old 11th September 2019, 07:49   #38  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 72
Thanks for your info on this.

I am using your code from post #6 (2-pass VBR encode using parameters for "Extremely High Quality")

I changed the -me_method dia to -motion-est dia and the same error displayed. I then used the -method ds option. This did not display that error.

https://ffmpeg.org/ffmpeg-all.html#mestimate

However, it is listed under video filters and I am not too sure I should be using it. It says:

Estimate and export motion vectors using block matching algorithms. Motion vectors are stored in frame side data to be used by other filters.

This filter accepts the following options:

method

Specify the motion estimation method. Accepts one of the following values:

I used the ds value.

What are your thoughts?
WSC4 is offline   Reply With Quote
Old 11th September 2019, 14:17   #39  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
No idea, sorry...

Since this is just a non-fatal warning I will just ignore it. After reading a few posts about this "me_method" param my impression is that this global option was removed because each different encoder handles it differently. So there are now encoder specific options for motion estimation. After some user complaints the "me_method" param was reintroduced as an alias for the encoder specific option.

The warning probably means that this alias is not applicable for the MPEG2 encoder. IMO the worst thing which could happen is that the option is ignored and some default being used.

//EDIT/
I also updated my post #6 (removed the "sc_factor" param and reduced max bitrate from 8500 to 8000). This means of course that the average bitrate must be at least a little bit below 8000.

Last edited by manolito; 11th September 2019 at 16:55.
manolito is offline   Reply With Quote
Old 11th October 2019, 02:48   #40  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 72
Why did you reduce the bit rate?

Can I push the boundaries on this to the limit? I want to get the highest quality and highest bit rate possible.

In my settings, I have -b:v 9000k -maxrate:v 9800k

I have studied the DVD video standards that I found on the Internet, and it seems that the Maximum video bit rate is 9.8 Mbps. After system overhead, the maximum rate of combined elementary streams (audio + video + subpicture) is 10.08 Mb/s.

The video + audio with the FFmpeg encode came to the Overall bit rate: 10.0 Mb/s as shown via MediaInfo.

Is this OK?
WSC4 is offline   Reply With Quote
Reply

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 18:52.


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