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 11th October 2019, 04:59   #41  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
The reason for reducing the max bitrate and also the max average bitrate is that the FFmpeg MPEG2 encoder still has a lousy rate control. Overshooting the specified max bitrate is very common (even the very old and deprecated QuEnc which is also based on libavcodec had this overshooting), and this can cause errors when multiplexing and authoring the encoded stream. You can check such a high bitrate encode by authoring it with MuxMan. If MuxMan does not choke on it then you are fine, but if it does choke then you should reencode the source with a lower bitrate and/or a different quant matrix.

Other MPEG2 encoders like CCE, HCenc or ProCoder do also overshoot, but to a much lesser degree than FFmpeg. Also these encoders seem to have a better VBV buffer control than FFmpeg so you only get muxing and authoring errors very rarely.
manolito is offline   Reply With Quote
Old 15th October 2019, 19:53   #42  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,845
CCE basically never. Probably has the best rate control from any DVD compliant encoder.
kolak is offline   Reply With Quote
Old 16th October 2019, 07:30   #43  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
I only have some experience with CCE 2.50 up to 2.70 (switched to HCenc afterwards), but I do remember that these versions did overshoot the specified max bitrate in many cases. The MuxMan log file shows the peak bitrates, so this was easy to see. But this never caused Mplex and DVDAuthor to choke on these encodes (contrary to encodes made with libavcodec).

