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 27th August 2020, 11:58   #1  |  Link
wreuven
Registered User
 
Join Date: Aug 2006
Posts: 3
Prevent zero-latency mode from creating very large keyframes

I am using zero-latency encoding.
In my test case, the encoder input does not change.

The first frame of first GOP was allocated about 20% of our 4mbps budget. This seems reasonable.

The first frame of the second GOP however is allocated 80%(!!) of our 4mbps budget. Even if the connection speed is double (8 mbps), this still means we've introduced a latency of 400 milli?

Is there some way to adjust this by configuration?

bandwidth 4000000 (4 mbps)
preset ultrafast
tune zerolatency
slices 4
x264opts no-mbtree:sliced-threads:sync-lookahead=0
gop_size 100
max_b_frames 0
refs 0
wreuven is offline   Reply With Quote
Old 27th August 2020, 18:22   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,345
Quote:
Originally Posted by wreuven View Post
I am using zero-latency encoding.
In my test case, the encoder input does not change.

The first frame of first GOP was allocated about 20% of our 4mbps budget. This seems reasonable.

The first frame of the second GOP however is allocated 80%(!!) of our 4mbps budget. Even if the connection speed is double (8 mbps), this still means we've introduced a latency of 400 milli?

Is there some way to adjust this by configuration?

bandwidth 4000000 (4 mbps)
preset ultrafast
tune zerolatency
slices 4
x264opts no-mbtree:sliced-threads:sync-lookahead=0
gop_size 100
max_b_frames 0
refs 0
Is the content pretty static? If it's a reasonably complex, relatively still image, a really big IDR followed by small P frames would be expected.

You could try setting --minqp 8 or something, which would cap the worst case frame size. Reducing --ipratio might help if that was insufficient.

Using something slower than --preset ultrafast can help as well. Unless you're running on some low-powered embedded system or something, even --faster is really fast on reasonably current hardware. And using --slices 4 suggests you have multiple cores available.

If performance is so tight as to require ultrafast, I'd also see if there is some kind of HW encoder that could be used instead. Those often have low-latency modes that can provide quality as good or better quality as --preset ultrafast, and are probably better-tuned for videoconferencing like scenarios.

Some more info on content and scenario likely would enable more focused suggestions .
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th August 2020, 18:54   #3  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,345
Also, have you set --maxrate and --vbv-bufsize to properly conservative values for your secenario? That's essential! Otherwise x264 is going to target a specified ABR without worrying much about how those are distributed over the file.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th August 2020, 23:24   #4  |  Link
wreuven
Registered User
 
Join Date: Aug 2006
Posts: 3
Hi Ben.

Thanks very much. Your response mentioning the VBV and asking about the slices reminded me that Dark Shikari spelled it all out in this blog post. http://x264dev.multimedia.cx/archives/249

I had configured for multiple slices because I had remembered that slices is what allows X264 to distribute refreshes accross multiple frames. But I forgot the –intra-refresh flag and the VBV limits.
wreuven is offline   Reply With Quote
Reply

Tags
low-latency, zero-latency

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 16:31.


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