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 24th March 2023, 12:50   #61  |  Link
Metal-HTPC
Registered User
 
Join Date: Dec 2018
Posts: 65
Well I just combined the 2-pass to 1-pass and tried a bit around with it. The whole idea for this incredible work .cmd came from the well respected manolito.
If you are thinking about implementing the ultimate mpeg2 encoding settings for ffmpeg you should better stick to the 2-pass with manolito's favorite matrix and suggested settings as there is no way to control the output size in 1-pass. @REM Medium bitrate (b) - set E_BR=4950k, @REM Maximum Bitrate (maxrate) set VBV_MBR=8000k together with @REM HVS Best (for low bitrate) as a matrix is bascially the best if you want to squeeze most of the movies on a DVD5 as fast as possible and if the output is still too big the only chance you have is to reduce the maximum bitrate until it fits.

Especially with older movies with a lot of grain you will gain much better quality with a 2-pass DVD9 encode.
Metal-HTPC is offline   Reply With Quote
Old 24th March 2023, 16:58   #62  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,893
Quote:
Originally Posted by Metal-HTPC View Post
Well I just combined the 2-pass to 1-pass and tried a bit around with it. The whole idea for this incredible work .cmd came from the well respected manolito.
If you are thinking about implementing the ultimate mpeg2 encoding settings for ffmpeg you should better stick to the 2-pass with manolito's favorite matrix and suggested settings as there is no way to control the output size in 1-pass. @REM Medium bitrate (b) - set E_BR=4950k, @REM Maximum Bitrate (maxrate) set VBV_MBR=8000k together with @REM HVS Best (for low bitrate) as a matrix is bascially the best if you want to squeeze most of the movies on a DVD5 as fast as possible and if the output is still too big the only chance you have is to reduce the maximum bitrate until it fits.

Especially with older movies with a lot of grain you will gain much better quality with a 2-pass DVD9 encode.
It's pretty easy to calculate whether a max bitrate CBR encode will fit on the DVD-5, and then only use 2p VBR if the ABR would need to be significantly lowered.

If a CRF-style encode is done, with x264/x265 one can do a 1-pass CRF encode, and if it comes out too large, use the data from the 1st encode to do a 2nd pass with ABR. I don't recall if the ffmpeg MPEG-2 encoder has anything like that.

Weird to recall I started on DVD authoring 26 years ago this summer (Vancouver Film School workshop using an early beta of Scenarist running on SGI O2 systems, and a Minerva hardware encoder).
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 14th July 2023, 02:49   #63  |  Link
ENunn
Registered User
 
Join Date: Dec 2019
Posts: 80
Quote:
Originally Posted by GMJCZP View Post
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
Sorry if I'm bumping a dead thread, but I just tried this and it seems to work fine. However, I ended up getting an "rc buffer underflow" warning and the video isn't being flagged as interlaced for some reason. Is there a way I could fix these problems?
ENunn is offline   Reply With Quote
Old 17th July 2023, 06:47   #64  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 90
Quote:
Sorry if I'm bumping a dead thread.
This thread is not dead. There are still plenty of posts this year and last.

I have never used GMJCZP's bat script and cannot comment on it. I have always used the well-respected manolito and his parameters found here:

https://forum.doom9.org/showthread.p...47#post1808247

I don't use bat files and prefer to do things manually and copy and paste parameters into Notepad saved as command_history_#.txt. These are then copy / pasted back into command prompt as needed. I had to modified manolito's parameters to suit the PAL format like -s 720x576 -r 25. Also removed -vf scale and pad as he mentions.

For the rc buffer underflow warnings. Are you getting many? Is the buffer size set to 1835k as in -bufsize:v:0 1835008 as in manolito's parameter?

As for the video isn't being flagged as interlaced, it sound like your source is interlaced. Try this in the FFmpeg command.

-flags +ilme+ildct -alternate_scan 1 auto=-1

Last edited by WSC4; 23rd July 2023 at 11:25.
WSC4 is offline   Reply With Quote
Old 4th August 2023, 21:38   #65  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 754
Quote:
Originally Posted by PatchWorKs View Post
Suggeston: how about add "-hwaccel auto" to both passes ?
Sorry for the late reply, but for now I still can't rejoin Doom9 as I would like. About your proposal I got this:

https://trac.ffmpeg.org/ticket/7469

Since I don't have a video card I can't corroborate this error, so for the moment this statement could not be made.

Quote:
Originally Posted by PatchWorKs View Post
@GMJCZP I perfectly know that i'm talking about VINTAGE encoding parameters/matrices, but what about to "save" KVCD/KSVCD/KDVD too ?
Same thing, I can't review this right now.
__________________
By law and justice!

GMJCZP's Arsenal

Last edited by GMJCZP; 4th August 2023 at 21:48.
GMJCZP is offline   Reply With Quote
Old 24th August 2024, 19:39   #66  |  Link
Metal-HTPC
Registered User
 