Last edited by manolito; 16th October 2019 at 07:34.
manolito is offline   Reply With Quote
Old 16th October 2019, 22:16   #44  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,845
Not sure about MuxMan, but I take Scenarist as reference muxer for DVD (it's very picky one) and I had basically 0 problems (done encodes in thousands over 8 years with 2.7 and SP3).
It's not about very short peaks, but properly calculated ones which take into account all DVD muxing restrictions.
ProCoder was ok, but not as good.

Last edited by kolak; 16th October 2019 at 22:21.
kolak is offline   Reply With Quote
Old 22nd October 2019, 09:39   #45  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 90
Sorry, I forgot to subscribe to this thread and have just seen these replies.

I found a number of bit rate viewers to install, and here are the results of my FFmpeg encode which is video + audio.

The Bitrate Viewer shows a maximum short peak of 10698 kbps at 2:33 time.

MPEG-2 Validator shows a maximum short peak of 10447 kbps at 154 seconds. The average bit-rate is 8750 kb/s

The programs you mention may fail my bit rates, but what about real-time tests on modern DVD players today? Will a DVD player stop, pause, start, show pixelation or show an error on the screen or just not play at all?

I do not have a dedicated DVD player, only a modern, high-end Blu-ray player. Testing on this would be unfair.

Last edited by WSC4; 22nd October 2019 at 09:49.
WSC4 is offline   Reply With Quote
Old 22nd October 2019, 11:28   #46  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
Just dug out some very old threads about this problem. The problem is not only the encoder, the muxing and the authoring applications are just as important.

Have a look at this thread:
https://forum.doom9.org/showthread.p...319#post739319
and especially this post:
https://forum.doom9.org/showthread.p...503#post743503

Of course when using a modern BD player for playback you probably won't get any stutter even with a DVD which is outside of the specs. But I would not recommend to simply ignore the specs.

For me the ultimate (and free) DVD compliance checker is the latest free version of MuxMan (just as picky as Scenarist, but I cannot afford Scenarist). Mplex/DVDAuthor and FFmpeg/DVDAuthor are far less reliable in my experience.

Last edited by manolito; 22nd October 2019 at 12:51.
manolito is offline   Reply With Quote
Old 1st November 2019, 22:28   #47  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,845
Quote:
Originally Posted by WSC4 View Post
Sorry, I forgot to subscribe to this thread and have just seen these replies.

I found a number of bit rate viewers to install, and here are the results of my FFmpeg encode which is video + audio.

The Bitrate Viewer shows a maximum short peak of 10698 kbps at 2:33 time.

MPEG-2 Validator shows a maximum short peak of 10447 kbps at 154 seconds. The average bit-rate is 8750 kb/s

The programs you mention may fail my bit rates, but what about real-time tests on modern DVD players today? Will a DVD player stop, pause, start, show pixelation or show an error on the screen or just not play at all?

I do not have a dedicated DVD player, only a modern, high-end Blu-ray player. Testing on this would be unfair.
Those bitrate viewers are most often not very good and they don't take into account whole VBV model. Spikes above 10Mbit are fine if they are very short.
kolak is offline   Reply With Quote
Old 17th April 2020, 10:10   #48  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 90
Hi Manolito, Has there been any update to your parameters that you posted here:

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

I need to use your commands to encode an interlaced MPEG video to progressive, what are you thoughts on FFmpeg's YADIF or the new FFmpeg BWDIF deinterlacer? I have seen reports that it is better than YADIF, which is pretty old now.
WSC4 is offline   Reply With Quote
Old 17th April 2020, 12:26   #49  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,103
No, there is no update, these are still the parameters I use...

And I have no idea if Yadif or BWDIF give better deinterlacing results. I tried them both, and the quality looked pretty much the same to me. When making DVDs I usually do not bother to deinterlace interlaced sources. My ancient CRT TV displays interlaced content perfectly, and to tell ffmpeg to encode in interlaced mode all you have to do is add these params to the command line:
Quote:
-flags +ilme+ildct -alternate_scan 1 -top 1
(This is for a TFF source file, for BFF use -top 0).


Cheers
manolito
manolito is offline   Reply With Quote
Old 29th May 2021, 04:39   #50  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 754
Version 4.1 (28/05/2021):

- Eliminated sc_factor because changes in FFMpeg 4.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 27th June 2021, 15:29   #51  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 754
Here they are reporting that the -preme option has been removed from FFMpeg, but there are compilations like this one that is still present. If an error message appears indicating that the -preme option is not recognized, remove it from the script, this solution is temporary.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 27th June 2021, 19:36   #52  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 754
DVD script version 4.2:

- Removed -preme argument, deprecated of FFMpeg builds. Thanks to lvqcl for report it. For this cause exists an increment in encoding speed.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 29th June 2021, 14:43   #53  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 754
nevcairiel has reported that for the purposes of the mpeg2 -preme codec it has been renamed to -mepre, however I have made the difficult decision so far not to reincorporate it in the script, since this has obtained a gain in encoding speed in the order of 25% or more. I think that a debatable improvement in the image is not enough compensation, since the idea is to balance the quality-speed ratio.

In any case, as in science, there is never something definitive.
__________________
By law and justice!

GMJCZP's Arsenal
GMJCZP is offline   Reply With Quote
Old 5th January 2022, 18:59   #54  |  Link
PatchWorKs
Registered User
 
PatchWorKs's Avatar
 
Join Date: Aug 2002
Location: Italy
Posts: 312
Suggeston: how about add "-hwaccel auto" to both passes ?
PatchWorKs is offline   Reply With Quote
Old 26th February 2022, 02:08   #55  |  Link
WSC4
Registered User
 
Join Date: Jun 2011
Location: Melbourne, Australia
Posts: 90
Hi there Manolito. You have not posted for a while. How are you going?

I suffered a major hard drive crash in September 2020 and lost the lot. Sent the HD to 2 data recovery companies but they could not recover data. It has taken me over a year to rebuild FFmpeg commands, Mplex commands, DVDStyler layouts, AC3to commands, CoverDesigner layout et cetera to get back to where I was. It will never be the same.

I still use your FFmpeg commands listed on post number 6.

-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"

I do everything on the command line first using FFmpeg for the M2V and AC3to and Mplex for LPCM to the MPG. I use DVDStyler on copy mode only.

I notice also you have not posted on the DVDStyler forum for a very long time. Have you moved up to Muxman DVD authoring Professional - or even Scenarist? :-)

Last edited by WSC4; 26th February 2022 at 02:15.
WSC4 is offline   Reply With Quote
Old 26th February 2022, 13:04   #56  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,069
Quote:
Originally Posted by WSC4 View Post
Hi there Manolito. You have not posted for a while. How are you going?

