50Mbps AVCHD Fast Action 3-Frame GOP Patch

Lpowell

Veteran
UPDATED to Version 2! INI files for the latest version of PTool ready for download

As you may have heard, the latest version of PTool 3.56d and higher have liberated all previously unhackable versions of not only the GH1, but the GF1 and G2 cameras as well. In addition, it provides a variety of new patches that I've been able to incorporate into the Fast Action 3-Frame GOP Patch, making it more versatile than ever.

To make use of these new features, download the latest version of PTool from the following link:

http://www.gh1-hack.info/ptool3d.zip

The Fast Action 3-Frame GOP Patch is ideally suited for the GF1 and G2 cameras' hardware capabilities. The NTSC version of these cameras produces native 720p30 video streams in both AVCHD SH mode and in MJPEG HD mode. This patch boosts the peak bitrate of both video modes to over 50Mbps and in SH mode uses a remarkably short 3-frame GOP-size, recording 10 key frames per second. (This 3-frame GOP is used in PAL AVCHD SH mode as well, recording at 720p25.) Using such a high density of key frames enables the Fast Action 3-Frame GOP Patch to maintain excellent image quality while tracking rapid moving objects.

In addition, all GF1 and G2 cameras may now be freely switched between NTSC and PAL video modes, and all available user interface languages. This patch also enables Manual-exposure video modes, third party batteries, and eliminates 30-minute recording limits in AVCHD modes.

For version 2 of the Fast Action 3-Frame GOP Patch, I've prepared a choice of two INI settings files that differ only in the settings for the MJPEG 30p modes:

* For use with standard lenses, the standard patch will produce two types of MJPEG videos:

HD mode: 1280x720 HD videos with peak bitrates up to around 60Mbps (in 4:2:2 color on the GF1).
VGA mode: 960x720 iPad-compatible videos, with peak bitrates up to 30Mbps.

* For use with anamorphic lenses, the anamorphic patch supports two different squeeze ratios:

HD mode: 1920x810 videos optimized for 1.33X anamorphic adapters, with peak bitrates up to around 60Mbps.
VGA mode: 1920x720 videos optimized for 2X anamorphic adapters, with peak bitrates up to around 50Mbps.

Fast Action 3-Frame GOP Patch Settings Files:

These zipped INI files can be used to apply complete patch settings to firmware loaded into PTool 3.56d. To use, unzip the INI file into the same folder as the PTool application. Launch PTool and load the firmware for either GF1 v1.22 or G2 v1.1. The settings contained in the INI file will automatically be installed in the "I" button at the bottom of the PTool main window.

Note that with the following PTool Settings Files, you may at any time re-install the original Panasonic GF1 v1.22 or G2 v1.1 firmware into the appropriate camera model. You may also copy each type of patched or original firmware to separate SD cards, and use them to quickly switch between patches as often as you like.

View attachment LPowell - Fast Action 3-Frame GOP Standard Patch v2.zip

View attachment LPowell - Fast Action 3-Frame GOP Anamorphic Patch v2.zip

Read on for updated background information on these patches:

A Question of Standards

One of the inexplicable oversights in the AVCHD standard is the absence of any native 30fps non-interlaced HD recording formats. (To be precise, it would be 29.97fps to conform to the NTSC frame rate.) In the USA, 30fps progressive video is better suited than 24fps or 60fps for encoding into Progressive Segmented Frame 60i format for both NTSC broadcast and online video hosting purposes.

For the NTSC GF1 and G2 cameras, Panasonic created a revised "AVCHD-Lite" format which encodes 720p30 video into a non-interlaced 720p60 wrapper by duplicating each native frame. While this enables the GF1 and G2 to match the frame rate of the GH1's native 720p60 AVCHD mode, it needlessly duplicates each 30p video frame. Fortunately, Vitaliy Kiselev's PTool provides an optional "720p59.94fps->29.97fps" patch to convert the GF1 and G2 720p60 AVCHD mode into native 720p30 video, without loss of video data (the GF1 and G2 sensors record natively at 30fps).

When PTool's 720p30 patch is used on the NTSC GH1, however, it actually reduces the GH1 sensor's native frame rate from 60fps down to 30fps. As with the patched GF1 and G2, this produces native 720p30 videos in SH mode instead of the stock 720p60 videos. For videos destined for NTSC conformance, 30fps is a more convenient recording format than 60fps. In PAL mode, the 720p50 AVCHD mode is likewise converted to produce 720p25 videos.