Join Date: Dec 2018
Posts: 65
I just came across something ugly. FFMPEG's mpeg2 encoder seems to have a problem with encoding stills/frozen images. If you SD downscale and encode this one https://workupload.com/file/wbw2LqRdfTN
you'll notice at 00:00:21 and 00:00:58 that you're getting some nasty pumping artifacts. I tried several matrices and also played around with higher medium and max bitrates but that didn't solve the problem.
If anyone came across this issue before and has a solution that would be much appreciated.
Metal-HTPC is offline   Reply With Quote
Old 25th August 2024, 07:25   #67  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,026
Quote:
Originally Posted by Metal-HTPC View Post
I just came across something ugly. FFMPEG's mpeg2 encoder seems to have a problem with encoding stills/frozen images. If you SD downscale and encode this one https://workupload.com/file/wbw2LqRdfTN
you'll notice at 00:00:21 and 00:00:58 that you're getting some nasty pumping artifacts. I tried several matrices and also played around with higher medium and max bitrates but that didn't solve the problem.
If anyone came across this issue before and has a solution that would be much appreciated.
Maybe I didn't watch carefully but how about this ...
https://mega.nz/file/HIslHLBK#fqBrUN...Jqq93eKd33nj64
Sharc is offline   Reply With Quote
Old 25th August 2024, 10:18   #68  |  Link
Metal-HTPC
Registered User
 
Join Date: Dec 2018
Posts: 65
Quote:
Originally Posted by Sharc View Post
Maybe I didn't watch carefully but how about this ...
https://mega.nz/file/HIslHLBK#fqBrUN...Jqq93eKd33nj64
looks great. Which ffmpeg settings/matrice did you use for that?
Metal-HTPC is offline   Reply With Quote
Old 25th August 2024, 18:22   #69  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,026
Quote:
Originally Posted by Metal-HTPC View Post
looks great. Which ffmpeg settings/matrice did you use for that?
Glad it seems to have solved your pumping issue. Here we go (for the video only):
Code:
ffmpeg -y -i "%~1" -c:v mpeg2video -b:v 7000k -maxrate 9800k -bufsize 1835k -bf 2 -b_strategy 2 -intra_matrix "8,8,9,9,10,10,11,11,8,9,9,10,10,11,11,12,9,9,10,10,11,11,12,12,9,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" -inter_matrix "8,8,9,9,10,10,11,11,8,9,9,10,10,11,11,12,9,9,10,10,11,11,12,12,9,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" -mbd rd -trellis 2 -mbcmp 2 -precmp 2 -cmp 2 -subcmp 2 -skip_cmp 2 -mpv_flags qp_rd -an -sn -vf scale=720:480,setdar=16/9 "%~1_.vob"
Using the standard matrix the GOP pumping isn't really nasty either IMO .....

Last edited by Sharc; 26th August 2024 at 09:21.
Sharc is offline   Reply With Quote
Old 28th August 2024, 09:00   #70  |  Link
Metal-HTPC
Registered User
 
Join Date: Dec 2018
Posts: 65
------

Last edited by Metal-HTPC; 30th August 2024 at 15:10. Reason: useless post
Metal-HTPC is offline   Reply With Quote
Old 30th August 2024, 00:46   #71  |  Link
Metal-HTPC
Registered User
 
Join Date: Dec 2018
Posts: 65
I made many tests (different settings and different ffmpeg versions) over the last couple of days. Sadly the issue is ffmpeg related and probably will never be solved.

The only thing which works in such cases (downscaling modern HD productions to SD for a stand alone DVD encode) is the lower quality variant suggested by Sharc (thanks for the help buddy).

The solution for the GMJCZP HQ script would be to change the Minimum quantizer (qmin) from 1.0 to 3.5.
Anything smaller than 3.5 starts the GOP pulsing/pumping. By doing that the entire hq settings of course don't work anymore and you are left with an average encoding quality and in comparison sharc's basic script would actually look better.

If anyone wants to do some further testing here are some samples for scenes with nasty pulsing in HQ-mpeg2 encoding settings

https://mega.nz/file/SIMTgS6C#2Ih245...meM4JgI4aNYfiY
https://mega.nz/file/TdEFEJiT#0EZoqD...6qG8vCKS9ZJz24
https://mega.nz/file/vIFhVJJQ#WYz_Jl...-7QzHKr2LbFKWU

Last edited by Metal-HTPC; 30th August 2024 at 15:12. Reason: further testing
Metal-HTPC is offline   Reply With Quote
Old 30th August 2024, 18:59   #72  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,026
Quote:
Originally Posted by Metal-HTPC View Post
The only thing which works in such cases (downscaling modern HD productions to SD for a stand alone DVD encode) is the lower quality variant suggested by Sharc (thanks for the help buddy).
Not sure why you call it a lower quality variant when it solves the nasty pumping issue

Quote:
The solution for the GMJCZP HQ script would be to change the Minimum quantizer (qmin) from 1.0 to 3.5.
Anything smaller than 3.5 starts the GOP pulsing/pumping.
I doubt whether rising -qmin is a good approach. It may increase banding I am afraid.
Maybe try with adding -minrate 400k to prevent the bitrate from dropping too low for the problematic static scenes. This will only minimally affect the 'normal' scenes.

Last edited by Sharc; 30th August 2024 at 22:59.
Sharc is offline   Reply With Quote
Old 31st August 2024, 19:02   #73  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,854
I frame pumping never really existed in Cinemacraft. One of the best things about it is its bitrate allocation.
kolak is offline   Reply With Quote
Old 31st August 2024, 21:32   #74  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,026
Quote:
Originally Posted by kolak View Post
I frame pumping never really existed in Cinemacraft. One of the best things about it is its bitrate allocation.
Yes, but the user was asking for help with ffmpeg for his case ....
Sharc 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:49.


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