This patch has been upgraded and superseded by Flow Motion v2
For more info, see the following link:
GH2 100Mbps Flow Motion v1.11 Failsafe Patch with HBR 25p & 50p modes
Released below is a minor revision to Flow Motion v1.11, tuned and tested for failsafe operation in all PAL video modes, including ETC zoom mode. In addition, it also supports failsafe operation in all NTSC modes except for ETC mode in HBR 30p and FSH 60i. As an alternative to using ETC in HBR 30p mode, I recommend using ETC with either 80% Slo-mo 24H mode, or MJPEG HD mode, both of which produce high quality results at 1080p30. To download the Flow Motion v1.11 Patch INI file, select the last attachment at the bottom of this post.
In short, this is the 100Mbps GH2 version of my Reliable In-Camera Playback Patch.
Congratulations once again to @Vitaliy Kiselev for cracking Panasonic's recent firmware v1.1 update for the GH2! PTool v3.64 now provides support not only for the new HBR 1080p25 and 1080p30 video modes, but for custom Quantizer Scaling Tables as well. Custom tables enable patch developers to tailor the compression properties and image quality of each of the AVCHD 1080p, 1080i, and 720p video resolutions. In addition, @cbrandin's invaluable Stream Parser and Scaling Table development tools have made it possible to quickly take advantage of these new PTool features, providing an unprecedented level of control over the GH2's video recording functions. Combined with the capabilities of Panasonic's v1.1 firmware, this has resulted in numerous improvements to the reliability and motion picture quality of Flow Motion v1.1. Here is a concise list of its features and specifications:
100Mbps AVCHD in 24H 1080p24 and SH 720p50/60 at 8-10 keyframes/sec.
75Mbps AVCHD in HBR 1080p25/30 and FSH 1080i50/60 at 8-10 keyframes/sec.
50Mbps AVCHD in 24L 1080p24, FH 1080i50/60, and H 720p50/60 video modes
100Mbps MJPEG 1080p Patch maintains high bitrates regardless of light levels.
Full support for all NTSC and PAL video modes.
In-camera playback of all AVCHD video files. (MJPEG HD videos not playable in-camera.)
4GB AVCHD file-spanning in all video modes with 95MB/sec UHS-1 SD cards.
File-spanning in 24L, FH, and H modes supported on all Class 10 SD cards.
ETC zoom mode with failsafe operation in all modes except NTSC HBR 30p and FSH 60i.
80% Slo-mo 24H video mode with ETC and file spanning in 24L mode.
Combines optimal I-frame size with compact, 3-frame GOP file size (GOP-6 in 720p modes).
Customized Scaling Tables produce P and B-frames that match I-frame quality.
As with any complex video camera, there are a number of considerations and limitations to bear in mind:
Listed bitrates are the maximum seen in practice, filming well-lit, sharply-focused, highly detailed scenes. Average shots will produce average bitrates. In low-light conditions, I recommend trying MJPEG HD 1080p30 mode for its ability to maintain high bitrates in near dark conditions.
If shutter speed is set longer than the frame rate (e.g. slower than 1/60 at 60p), low-quality video files may be produced. High shutter speeds will reduce motion blur, which may force the encoder to operate at higher bitrates.
ETC zoom mode increases the bitrate and puts significant stress on the encoder. With Flow Motion v1.11, Failsafe ETC mode is now supported in all PAL video modes, and in all NTSC video modes except HBR 30p and FSH 60i modes. ETC actually does work in all modes, but I've found that with Panasonic distortion-correction lenses, it's not 100% failsafe in HBR and FSH modes under the most extreme conditions. With manual-focus vintage lenses, it has so far proven to be failsafe in all modes.
Flow Motion v1.1 has been tested extensively at ISO 3200. It is not tuned to work reliably with PTool's extended ISO patch, but higher ISO can be used reliably in underexposed, low-light conditions.
Panasonic Lumix distortion-correction lenses are now fully supported in Flow Motion v1.11. For smoothest results, I recommend using these lenses with a mild diffusion filter to reduce their over-sharpened edge artifacts. My favorite is the Tiffen Black Diffusion FX3.
The 24L, FH, and H video modes make use of a special "Trick Mode" that ensures reliable file-spanning at 50Mbps. It does this by setting the video file's transport stream bitrate to a much lower level than the video stream's bitrate. These files play back correctly in video editors with no need for post-processing. However, MediaInfo and Windows will report incorrect duration and bitrate for these files when examined on the desktop.
I recommend using the camera to format your SD card at the start of each shoot, to guard against SD card memory fragmentation.
How Long Has This Been Going On?
While it seems like forever since the GH2 was first hacked in a hardcore tour-de-force by Vitaliy Kiselev, it's actually been just six tumultuous months. During that time, an overwhelming amount of GH2 research, experimentation, and testing results have been shared by numerous contributors to this and other websites. Athough I contributed a 100Mbps MJPEG 1080p patch in the early days, I have not previously released a patch for any of the GH2's AVCHD video modes. One of the main reasons has been the wide variety of patches that others have already developed for the GH2:
@cbrandin: 44Mbps AQ4 and 66Mbps AQ2 patches with the standard 12-frame GOP.
@driftwood: Quantum 150-176Mbps 24p Intra-frame patches for max image detail.
@bkmcwd: 154Mbps 24p short-GOP patches for maximum I-frame quality.
@Stray: 88Mbps AQ2 24p patches using the standard 12-frame GOP.
@Ralph_B: Sanity long-GOP high-quality, moderate-bitrate patches.
@GH13Timelapser: Low-frame-rate MJPEG patches for time-lapse videography.
These patches all produce excellent results for the specific purposes they were designed to serve. Unfortunately, the GH2 can make use of only one AVCHD and one MJPEG patch at a time. What makes this severely limiting is the wide variety of video modes and unique features that are packed into the GH2. For a patch developer, one of the most difficult challenges has been how to optimize performance of the GH2's most popular video modes without crippling or destabilizing the rest of its modes and functions. Here is the full list to consider:
Always Room for One More Mode
24H & 24L modes: 1080p @ 24fps
FSH & FH modes: 1080i @ 50fps PAL & 60fps NTSC
SH & H modes: 720p @ 50fps PAL & 60fps NTSC
24H & 24L 80% Slo-mo: 1080p @ 30fps
HD mode: 16:9 MJPEG mode in 720p - 1080p resolution
VGA mode: 4:3 MJPEG mode in 480p - 960p resolution
Extra Tele Conversion mode: digital zoom in all modes above
With both NTSC and PAL, I count 14 different video modes, and that doubles when you throw in ETC digital zoom mode as well. By comparison, the GH1 had ten PAL and NTSC modes, but its H and L modes were merely low bitrate versions of 720p mode. If you consider how long it takes to fully test a comprehensive GH2 patch in all possible combinations of video modes, you may get an idea of how I've been spending my free time these past few months...
The Great Intra-mural Debate
In the early days of GH2 patch development, an unexpected debate emerged around the AVCHD encoder's use of P and B-frames. As with the GH1, the GH2 encodes video in fixed-length sets of 12-30 frames, each called a "GOP" (Group Of Pictures). Each GOP starts with a self-contained key frame called an "Intra-frame" or "I-frame", followed by partially-encoded difference frames called "P-frames" and "B-frames". While I won't digress into much technical detail here, P and B-frames provide more compact compression than I-frames, but with debatable drawbacks in image quality and motion tracking. One of my early GH1 patches introduced the concept of an ultra-short 3-frame GOP for fast motion-tracking in 720p30 videos. While this sparked some debate on its effectiveness at the time, it was nothing compared to the short-GOP crusade that emerged with the GH2.
With an unhacked GH2, its most popular 1080p24 video mode uses a 12-frame GOP, containing I, P, and B-frames, at bitrates up to 24Mbps. This orthodoxy was first challenged by @kae with his 66Mbps 3-frame GOP patch that worked with the initial GH2 version of PTool. The effects of such a short GOP on image quality and motion rendition were heatedly discussed, with advocates claiming that long-GOP P and B-frame image quality could never match that of I-frames.
The debate simmered for months, seemingly at a stalemate, when a completely unprecedented development blew everything away. After much experimentation, Nick Driftwood discovered a technique that could eliminate P and B-frames entirely, producing videos with 1-frame GOP's that contained only Intra frames, at bitrates up to 176Mbps. The resulting videos packed a huge amount of data into each I-frame, for maximum image detail at the cost of equally unprecedented storage requirements. Since the bitrates were far too high for AVCHD file-spanning to work, the maximum duration of each take dropped to around 3 minutes per 4GB of SD card storage. Any doubts as to whether high-bitrate Intra-frame encoding really produced better image quality were soon laid to rest by Ralph_B's brilliant series of tests comparing driftwood's results to direct HDMI frame grabs.
Although GH2 Intra-frame videos can be recorded at bitrates lower than 176Mbps, image quality is inevitably reduced as well. This is the reason P and B-frames were designed into the GH2's AVCHD encoder in the first place: to reduce video bitrate to the point where 4GB file-spanning can work without noticeably degrading image quality. But somehow this goal fell short, because the stock GH2 clearly cannot match the quality of 176Mbps Intra videos.
GH2 Quantum Mechanics Revealed
Those familiar with video encoder technical details know how the GH2's AVCHD encoder works: it compresses video data by storing it in coarsely approximated data formats. It does so using cleverly devised tables of "quantizers" that slice and dice the data without visibly degrading it. Soon after the GH2 was hacked, Chris Brandin worked with Vitaliy Kiselev to develop a custom patch that would automatically boost quantizer quality at increased bitrates. He then used these "AQ" patches to develop his classic 44Mbps and 66Mbps patches, combining enhanced quantizer quality with moderate bitrates, while retaining the GH2's standard GOP lengths.
While the AQ patches provided important pieces of the GH2 puzzle, they were designed to work properly only with long-GOP encoding, not on ultra-short 3-frame and 1-frame GOPs. At the next layer deep within the encoder lie the actual quantizer tables used by the AVCHD codec - the core of the compression engine. After much research into the firmware, Chris extracted these tables into a spreadsheet, providing for the first time a complete overview of the encoder's inner workings. It was after I studied these tables in detail that I discovered the reason why P and B-frames had never looked as good as I-frames.
Panasonic designed the GH2 as a consumer camera using the limited 24Mbps bitrate dictated by the AVCHD standard. For this reason, their top priority was not achieving the highest image quality, but compressing the video data into the smallest amount of file space. To accomplish this, they minimized the size of P and B-frames by using significantly coarser quantizer tables to encode P and B-frames than they used on I-frames. It was no wonder that Driftwood's strategy of eliminating everything but the I-frames improved image quality!
Fortunately, Vitaliy had the foresight to hack the location of the GH2's quantizer tables, providing patches to reassign the tables used by I, P, and B-frames. In one fell swoop, I was thus able to optimize the quantizer tables for all three frame types, matching P and B-frame image quality to that of I-frames. This provided the key to combining Intra-frame quality with short-GOP motion tracking and compression efficiency.
What Good is a GOP?
Intra-frame proponents rightly point out that encoding each video frame separately insures that no undesireable inter-frame motion artifacts can degrade the video. With long-GOP encoding stretching over a half-second per GOP, image quality can suffer when large amounts of object motion produce major discrepancies between P and B frames and their reference I-frames.
Simply by reducing the amount of image movement that can take place within each GOP, short-GOP encoders boost image quality by minimizing motion tracking discrepancies within the encoder. With a 3-frame GOP at 24fps, a new keyframe is produced eight times per second, limiting encoded motion to only what can occur within 1/8th of a second. Residual differences in frame-to-frame image details can then be encoded with much greater compression efficiency at potentially the same level of image quality as I-frames. And with PTool's Quantizer Table patches, it's now possible to configure the encoder for optimal P and B-frame image quality.
To produce optimal motion picture quality, however, it's not enough for individual frames to be encoded in high detail. A sequence of frames must also blend together in a seamless simulation of movement. To produce this illusion at low frame rates, there must be a high degree of frame-to-frame continuity, especially when it comes to high-contrast edges. If not, minute edge discrepancies can cause moving or panning objects to appear to flicker in a distracting manner. Rather than prioritizing still-frame image quality over all other considerations, the Flow Motion Patch is tuned to produce smooth continuous movement.
GH2 100Mbps Flow Motion Patch
This version of the 100Mbps Flow Motion Patch uses a 3-frame GOP in 24H and FSH modes, and a 5-frame GOP in SH mode. This produces 12 keyframes/sec in 720p60, which is 50% more keyframes than you get in 24H mode. In terms of motion flow, it's not the GOP-length, it's the keyframe rate that really counts.
Here are Stream Parser graphs of the Flow Motion 24H patch, first with a test chart:
The test chart shows Flow Motion near its peak I-frame bitrate - 8Mbits per I-frame. To sustain this I-frame data rate in an all-intra patch would require 192Mbps. The test chart is too boring to stress the codec very much, so I tried to strangle it with a gnarly bush:
The bush I shot handheld without image stabilization, but nothing I tried would make Flow Motion crash. Notice how much it boosted the B-frames to handle my jittery grip - this is what good quantizer tables look like. The I-frame height dropped because of how I throttled the bitrate to 100Mbps. That is the sweet spot for this patch, if you push the bitrate much higher the encoder will start to spaz out.
Here is Flow Motion at 720p60 in SH mode. Since a 720p frame has half as many pixels as 1080p, these 4Mbit I-frames are just as beefy as the 24H mode I-frames. P-frame consistency looks healthy as well.
Here is no one's favorite mode, 1080i60 in Flow Motion. FSH mode is entangled in some unpleasant ways with both 24H and SH modes. This makes it rather neurotic and I had to straitjacket it a bit to keep it stable. As a result, its B-frames aren't quite as robust as 24H mode.
Here is a set of sample videos shot at ISO200, 1/60 sec, f4.0. These clips show how Flow Motion produces smooth, continuous motion pictures with minimal flickering, even at 24fps.
Flow Motion 24H 1080p24
Flow Motion SH 720p60
Flow Motion MJPEG HD 1080p30
Unfortunately, Vimeo seems to be unable to display interlaced 1080i60 videos. However, you can still download the original Flow Motion FSH 1080i60 MTS file from its Vimeo page.
So where can I download the patch... sounds amazing!
The last few days I felt there was a silent revolution in the works, it is only now that I see how deep it was... and how much more test work lies ahead. Thanks for your post, it should be made into a sticky because it's a real compass in this sea of patches that this site has grown into.
So where can I download the patch >>
Yup, that´s the question...
@LPowerll Brilliant writing, man. I enjoyed reading it.
Common, how long to wait?! Every second hurts! :o) That's the exact approach I intended to take, however my coding abilities and the lack of time to explore things further hampered my enthusiasm. As a result I was quietly waiting and hoping for a breakthrough like yours @LPowell . My willingness to have a go at designing the patches with optimised P and B frames was further played down by an unnecessary conflict with a member of this forum. There is an amount of a strange competitiveness and pride when it comes to the developments and putting one's time and energy into something which might result in flaming rather than a contribution, and it deterred me even further. So, all in all, kudos to you for your determination! BTW, you should be a politician with your diplomatic skills :o)
@LPowell Your description of the process which brought you to this patch is really a "Hack History" and it deserve a bold place into the wiki space!!!
I have to commend you LPowell on your writing style, it's like attending a university lecture about the sci-fi world of codecs. Thank you for persistence.
I also have to agree on your writing style, you have taken a fantasticly complex situation and made it into a novel that I can't wait to hear more about.
The idea of P,B frames using a coarser table makes me wonder if it was done for performance reasons.
Hmmmm., qué nervios!!!!!!
Good read, can't wait for the patch.
Lee, Excellent write up. The one guy missing from the patch list is @Kae, his 66M GOP3 patch, released back in the early days of the hack was groundbreaking. Kae, I know has had to stop patching because of serious illness and throat cancer. He has been inspirational to the whole of this patching excercise. I hope he is doing well.
@driftwood Thanks for reminding me of kae's seminal work. I revised my account to reference his pioneering contribution to short-GOP patch development. I'll be making further updates as my work schedule and weather conditions permit...
"V1.1 will feature customized quantizer tables combined with 25p HBR support!"
@LPowell does this mean a new PTool version is imminent?
@Hallvalla While I too am eagerly anticipating the upcoming version of PTool, I'm also aware of how complex a challenge it is to track down the dozens of patches that need to be updated to support the v1.1 firmware. I think we can rest assured that Vitaliy will announce its release as soon as it is complete.
@LPowell When do you think you'll release this patch?
@ehr I plan to upload patch docs and Stream Parser charts tonight after I get off work. Hopefully I will have time Wed morning to edit and upload sample frames and videos.
Really, really looking forward to this. Can't say thank you enough!
P and B Frames at the Quality of I-Frames? I'm curious... and can not believe it :-D
Like I said in another thread, thank you for your hard work. I've been using Chris's 66mbps patch as my stable patch for commercial work since it came out. Even tho there might have been a quality bump, all my tests with other patches just weren't stable enough and/or were missing too many features. I have a feeling with this patch I'll finally be able to update while staying stable, adding quality, and adding functionality. Thanks again, and I can't wait for the release.
@fatpig Matching p frames or b frames to i frames size has already been done ages ago if you look at the Driftwood GOP3ILLA patches in the patch vault.
Great read!
Thanks @LPowell for your dedication and for sharing with the rest of us. Your stellar GH1 reputation about the thoroughness of patches has just resurrected here. I look forward to your patch and your continuation in the posts at the top of the thread... Al
It looks like you're new here. If you want to get involved, click one of these buttons!