How to Want What You Get


With these considerations in mind, I set out to optimize the patched 720p30 AVCHD video mode for the highest reliable bitrate. I also wanted to reduce the number of P-frames in each GOP (Group of Pictures) in order to improve the encoder's ability to record fast action sequences without muddying the details. 720p60 AVCHD videos have a GOP-length of 30 frames, recording a key frame only once every half second. In addition to undermining the encoder's action tracking ability, a 30-frame GOP produces choppy results when scrubbing through the video stream in a post-production editor. So long as you can maintain an adequate bitrate, the shorter the GOP-length the better.

In past attempts to optimize 720p30 AVCHD, I was stymied by the puzzle of how to maintain a usable 1080p24 AVCHD mode for the GH1 at the same time. When you use PTool to reduce 720p60 AVCHD down to 720p30, the encoder's bitrate drops by almost half. If you then attempt to increase the 720p bitrate, the 1080p bitrate is boosted too high and becomes unreliable. There was no way to adjust the two bitrates separately.

Recently, however, Vitaliy added two new patches to PTool that were suggested by cbrandin for use in his research on stabilizing Native 1080p24 recording. While these patches did not produce a reliable solution for Native 24p, they provided independent adjustments of 720p and 1080p encoding modes. Working on some rather speculative hunches, I managed to use the patches on optimized tweaks of PTool's "C" settings to simultaneously boost 720p30 bitrate while stabilizing 1080p24 bitrate safely below the point where buffer overflow causes sporatic recording failures.

Not the Only Bits that Rate

What was even more impressive was discovering that I could optimize 720p30 video down to a remarkably short 3-frame GOP-length, without even a hint of instability. This produces a key frame every tenth of a second, combining fast action tracking with over twice the compression efficiency of the 720p30 MJPEG encoder. For highly detailed scenes, use of optimized "C" settings produces average bitrates of around 50Mbps with peak bitrates up to 55Mbps, for both 720p30 SH and (on the GH1) 1080p24 FHD modes. Since there are now only half as many frames in 720p videos as before, boosting the 30fps bitrate to 50Mbps produces compression quality comparable to what would be produced by 100Mbps at 60fps. I believe this is the highest reliable AVCHD bitrate that remains safely within the write-speed capabilities of Class 6 SD cards and higher. In addition, AVCHD videos produced by this patch are reviewable via in-camera playback.

While the GH1 1080p24 FHD mode is still confined within a 60i wrapper to maintain stability, this 50Mbps AVCHD patch produces consistently higher average bitrates than my Reliable In-Camera Playback Patch. The 1080p24 FHD mode is not quite as reliable, however, when used with an auto-focus lens in AFS rather than Manual-Focus mode. For well-lit, extremely detailed subjects (e.g. foliage), I'd recommend using a half-shutter press to get focus-lock, then switch the GH1 to MF mode just before pressing the video button. (This applies only when using auto-focus lens in 1080p24 FHD mode. I've found 720p30 modes to be absolutely reliable under all operating conditions.)

On the MJPEG side, I've paired this 50Mbps AVCHD 3-Frame GOP Patch with my previously published 60Mbps MJPEG 4:2:2 Color Patch:

http://dvxuser.com/V6/showthread.php?t=216238

While it does not produce MJPEG videos that can be viewed in-camera, I believe the 60Mbps average bitrates of this patch's MJPEG videos are close to the highest that can be reliably recorded on Class 6 SD cards. Particularly in low-light situations, I've found this 60Mpbs MJPEG patch to maintain considerably higher bitrates than the AVCHD encoder, along with higher quality 4:2:2 color depth (on GF1 cameras) for post-production grading purposes.

Full Speed Ahead


The Fast Action 3-Frame GOP Patch v2 is compatible with both GF1 and G2 cameras, and is switchable between NTSC and PAL modes. My thanks once again go to Vitaliy Kiselev, for his pioneering work on PTool, and to cbrandin for his invaluable Stream Parser tool.

*** WARNING ***

Unfortunately, there is a reliability issue with using short GOP-lengths in the AVCHD encoder. Under extremely dim illumination, video bitrate can fall below 5Mbps. If this condition persists for longer than about seven seconds, the AVCHD encoder may terminate the recording, leaving a zero-length file. This malfunction can occur with any AVCHD patch that uses a reduced GOP-length, and the only known way to guard against it is to make sure your subject is adequately lit at all times.

