veryoldschool said:
...My understanding of the function of the statmux is that it allows for more optimal use of the transponder bandwidth, by allowing unused bandwidth to be used by other channels, which seems to be more important with MPEG-4 than MPEG-2, since the bit-rates vary much more.
It does exactly that, but the "more optimal use" does not include raising the bit rate of the individual programs inside that transport stream; it instead allows individual program streams to use more bits, and only when needed, than they were actually allocated when setting the original bit rate. None of the bandwidth is "unused" in either case, but there are fewer null packets required when statmux is used than when it isn't. Statmux therefore uses the bandwidth more efficiently which therefore results in better pictures, but without actually raising or changing the bit rates of any of the program streams within the transport stream.
An MPEG decoder uses as little as 1% of the original information (which is all that it can derive from the compressed bit stream because the other 99% of the information was discarded at encoding) along with a strict yet complex set of rules to make intelligent guesses as to what that other 99% of the video should consist of. When the complexity is low, the errors in that process are virtually below any level of human perception. When the complexity is high, the decoder has fewer accurate clues to do the guesswork about the other 99% and begins to guess more incorrectly more often, and the errors become increasingly noticeable, and when they manifest to a particular level of perception, we see that as an artifact that we call pixellation or macroblocking.
Because one of the primary compression techniques in MPEG is temporal compression, delivery of consumer-level encoded video looks terrific when the video is not complex (when the picture is relatively static), but suffers visible pixelation when the video is complex (lots of pans and zooms, flashes, explosions). One solution, the "broadsword" solution, would be to use a higher bit rate, which is impractical.
In a multiple program transport stream, or MPTS, the peak needs of different programs most often happen at different times, from a statistical point of view. What if there were a way to reapportion those unused bits from programs not currently processing complex video to other programs in the transport stream that could put them to good use at the moments that those programs are processing complex video? Ergo, statistical multiplexing.
Statmux is the "scalpel" solution; it does not allow an increase in bit rate, but allows more bits to be used more intelligently at moments when the complexity would otherwise cause pixelation, and in that way reduces pixelation in a manner that makes the video appear as if it is not quite as compressed. It gives it wiggle room which reduces bit starving in those complex-video moments. It's like a food bank for occasionally bit-starved programs. It's not magic, but about as close to magic as it gets.
It is not more important with MPEG-4, but because the bit rates vary much more it is more efficient, except for the fact that the improvements it makes can be actually more helpful to MPEG-2 (which needs more help in this exact area) than MPEG-4 (which inherently does not need so much help when the encoding gets complex).
Maybe I'm not understanding some of what you've posted, but it suggests the encoders are part of the statmux, which I don't think they are.
I'm sure an engineer will set some parameters, but you make it sound like it's being done in real time, which would be an overwhelming task for all the feeds DirecTV has...
Encoders are technically separate from statmux in that they are different processes handled by different LSI hardware programmed to do different tasks. Encoders just sit there and process whatever is input to them, but they are not a single process. MPEG-2 is a suite of some 30-odd unique bit-reduction tools chained together. MPEG-4 does much the same thing, but has an expanded toolbox capable of more sophisticated techniques.
Statmux is, once again, something that happens technically at a different point in the chain, to reapportion the available bits. But the encoder and statmux are intimately tied together. Statmux processing actually happens between different sections of the MPEG encoding suite. you could say that it happens somewhere in the middle of encoding, yet it is still a separate process different from any part of actual encoding.
The statmux algorithm monitors incoming program streams and must keep track of what bits are apportioned where, and must be able to determine which program streams need to take advantage of bits that might be unused by another program stream at any particular time, so statmux as an active "traffic-cop" process is typically something that happens in the same physical piece of gear as where encoding happens.
Since statmux processes the bit streams after they are partially encoded this explains why it can do nothing to allow higher bit rates at the input to the encoders. Without statmux there are many more null packets used as filler for when a particular program stream varies up and down in bit rate.
Based on video complexity at any given moment, the program rates can rise instantaneously and approach the ceiling or lower instantaneously and not use all of the bits allocated, and the null packets fill out the streams so that the channel rate is steady (most consumer-level decoders are low cost and do not have the sophistication to decode wildly varying channel rates). The ceiling for each program has to be set high enough to keep the bit rate from starvation when it is using most or all of the bits allocated to it, yet it's a waste of bits when the bit rate of a program goes instantaneously lower at particular moments.
Statmux is based on the fact that it is statistically unlikely that each program in the stream might need extra bits at the same time as other programs, which means that rather than wasting the extra bits by filling the stream with null packets, those bits can be reallocated on the fly to whatever program needs them the most at the point in time it needs them the most. Its a form of TDM, or time sharing. This uses the transponder more efficiently because there are fewer null packets that then need to be inserted, and each program performs as if it were actually operating at a higher bit rate than it was originally allocated, most of the time, statistically speaking (which is where it gets its name from).
This makes it appear to the viewer as if a higher bit rate were being used, most of the time. Of course, statistically, there will be that rare moment that all of the programs in the transport stream are calling for extra bits at once. In that situation statmux is no better than if it were not there at all, but this is still better than having this situation all of the time, even if slightly worse than simply using a higher bit rate. But it's a very good compromise.
The parameters are set by Engineers once, and the intelligence of the processing is what reallocates the bits in real time from that point on. It's basically set it and forget it.
"The Engineers at DTV are all pros, so there is little chance that they would make such a mistake, meaning that improperly muxing is virtually unheard of."
While I agree that they're pros, I've also seen screen shots posted here showing problems, "AND" personally have a case where that is exactly what was happening.
"Case in point":
If you search the forum for threads about PBS and Ken Burn's National Parks series, you find threads/posts of pixelation problems.
This series didn't transcode well into MPEG-4. I noticed mine would only not have problems when recording in the middle of the night. Primetime recordings were unwatchable. I also noticed my hard drive storage space was twice what it normally is, as I was saving most of the series so I could watch it in order.
Investigating this anomaly, I found the MPEG-4 bit-rate to be 20+ Mb/s during playback.
This explains both the disk usage and the pixelation during primetime, but not when the statmux had more bandwidth available.
"The gun was smoking" in this case.
Your examples are not easily explained away, I will grant you. Many mistakes are made by many pro Engineers, and are made regularly. We are all human and we all make mistakes. Even me

. And it does not surprise me that PBS is involved, as they seem comparatively clueless in this post-analog, post-SD world.
But your examples do not apply to my statement, which was that at DTV improper muxing would be a rare engineering choice. I stand by that statement, as well as the fact that a muxing mistake is not going to manifest as incidental pixelation, which is what the original subject was all about.