@duartix - "I'm just curious on how pure I/B performs vs pure I/P."
If you examine a GH2 AVCHD file with MediaInfo, you'll see it's recorded in H.264 High Profile, Level 4.0 with two reference frames. This means that the encoder will use up to two I or P-frames as sources for macroblock motion vectors when encoding nearby P or B-frames. In the GH2's case, there are only a few practical differences between P and B-frames:
With unhacked quantizer tables, a video with P-frames will be encoded at a finer level of quality than one that includes B-frames as well. In the Flow Motion Patch, however, I've reassigned the quantizer tables to match both P and B-frame image quality to that of I-frames. As a result, there is no penalty to using B-frames and the improved quality tends to produce larger B-frames than seen in other patches.
In addition, there is an often overlooked P and B-frame encoding issue that Flow Motion rectifies. In cases where no useful motion vector can be found for a particular P or B-frame macroblock, the GH2 will encode that macroblock in intra-mode, just as it would in an I-frame! This occurs frequently in videos that contain rapid movements. These intra-coded macroblocks would look just as good in P and B-frames if only the encoder used the same intra quantizer tables as it uses in I-frames. Fortunately, that flaw was easy to fix with the Flow Motion Patch.
During my testing, I often saw P and B-frames with nearly half their macroblocks encoded in intra-mode. Here's an example of a B-frame from a 24p video. Macroblocks with blue dots are encoded with motion vectors; the ones with red dots are intra-coded.
In interlaced 1080i videos, there is another interesting issue. It turns out that in I-frames, alternatiing horizontal rows of macroblocks are encoded as P-frame macroblocks!
This is no doubt because the alternating P-frame rows are actually an interlaced field that was scanned 1/60th of a second after the initial I-frame field. Evidently, only the first field in each GOP is encoded as an I-frame, with the second field encoded as a P-frame. In Flow Motion's 1080i modes, the 3-frame IBB GOP is effectively treated as an interlaced 6-field IPBBBB GOP. Note that this P-frame can also contain individual intra-coded macroblocks in areas of rapid motion.
Here's the original 24p video, showing how areas of rapid motion correspond to intra-coded macroblocks.
@LPowell Thanks for your excellent explanations on how and why you have developed your patches as they are done. I have learned a lot from that. I have been running Flow Motion now for a while and it is just great, a good compromise between space and quality. As you and many others I'm patiently waiting for the 1.1 patch as I am in EU land (Sweden).
@LPowell Is their a tweak that could be made to restore the superfine detail of the intra patches and keep the quality benefits of flowmotion? File size is not important to me but I like having a max quality setting and a lower version in 24l which gives me in camera playback and spanning, like I have now with quantum beta 3.
@Jspatz Sounds like you're already satisfied with Quantum B3?
I am very happy with qb3 but am enticed by the idea that flowmotion may have better motion rendering?
@Jspatz "Better" is a subjective interpretation that is highly dependent on what you want to see. With Flow Motion, I wanted to see smooth motion with minimal flickering, so I prioritized frame-to-frame continuity over static image quality. Check out this example and see if that's what you're looking for as well:
If you examine the interior details of the concrete globe closely, you may see a few isolated pixels flutter slightly as it moves across the frame. In my view, those minute discrepancies are distracting flaws. In this case, I don't really care how precisely the encoder captures the random surface details of the concrete globe, just as long as what I see looks completely realistic. What I don't like is when those random details vary noticeably from one frame to the next and create tiny flickering artifacts.
LPowell, that does look damn good! The motion looks clean.
@LPowell I understand. I will run some additional tests and look specifically for that criterion of quality, in addition to just pure detail. Thanks
Lee, use split screen view on streameye, and you'll see its always the case for interlaced video; top field is INTRA, bottom field is predicted.
@LPowell, I found that the rate limiting method you use in Flow Motion for 1080/24p and Variable Movie Mode works very well, so I've adopted your settings for my new version of Cake. This combines the best aspects of your approach and mine. It improves on Flow Motion by having more consistent frame-to-frame quality (by using P-frames instead of B-frames), and by spanning at a variable 20-80 Mbps; less than 50 Mbps on average. So now users don't need to choose between quality and spanning with smaller file sizes - they have both, all the time (but only in 24p and VMM).
I've posted the new Cake settings in the "GH2 constant quality variable bit rate" topic. Big thanks to you for your work on Flow Motion.
I tried to get 1080/60i to work, but it wasn't stable in Flow Motion. Do you know what would be necessary to get 1080/60i working correctly, at the expense of all other modes?
I understand that when the bit rate goes above Top, the encoder goes into fallback mode, which you say is controlled by the T4 scaling tables. Do you know what the difference is between the different sets of tables? I see 1080p24 (obvious), but then just "scaling", and high, med, and low. And do you know what the T2 and T3 are for? I noticed that 1080i T1-T4 are choices in the drop-down for 1080p24 T1-T4, but there are no settings for 1080i. Are 1080i settings under a different name, or do we not have them in PTool?
In addition to changing the scaling table assignments to raise the frame sizes in fallback mode, you've changed some time or buffer size parameter that controls budgeting in such a way that you can alter the frequency of fallback mode oscillation, or prevent it altogether. Can you tell me which parameter controls that?
FYI, if the bit rate stays below Top, you achieve constant quality on the I- and P-frames without the need to change any scaling table assignments. Same for B-frames, except they're not quite the same quality as the I-frames and P-frames. I don't believe any reassignment of scaling tables can improve the B-frame quality. Maybe altering the tables themselves can.
Also, it's not clear to me exactly what these scaling tables do. They're not simply telling the encoder to use different quantization parameters, because when the encoder goes into fallback mode, it's using the same QP. I believe in 24H mode, in fallback mode the encoder is filtering the image to reduce its detail level before encoding it. 24L behaves differently, sometimes using a higher QP.
Thanks.
@balazer - "It improves on Flow Motion by having more consistent frame-to-frame quality (by using P-frames instead of B-frames)"
I don't understand what you mean by this claim, as there is nothing about B-frames that would make them less "consistent" than P-frames. In the unhacked firmware, the quantizer tables assigned to B-frames are coarser than the tables assigned to P-frames. Once this problem is corrected, P and B-frames are encoded at the same quality level.
I'm not sure what it would take to make 1080i with P-frames work in Cake. If you change this mode back to B-frames, the settings you've put in Cake v1.1 will make it a low-bitrate version of Flow Motion. In my testing, I concluded that Flow Motion needed a 100Mbps bitrate in order to produce the highest quality I-frames. And as you can see, lowering the bitrate doesn't necessarily improve stability.
All Flow Motion video modes work as intended, but may fail occasionally on brightly lit test charts at extremely high bitrates. Flow Motion worked reliably with virtually all other types of subjects I've tried. With upcoming versions of PTool, I'll be able to provide customized quantizer tables that will insure reliability under all recording conditions.
BTW, Flow Motion also encodes in what you're calling "constant quality variable bit rate" mode. It uses the standard QP of 20 in all modes, while the new version of Cake uses a somewhat coarser QP of 22 in 1080 modes.
@LPowell : If I could speak for @balazer , I guess he might have some reservations about your unconventional GOP structure (IBB IBB IBB ) which I do, but I'm sure he'll let us know. In fact, from my timelapse observations (probably the most restricted and particular kind of footage imaginable), they were way bigger and worse than P-Frames, so my prime objective in that particular case has always been to annihilate them. As for efficiency in other kinds of footage, I'm still not convinced and I believe the jury is still out, but I just don't have the time to back these words with proper tests, it's just logic that makes me feel this way.
I guess the only way for me to be convinced otherwise would be to shoot the same motion sequence in IBB IBB I vs. IPP IPP I and compare sizes of P/B frames.
My reasoning is that in the sequence i1 b2 b3 i4, the frame b2 will be mostly encoded in motion vectors from i1 while b3 (which can't refer b2) will be mostly encoded in motion vectors backwards from i4.
Now imagine that you have i1 p2 p3 i4, this way p2 will be mostly motion from i1 and p3 mostly motion from p2 (which in this case is allowed). In the end, if b2,b3,p2 and p3 were using the same quantizer tables and the motion is constant, with all else being equal, they would be identical in size EXCEPT that b2 & b3 (being b-frames) have a more complex block addressing scheme and thus would take up more space. Please note that I'm talking out of my head, I don't know the in-works of the codec as you guys do, so I can be talking nonsense.
@LPowell, when the GH2 encoder bit rate is under Top and not constrained by frame limits, the encoder is in constant QP mode. Every I-frame, P-frame, and B-frame has nearly the same QP in every block. The encoder is doing nothing to artificially reduce the quality of the frames, even with the stock scaling tables. (maybe this mode is using T0, or not scaling at all - I don't know) Your scaling table settings in Flow Motion don't change this behavior. But for whatever reason, the B-frames don't look as good as the I-frames and the P-frames, even though they have the same QP. I don't know why. But I have seen it consistently in Flow Motion, and in my experiments at different GOP lengths using high Top settings and stock scaling table assignments. How apparent these differences are for a given QP depends on what ISO you're shooting at and how bright the subject is. Sometimes the difference is barely noticeable, and sometimes it's quite apparent.
Your scaling table re-assignments, as best I can tell, only come into play when the bit rate goes above Top.
At a low enough QP in constant QP mode, the B-frames will look good, and it won't be readily apparent that the neighboring I- and P-frames look a little better. That's especially true in Gop3Zilla, for example, which uses a very low QP and high quality in every frame. It's also true in Flow Motion at H100 most of the time, and less often at L50.
I just decided to go a different route, using P-frames instead of B-frames. For the same QP, P-frames match the quality of the I-frames better than B-frames do. P-frames look better than B-frames for the same QP. That's why I can use a QP of 22 and be about the same quality as your QP 20, and have better frame-to-frame consistency.
Using a higher QP makes the bit rate more variable. P-frames are larger than B-frames of the same QP. Part of that I'm sure is due to the lower efficiency of P-frames, and part because the P-frames look better. So whether Cake is more or less efficient than Flow Motion H100, I don't know. You're using a lower QP and I'm using P-frames. Maybe it's a wash. What I know is that the bit rate of Cake is highly variable. Shooting at ISO 1600 with high motion, for example, produces an average bit rate of 40 Mbps. Shooting a detailed scene at ISO 160 with no motion produces 20 Mbps. Above ISO 3200 or so, the bit rate is near 70 Mbps.
BTW, it's very easy to make 1080/60i fail in Flow Motion. I just need to set the ISO high. (no test chart or death chart; just pointed at a wall)
@balazer - "Your scaling table re-assignments, as best I can tell, only come into play when the bit rate goes above Top."
I'm not sure where you got this impression, but that's not the case. Quantizer table settings are static assignments that are permanently in effect at all bitrates. Here's how they are used in each video mode:
I'd be most interested to examine downloadable footage examples you can provide of Flow Motion B-frames that "don't look as good as the I-frames and the P-frames". At this point, the only comparative Flow Motion test footage I've been able to find have been shots I've taken myself, and I'd prefer to see tests from additional sources as well. This is really the only conclusive way to evaluate image quality claims about your Cake P-frame version of Flow Motion versus Flow Motion itself.
Thanks for the tip on 1080i60 mode at high ISO settings. My tests have ranged up to ISO 3200; I'll do further testing at higher settings.
@duartix - "My reasoning is that in the sequence i1 b2 b3 i4, the frame b2 will be mostly encoded in motion vectors from i1 while b3 (which can't refer b2) will be mostly encoded in motion vectors backwards from i4."
True, but there's an additional factor that can make a major difference. Unlike P-frames, B-frames can combine motion vectors from two different reference frames, calculating a weighted average of the two vectors. In your example, this means that both B2 and B3 are encoded using blended motion vectors from both I1 and I4. My intuitive hunch is that the pair of B-frames function as a bi-directional bridge between I-frames, similar to how "tweened" animation frames fill in the gaps in a keyframed animation. In my view, this makes B-frames inherently better suited than P-frames for producing frame-to-frame edge consistency in Flow Motion videos.
BTW, the data overhead of storing motion vectors is the same in B-frames as in P-frames, i.e. there's no penalty for using B-frames. Here's a good overview of how it all works:
@LPowell - Lee, I patched my GH2 with Flow motion today and took some test shots. I used Panasonic 14-140mm lens in sunny daylight shooting freeway traffic and a golf course range. I used Transcend SDXC 64GB class 10 and Sandisk extreme HD 30mb/s. 24H looked nice with a bit rate between 70-90 mbps. 24L looked nice also averaging 50mbps. EXTC mode worked for both. 1080i60 worked well with averaging 50mbps. However, 720p60 worked without zooming averaging 50-60 mbps but failed with write errors when I started zooming toward 140mm. EXTC mode failed for both 1080i and 720p60. So, for the time being , I am back to my combo patch of V9b for 24p and Sanity 3.1 for 1080i60 and 720p60 until further improvements on flow motion. There is something about GOP 39 and AQ=0 that makes 720p60 video look beautiful and motion very smooth. Cheers.
A big thank you to LPowell for this amazing patch. I can see smoother motion in terms of edge shimmer, especially with Panasonic and Olympus m43 lenses. Here is my first test of Flow Motion 24H using the Olympus 12mm F2.0. With handheld work such as the following, I would normally see plenty of distracting shimmer with even the tiniest movement. With other patches, I found I could minimize the shimmer with slower shutter speeds--basically replacing edge shimmer with motion blur. Now shimmer is more or less non-existent at even 1/50th second. Needless to say, I'm delighted with the results.
Perhaps your next patch will be called "It Ain't The Meat (It's The Motion)"!
Thanks for the detailed answer @LPowell. It's was late but I promise I'll digest it today. But now you have made me clueless about why in my timelapses, the "null" B-frames were 8k while the null P-Frames were 2.5k... :O
I used your patch on this very basic interview. nikon 50mm f1.4 - good work and thank you
@LPowell : Yesterday I inadvertently replicated @balazer 's error report. As you might be aware, my Timebuster patch was based on his Cake 1.1 which is now heavily based on FlowMotion, but since he didn't explore the 720p settings I decided to base the 720p settings (of my yet unpublished v1.2) on FlowMotion. As I had previously seen some dropped P-Frames on 720p because of a very high QP, I was giving it a go at lower QPs and that's when I observed card speed issues on my Samsung SD 16GB (which I benchmarked writing at 18MB/s). And this was happening at ISO's above 3200 also.
Flow Motion color corrected test shot.
More to come!!Test shots at Baker Beach, San Francisco, CA using Flow Motion Patch v1.0.
Info/Settings: 1080p24 Sandisk 64gb 95MB/s Extreme Pro Lumix 14-140 (not great glass but functional) ISO 400 (mistake on my part) Nostalgic +2, -2, 0, -2
Great bridge shot. +++++.
@frerichs great shot. If a flow motion 1.1 with 25p will come, i think i will give my 14-140 a second chance.
Any chance it will span on a sandisk 30mb/s at H?
Thanks
It looks like you're new here. If you want to get involved, click one of these buttons!