The Fast Action 3-Frame GOP Patch will not work properly with previous versions of PTool. The best way to insure that you have the latest PTool release is to download it directly from the following link:

Download PTool here: http://www.gh1-hack.info/ptool3d.zip

Fast Action 3-Frame GOP Patch Settings Files:

These zipped INI files can be used to apply complete patch settings to firmware loaded into PTool. To use, unzip the INI file into the same folder as the PTool application. Launch PTool and load the firmware for either GF1 v1.22 or G2 v1.1. The settings contained in the INI file will automatically be installed in the "I" button at the bottom of the PTool main window.

Note that with the following PTool Settings Files, you may at any time re-install the original Panasonic GF1 v1.22 or G2 v1.1 firmware into the appropriate camera model. You may also copy each type of patched or original firmware to separate SD cards, and use them to quickly switch between patches as often as you like.

View attachment LPowell - Fast Action 3-Frame GOP Standard Patch v2.zip

View attachment LPowell - Fast Action 3-Frame GOP Anamorphic Patch v2.zip
 
Last edited:
Full Resolution Sample Frames of Fast Action 3-Frame GOP Patch

Full Resolution Sample Frames of Fast Action 3-Frame GOP Patch

Here are 100% crop frame samples from videos taken with the Fast Action 720p30 Patch. While the AVCHD modes maintain stable bitrates around 50Mbps for highly-detailed, motion-packed scenes, bitrates inevitably decrease when filming low-detail static scenes. The MJPEG codec maintains bitrates over 60Mbps even when encoding relatively low-detail images.

There was a brisk wind blowing through this three-story-tall tree, producing individual motion vectors for virtually every single leaf. My Class 4 Lexar Platinum II SD card's write-speed was not quite fast enough to record it in 1080p, though it had no difficulty in 720p AVCHD or MJPEG. My Class 6 and 10 SD cards had no difficulty passing this test in all video modes.

Windy Tree MJPEG-HD (65 Mbps):
http://vimeo.com/15015559
windytree.jpg



Windy Tree AVCHD-SH (46 Mbps): http://vimeo.com/15015725
windytreeavchdsh.jpg

windytreeshgop.gif



Windy Tree AVCHD-FHD (48 Mbps):
http://vimeo.com/15015797
windytreeavchdfhd.jpg

windytreefhdgop.gif



One of more difficult challenges for the GH1 is to record fine detail in darker areas at moderate bitrates. While the inner sanctum of this crypt was discernable to the naked eye, not even the MJPEG codec was able to clearly penetrate its murky depths.

Dark Crypt MJPEG-HD (62Mbps):
darkcryptmjpeghd.jpg



Dark Crypt AVCHD-SH (32Mbps):

darkcryptavchdsh.jpg

darkcryptshgop.gif



Dark Crypt AVCHD-FHD (40Mbps):
darkcryptavchdfhd.jpg

darkcryptfhdgop.gif


n7darkcryptfhdgopg
 
Last edited:
I really can't thank you enough for doing this, you folks that understand this stuff totally astound me and this particular presentation must have taken a lot of time.
That being said (and I have read almost every post here) Which (MJPEGvsAVCHD) would you use and when? I'm just asking for some off the top of your head thoughts. example: Difficult lighting (color wise), lot's of motion, detailed background.
I have both the GH and GF...are the GF settings changed based on these new findings (currently using your previous recommendations)?
Sorry if I'm being greedy with your time.
 
You will get drop frames on GOP's that low. Go ahead and try it, parser will give you 192's. Well, i suppose if your swinging the camera wildly around with a low shutter you might not have any problems.

Anyways if you're doing a low gop in 60i, it has to been multiples of 5 otherwise you will get really screwed up I and P frame placement (almost as screwed up as its pulldown implementation, though there is no correlation).
 
Do you mean if not multiples of five there will be different GOP lengths? I've seen this, and the empty (i.e. 192 byte) frames - but only with 1080 with Native 24p checked. Then again, I haven't messed with different GOP lengths much.

Now I'm wondering if this may be a problem with 1080 24p with Native checked. I wonder if the GOP needs to be changed from 12 to 10 or 15.

Chris
 
On 24pN drop frames occur at gops of 2-5, but the GOP cadence remains stable. On 60i drop frames dont occur as much, but anything other than 5,10, or 15(default) and the cadence is all over the place.
 