[...]

I notice also you have not posted on the DVDStyler forum for a very long time. Have you moved up to Muxman DVD authoring Professional - or even Scenarist? :-)
Manolito is one of the elderly members of the community and he's been here for a very long time. Unfortunately, he had a stroke when he went to bed one day last year. Don't worry, he's still alive, 'cause his wife eventually noticed and he was eventually rushed to the hospital if I remember correctly. In any case, that was a really close call for him and this is the kind of event that affect a person both physically and mentally. He came back to Doom9 talking to some of us who have been here the longest like Ferenc, Stephen, StainlessS etc saying that it was indeed a close call and that he was gonna spend the rest of his life enjoying the little things together with his wife rather than perfecting Avisynth Scripts and encoding BATs. We all wished him a quick recovery and we understood his decision. Sometimes when you almost pass away, you re-evaluate important things in life.
I don't know if he'll ever come back to Doom9 at this point, but one thing is certain: his legacy will live for years to come.

Last edited by FranceBB; 26th February 2022 at 13:07.
FranceBB is offline   Reply With Quote
Old 23rd May 2022, 18:03   #57  |  Link
PatchWorKs
Registered User
 
PatchWorKs's Avatar
 
Join Date: Aug 2002
Location: Italy
Posts: 312
@GMJCZP I perfectly know that i'm talking about VINTAGE encoding parameters/matrices, but what about to "save" KVCD/KSVCD/KDVD too ?

http://www.digitalfaq.com/archives/e...-kdvd-faq.html
__________________
Hybrid Multimedia Production Suite will be a platform-indipendent open source suite for advanced audio/video contents production.

Official git: https://www.forart.it/HyMPS/
PatchWorKs is offline   Reply With Quote
Old 18th January 2023, 00:12   #58  |  Link
Metal-HTPC
Registered User
 
Join Date: Dec 2018
Posts: 65
I did some testing and have to say that I thought that manono1 matrice was the most impressing.
For a grainy 80's movie (from a master source without visible compression artefacts)
01:20:39 easily fit on a DVD5 and looked fantastic.
setting Medium to 7000 and Maximum to 9000 lead to an average of 7001 kb/s in 2pass mode with 4.235.013.988 Bytes
and 6 370 kb/s average with 3.853.526.017 in 1pass mode.
I couldnt tell a visible difference in quality so I decided to go for 1pass for my future encodes and just combined the 2 in the command line
like this
Code:
																	                                                                 								 
"%FFMPEG%" -i %INPUTFILE% -vcodec mpeg2video -b:v %E_BR% -maxrate %VBV_MBR% -bufsize %VBV_MBS% -g %E_MIK% -bf %E_MBF% -bidir_refine 0 
-b_strategy %E_ABF% -brd_scale %E_SBF% -sc_threshold %E_TSD% -b_sensitivity %E_DBF% -me_range %E_RME% -dc %E_DC% -q:v %E_FQ% 
-an -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 %1%.m2v
I hope this makes sense :-).

I had some raw VHS recordings of a TV show which is basically all the same quality and tried to squeeze them on a DVD5.
However I have no idea how to limit the average bitrate in 1pass.

changing the Medium bitrate setting really didnt't do much. I had a feeling that it didnt really matter if I chose
set E_BR=3950k , 4950 or 5950 and sometimes lower settings lead to a higher average bitrate which was weird.

for set E_BR=3950k
DVD1 - 00:53:13 - Average 6857 Max 8000 - 2.737.413.306 Bytes
DVD2 - 01:47:07 - Average 4960 Max 6500 - 3.985.130.434 Bytes
DVD3 - 02:06:12 - Average 5170 Max 6000 - 4.898.178.584 Bytes

I set the low bitrate settings "Minimum quantizer set E_MQ=2.0", "DC precision (dc) set E_DC=8" and tried "manono3", "HVS Best" and "AVAMAT7". but it didn't seem to help much.

DVD3 would be Average 4675 Max 6000 - 4.415.610.821 Bytes
after shrinking it with DVDshrink afterwards by the way.

