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-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th October 2018, 21:15   #1  |  Link
secondplace
Registered User
 
Join Date: Oct 2014
Posts: 4
tmpgenc x264 compared to ffmpeg x264

i've been playing around with tmpgenc and i noticed a significant difference between my ffmpeg files and the tmpgenc files in how the GOP's are filled.



i've attached a screenshot to show the difference. the top is ffmpeg and the bottom is tmpgenc.
i also tested this with x264 and results are similar to ffmpeg and far away from tmpgenc.

video is 1920x1080px, 25fps
ffmpeg x264 settings are the following: preset 'very slow', refs 5, keyint 100, keyintmin 51, bitrate 3500k, maxrate 10000k, bufsize 1120k
and VBR 2pass encoding.

i also matched all the ffmpeg x264 settings to the tmpgenc settings. those where: refs 4, subme 9, chroma_qp_offset -4, lookahead_threads 1, bframes 2, b_pyramid 0, weightp 0, nal_hrd vbr
i left 'slices' out since it has to do with the image being split up not the GOP's

i also exported the quantization matrix from tmpgenc and tested it with x264 and ffmpeg but it didn't help either.
by changing the custom quantization matrix in tmpenc the files still turn out like in the screenshot.

i also tested every single setting in the tmpgenc advanced tab to see if i can basically break the output and make it look like ffmpeg but that did not work either.

how does tmpgenc control the GOP's to achieve that result and not have the frames peak as it happens in ffmpeg. it feels like the bits are distributed way more even within the GOP's and not with the high peaks as it happens in ffmpeg. also tmpgenc really seems to consider the maxrate where as ffmpeg seems to ignore it.
also if i split the maxrate and buffer in half to turn the average bitrate into a (fake) max bitrate in ffmpeg it does not give me those results.

how much does the peaking matter in terms of decoding and streaming the videos? is it irrelevant as long the GOP's are are the same size!? my CPU usage at least is identical by playing the files.

does tmpgenc have a custom x264 build to achieve this?
Attached Images
 

Last edited by secondplace; 26th October 2018 at 19:24. Reason: adding more specific details and image
secondplace is offline   Reply With Quote
Old 26th October 2018, 18:16   #2  |  Link
Taurus
Registered User
 
Taurus's Avatar
 
Join Date: Mar 2002
Location: Krautland
Posts: 875
Please use a filehoster to share your picture.
Attachment approval can take days and a mod has to look over it before it is shown in this thread.
Thank you.
For what it's worth:
Did not know that tmpgenc can encode to x264.
Thought it was a mpeg2 encoder only.
Maybe you are referring to tmpgenc mastering works or authoring works.
So yes, both programs have some safety belts against overshooting at bitrate spikes,
because for bluray or avchd on dvd it needs some restrictions.
But I'm out, tested this a long time ago, don't know how they manage it today.
Taurus is offline   Reply With Quote
Old 26th October 2018, 19:33   #3  |  Link
secondplace
Registered User
 
Join Date: Oct 2014
Posts: 4
thx for the advice taurus. done!

i was testing their premiere plugin since i don't always want to use a frameserver or output to a lossless codec first, instead go straight to h264.

>both programs have some safety belts against overshooting at bitrate spikes
i can see that. they have a checkbox for 'adjust the stream structure for blue-ray' however, on and off it results same as the screenshot above. and distributes the bitrate evenly.
secondplace is offline   Reply With Quote
Old 26th October 2018, 21:10   #4  |  Link
Taurus
Registered User
 
Taurus's Avatar
 
Join Date: Mar 2002
Location: Krautland
Posts: 875
If you can upload a small sample, say your 1524 frames, I will take a look at it.
I think in tmpgenc they matched the vbr control to more agressive against vbv maxbitrate and vbv maxbuffersize.
But I can be wrong, just speculating.
Dont know anything about what the guys and girls over at Pegasys are doing.
Cheers
Taurus is offline   Reply With Quote
Old 31st October 2018, 20:50   #5  |  Link
secondplace
Registered User
 
Join Date: Oct 2014
Posts: 4
i found out what caused it.
tmpgenc settings use their own parameter for the buffer (for whatever reason). so when i put in 1120 as i used in ffmpeg it just calculated something completely different in the background. and when i matched the tmpgenc settings to match the ffmpeg buffer it started to look like the ffmpeg output in the screenshot.

after playing around with the settings some more it turns out the way i am calculating the bufsize creates a too high value to keep the spikes below the maxrate. it also has to do with the combination between the bframes and the bufsize. the bframes need to be at 2 (always) and the bufsize around 420 (in this specific case).

i always thought the bufsize is calculated the following way: bitrate*8/framerate
i'll now be using: bitrate*3/framerate
is there something like a correct math for the bufsize?
secondplace is offline   Reply With Quote
Old 31st October 2018, 20:58   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,041
Bitrate analyzer isn't really the right tool to look at this . It doesn't take into account the current state of buffer at any point in time. You'd need to use a buffer analyzer

eg. you can have an enormous peak, but if it's buffered, it will have no impact on playback . But if you have insufficient buffer, then you can have buffer underrun and playback problems
poisondeathray is offline   Reply With Quote
Old 1st November 2018, 04:09   #7  |  Link
secondplace
Registered User
 
Join Date: Oct 2014
Posts: 4
Quote:
Originally Posted by poisondeathray View Post
Bitrate analyzer isn't really the right tool to look at this . It doesn't take into account the current state of buffer at any point in time. You'd need to use a buffer analyzer
wish i had one. streameye and codevisa are both about 2500$
what software would you suggest instead?
secondplace is offline   Reply With Quote
Reply

Tags
ffmpeg, tmpgenc, x264

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 00:15.


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