Anyways if you're doing a low gop in 60i...
Sorry, guys, but you're off-topic in this thread. The 1080p24 GOP-length in this patch hasn't been changed from the default 15 frames. The 3-frame GOP-length is used only for 720p30 videos, which are non-interlaced and are not affected by any Native 24p issues.
 
This is best of all worlds stuff. Amazing. Usually, I'm one of the guys happy to wait for these things to circulate around a bit before biting, but I'm uploading now based on ipowell's previous, always reliable stuff. I'm wondering why this hasn't caused a stir in the forum. This is pretty big news isn't it?
 
I dont see the point. If mjpeg can already record at 80mbits solid, then why even bother with an equivalent fps/res that can only record an 80mbit frame (in this instance) once every 2 frames?

SH is there for highspeed capture (120fps interpolation). If you just want to record 720 then thats what mjpeg is for. This is just some sort of manbearpig.
 
mine had Ipowell's j setting. i replaced it with his "i" setting as soon as i read ipowell's posting on the friday night. yeah i was wondering why we need 60fps recording for 720 if we convert to 24p anyways. also i wondered if theres any noticeable difference between 24p and 30p. if 30p works, thats great. sometimes shutter speed at 1/30s does help. thats one stop gain from 1/60s. more efficient avchd recording and more bits squeezing. two thumbs up!!! thank you!!!
 
I dont see the point. If mjpeg can already record at 80mbits solid, then why even bother with an equivalent fps/res that can only record an 80mbit frame (in this instance) once every 2 frames?
MJPEG does have its limitations. The highest reliable bitrate I've been able to verify is 60Mbps average, 65Mbps peak. At that speed, the 2GB MJPEG max file length can record about 8 minutes of video. What MJPEG is well suited for is color keying with its 4:2:2 color depth.

The downside of MJPEG is its blocky artifacting. Its blocks are fixed at 8x8 pixels and you can see evidence of their edges in high-detail images encoded with my 35Mbps MJPEG patch. The 65Mbps MJPEG patch produces higher quality results, but its videos aren't reviewable in-camera.

This 3-frame GOP AVCHD patch has fewer bits to work with, but it uses them more efficiently. With two P-frames for each I-frame, the AVCHD encoder needs only half as many bits to encode each 3-frame GOP as the MJPEG encoder needs for its corresponding three I-frames. In addition, AVCHD can mix varying size blocks (4, 8, 12, or 16-pixel) into the encoding of each frame, effectively suppressing the MJPEG blocky look.

With its encoding efficiency, 720p30 AVCHD should be able to record at least 2 hours of video on a 16GB SD card at far better image quality than the stock 720p60 SH mode. The main use case I have in mind is single-take documentary event footage intended for delivery at 720p30 or down-sampled to anamorphic DVD.

Converting 720p60 to the desired 720p30 is cumbersome and suboptimal. In addition, the 3-frame GOP 720p30 video stream is much more fluid to work with in post than the 30-frame GOP of the GH1's 720p60 video. I'd much prefer to edit the original source footage directly rather than transcode or conform it into something else.
 
Last edited:
aman!!! u made my day. i edit mts files natively by using PP cs5 but there was one thing bothering me. theres an option for exporting. create key frame in every 30 frames. i had no idea what it was until you explained. i think i can safely uncheck the option cuz my gh13 has a lot more key frames :)
 
Last edited:
I hope the resident geniuses here, and I don't throw that term around lightly, can port this new option to the GF1. I'm currently using the LPowell 40 setting and it's the best I've tried, but this new setting sounds like a significant improvement. Thank you, gentlemen.
 
I hope the resident geniuses here, and I don't throw that term around lightly, can port this new option to the GF1. I'm currently using the LPowell 40 setting and it's the best I've tried, but this new setting sounds like a significant improvement. Thank you, gentlemen.

I 2nd that! Would be great to try this on the GF1! :)
 
lpowell:
are you saying that 720_60p avchd isn't actually 60p, but rather 2x30p?
that we can't shoot 60p for 24p 40% slowmo because it's just duplicated frames from 30p and that the best we can do is 50% speed?
 
...are you saying that 720_60p avchd isn't actually 60p, but rather 2x30p?
This is the case for the GF1, which has a sensor that is scanned at only 30p in SH video mode. (Panasonic refers to this as "AVCHD-Lite".)

On the GH1, SH video mode records at the full 60p.
 
Back
Top