The parameter which did the most in terms of filesize seemed to be the Max bitrate, but I have no idea which max bitrate to set for which length.
I there a way to limit the maximum filesize somehow? That would probably be the most easy way. It's probably a tough one for 1pass but maybe someone has an idea. Thanks for reading
cheers
Metal-HTPC is offline   Reply With Quote
Old 16th February 2023, 10:11   #59  |  Link
PatchWorKs
Registered User
 
PatchWorKs's Avatar
 
Join Date: Aug 2002
Location: Italy
Posts: 312
For those who are interested in, @GMJCZP's DVD script has been imported (after our pushing) into Videomass presets.

If someone is interested to "patch" (= correct/improve) it, be free so start issues @ github:
https://github.com/jeanslack/Videomass-presets/issues

Thanks in advance.
__________________
Hybrid Multimedia Production Suite will be a platform-indipendent open source suite for advanced audio/video contents production.

Official git: https://www.forart.it/HyMPS/
PatchWorKs is offline   Reply With Quote
Old 18th February 2023, 07:54   #60  |  Link
PatchWorKs
Registered User
 
PatchWorKs's Avatar
 
Join Date: Aug 2002
Location: Italy
Posts: 312
Quote:
Originally Posted by Metal-HTPC View Post
I did some testing and have to say that I thought that manono1 matrice was the most impressing.
For a grainy 80's movie (from a master source without visible compression artefacts)
01:20:39 easily fit on a DVD5 and looked fantastic.
setting Medium to 7000 and Maximum to 9000 lead to an average of 7001 kb/s in 2pass mode with 4.235.013.988 Bytes
and 6 370 kb/s average with 3.853.526.017 in 1pass mode.
I couldnt tell a visible difference in quality so I decided to go for 1pass for my future encodes and just combined the 2 in the command line
like this
Code:
																	                                                                 								 
"%FFMPEG%" -i %INPUTFILE% -vcodec mpeg2video -b:v %E_BR% -maxrate %VBV_MBR% -bufsize %VBV_MBS% -g %E_MIK% -bf %E_MBF% -bidir_refine 0 
-b_strategy %E_ABF% -brd_scale %E_SBF% -sc_threshold %E_TSD% -b_sensitivity %E_DBF% -me_range %E_RME% -dc %E_DC% -q:v %E_FQ% 
-an -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 %1%.m2v
I hope this makes sense :-).

I had some raw VHS recordings of a TV show which is basically all the same quality and tried to squeeze them on a DVD5.
However I have no idea how to limit the average bitrate in 1pass.

changing the Medium bitrate setting really didnt't do much. I had a feeling that it didnt really matter if I chose
set E_BR=3950k , 4950 or 5950 and sometimes lower settings lead to a higher average bitrate which was weird.

for set E_BR=3950k
DVD1 - 00:53:13 - Average 6857 Max 8000 - 2.737.413.306 Bytes
DVD2 - 01:47:07 - Average 4960 Max 6500 - 3.985.130.434 Bytes
DVD3 - 02:06:12 - Average 5170 Max 6000 - 4.898.178.584 Bytes

I set the low bitrate settings "Minimum quantizer set E_MQ=2.0", "DC precision (dc) set E_DC=8" and tried "manono3", "HVS Best" and "AVAMAT7". but it didn't seem to help much.

DVD3 would be Average 4675 Max 6000 - 4.415.610.821 Bytes
after shrinking it with DVDshrink afterwards by the way.

The parameter which did the most in terms of filesize seemed to be the Max bitrate, but I have no idea which max bitrate to set for which length.
I there a way to limit the maximum filesize somehow? That would probably be the most easy way. It's probably a tough one for 1pass but maybe someone has an idea. Thanks for reading
cheers
Your 1-pass commandline has been added to Videomass presets too:
https://github.com/jeanslack/Videoma...ent-1435151527

Please check if it has been correctly implemented.
__________________
Hybrid Multimedia Production Suite will be a platform-indipendent open source suite for advanced audio/video contents production.

Official git: https://www.forart.it/HyMPS/
PatchWorKs 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:32.


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