Category Archives: final cut pro

Panasonic GH5 Demystifying Movie recording settings

 

There are a lot of videos on YouTube that suggest that there is not much difference among the various recording settings of the GH5 for UHD.

To recap we have 4 settings for UHD (I will refer to PAL system because it is easier but all applies equally to 24p, the 30p/60p format will be the same with worse results)

  1. 100 Mbps 420 8 Bits Long GOP 25p
  2. 150 Mbps 420 8 Bits Long GOP 50p
  3. 150 Mbps 422 10 Bits Long GOP 25p
  4. 400 Mbps 422 10 Bits All-Intra 25p

The difference between Long GOP and All Intra is that in the Long GOP what is encoded is a group of pictures (GOP) and not separate individual pictures. In this article I will use ProRes as a proxy to AVC-Intra as, in the GH5 implementation, they have very similar logic and performance you can find some posts on the internet of people trying to discern the two but there really is not difference as essentially this is just image compression. 

Within a Group of Pictures there are different type of frames:

  • I (Intra coded) frames containing a full picture
  • P (Predictive coded) frames containing  motion interpolated picture based on a prediction from previous frames
  • B (bi-predictive coded) frames containing a prediction from previous or future frames

It is important to note that frames are not stored sequentially in a GOP and therefore the GOP needs to be decoded and the frames reordered to be played, this requires processing power.

The reason why H264 is very efficient is that within a group of picture there is only one full frame and the rest are predictions clearly if the prediction algorithm is accurate the level of perceived quality of long GOP is very high and similar to All-Intra clips.

This is the reason why comparing All Intra and Long Gop using static scenes or scenes with repetitive movement that can be predicted very accurately by the codec is a fundamental error.

Incorrect example here:

The scene is composed of static predictable objects with no motion and after YouTube compression the (wrong) conclusion is that there is no absolute difference between the codecs. Instead what this shows is the effectiveness of Long GOP when the prediction is accurate which is exactly the point of the codec plus the fact that YouTube flattens differences due to heavy compression and use of Long GOP.

Another example is a bit better as it uses a fountain which is a good representation of unpredictable motion

In the 300% crop you can see how All_Intra performs better than Long GOP in terms of prediction despite the YouTube compression, but generally those tests are unreliable if you see the last section of the video where there is a semi-static scene you cannot really take the three examples apart.

So why is that and is there any point selecting different settings on your Panasonic GH5?

In order to understand the workings we need to dig deeper into the structure of the GOP but before doing so let’s evaluate the All-Intra codec.

AVC All-Intra explanation

This codec records at 400 Mbps so with 25 fps this means circa 16 Mbits per frame or  1.9 MB per frame and there is no motion interpolation so each frame is independent from the others. The implementation of All-Intra of the GH5 does not make use of CABAC entropy encoding as Panasonic does not believe this is beneficial at higher bit-rates making this AVC-Intra implementation very close to ProRes as both are based on Discrete Cosine Transform.

If you consider a Jpeg image of your 3840×2160 frame on the GH5 you see that it stores around 4.8 MB per image because there is no chroma sub-sampling so if you wanted to have exactly the same result you would need to use ProRes 4444 to get a comparable quality (this not even taking into account that Jpeg are 8 bits images).

Video uses chroma sub-sampling so only part of the frame contain colours at a given time. Apple in their ProRes white paper declare that both ProRes 422 and 422 HQ are adequate to process 10 bit colour depth and 422 sub-sampling however they show some quality differences and different headroom for editing. If you count 50% for 4.2:0 sub-sampling and 67% for 422 you get around 2.34 MB and 3.5 MB frame sizes that correspond to ProRes 422 and ProRes 422 HQ individual frame sizes.

In simple terms All Intra 400 Mbps would fall short of Apple recommended bit-rate for 422 10 bit colour for circa 92 Mbps is like saying you are missing 0.44 MB from your ProRes 422 frame and 1.6 MB from ProRes 422 HQ and you have 0.3 MB more than ProRes LT however I do not have the full technical details of ProRes to evaluate directly.

The real benefit of such codec is that it can be processed with modest hardware without conversion as the AVC Intra codec is edit ready and each frame is captured individually without any motion artefacts and therefore the computer does not have to do a great deal of work to decode and render the clips.

In order to record All-Intra in your memory card you need a V60 or higher specs card which in terms of $ per GB costs you more than an SSD drive however you no longer need a recorder.

Coming back to the other recording quality option we still need to evaluate how the various long GOP codecs compare relative to each other.

In order to fully understand a codec we need to decompose the GOP into the individual frames and evaluate the information recorded. If you look on Wikipedia it will tell you that P frames are approximately half the size of an I frame and B frame are 25%. I have analysed the Panasonic GH5 clips using ffprobe a component of ffmpeg that tells you what is exactly in each frame to see if this explains some of the people claims that there is no difference between the settings.

Link to Panasonic documentation

 

100 Mbps 420 8 Bits Long Gop 25p Deep Dive

An analysis with ffprobe shows a GOP structure with N=12 and M=3 where N is the length in frames of the group of pictures and M is the distance between I or P frames.

So each Group of Picture is made like this

IBBPBBPBBPBBP before it repeats again.

A size analysis shows that B frames are in average 14% of the I frame and P frames are around 44% of the I frame.

I B B P B B P B B P B B
Size 1648326 247334 237891 728777 231947 228048 721242 228347 227544 713771 236866 232148
Ratio to I frame 100% 15.01% 14.43% 44.21% 14.07% 13.84% 43.76% 13.85% 13.80% 43.30% 14.37% 14.08%

With an average video bit-rate of 94 Mbps each GOP has 45.3 Mbps which means an I Frame has around 13.1 Mbits or 1.57 MB per frame and an equivalent All-Intra bit-rate of approximately 328 Mbps however this codec is using CABAC entropy encoding that Panasonic states is 20-30% more efficient than CAVLC used in All-Intra so net of motion artefacts this codec is pretty strong.

150 Mbps 420 8 Bits Long GOP 50p Deep Dive

An analysis with ffprobe shows a GOP structure with N=24 and M=3 where N is the length in frames of the group of pictures and M is the distance between I or P frames.

So each Group of Pictures is made like this

IBBPBBPBBPBBPBBPBBPBBPBB before it repeats again.

A size analysis shows that B frames are in average 13.4% of the I frame and P frames are around 41% of the I frame. With an average bit-rate of 142.7 Mbps each GOP has 68.5 Mbits which means an I Frame has around 11.3 Mbits or 1.35 MB per frame and an equivalent all Intra bit-rate of approximately 566 Mbps. Again this uses CABAC entropy encoding so the equivalent All-Intra is higher.

One very important aspect of the 150 Mbps codec is that as the GOP is double the length of the single frame rate 100 Mbps codec there are the same number of key frames per second and therefore it is NOT true that this codec is better at predicting motion. In fact it is exactly the same so if you had acquired a 100 Mbps codec at 25 fps and then slowed down the footage to half speed asking your editor to interpolate intermediate frames it would come to the same result although with some more processing required.

150Mbps 422 10 Bits Long Gop 25 fps

An analysis with ffprobe shows a GOP structure with N=12 and M=1 which means this codec does not use B frames but just I and P frames so the GOP structure is as follows:

IPPPPPPPPPPP before it repeats again.

A size analysis shows that P frames are on average 53% of I frames so this codec is in fact less compressed however this has also some consequences.

With an average bitrate of 150 Mbps each GOP has 72 Mbits which means an I Frame has around 10.5 Mbits or 1.25 MB per frame and an equivalent all Intra bitrate of approximately 262 Mbps. So this codec in terms of compression efficiency this is actually the worst and this is due to the lack of B frames.

We can only think that the Panasonic GH5 processing is not strong enough to capture 10 bit and then write 422 Long GOP with IPB structure.

Codec Ranking for Static Image Quality UHD

So in terms of absolute image quality and not taking into account other factors the Panasonic GH5 Movie recording settings ranked by codec quality are as follows:

  1. 400 Mbps 422 10 Bit All intra 25 fps (1.9 MB per frame)
  2. 100 Mbps 420 8 Bit Long Gop 25 fps (1.57 MB per frame)
  3. 150 Mbps 420 8 Bit Long Gop 50 fps (1.35 MB per frame)
  4. 150 Mbps 422 10 Bit Long Gop 25 fps (1.25 MB per frame)

The 100 Mbps  and 400 Mbps codec are marginally different (21% larger frame size) with the 422 10 Bits long GOP really far away.

Conclusion

If you want to record your footage to the internal memory card you are really left with two choices:

  1. Use the 100 Mbps Long Gop codec it is very efficient in the compression and the perceived quality is very good. It does however require you to convert to ProRes or similar during editing if you don’t want to overload your computer as the codec is really heavy on H264 features. You need to get the exposure and white balance right in camera as the clips may not withstand extensive corrections. There is a risk with footage with a lot of motion of some errors in motion interpolation that can generate artefacts.
  2. Buy a V60 or V90 memory card and use 400 All intra at single frame rate. This will give you edit ready footage of higher quality without motion artefacts, You still need to get exposure and white balance right in camera as the headroom is not so large to allow extensive corrections. The bit-rate and frame size is not sufficient to really give you all the benefits of 422 sampling and 10 bit colour but it will be a good stepping stone to produce good quality rec709 420 8 bit footage.

Generally there appears to be no benefit using the internal 422 10 Bit codec nor the 420 8 bit double frame rate due to the limitations of the GOP structure, here Panasonic has created a few options that to be honest appear more a marketing effort than anything else.

There may be some use to the 150 Mbps double frame rate if you intend to slow down the footage after the conversion to ProRes or similar but the extremely long GOP does not make this codec particularly robust to scenes with a lot of motion and in any case not more robust than the 100 Mbps codec.

A final thought if you are interested in 10 bit colour is that the FHD All Intra 200 Mbps codec has enough quality and headroom to allow manipulation. This is in fact the only codec that has bit-rate higher than ProRes HQ at least at 24 and 25 fps so if you want to check the real range of colours and dynamic range the camera is capable of you should try this codec.

Note: I have removed some comments on ProRes and external recorders as there are plenty of people that believe that the intra codec does better than ProRes HQ on the Atomos

Advertisements

100,000 visits – In Depth into Sharing Videos on the Internet

Two years and few months later I am pleased my blog hit 100,000 visits. Considering that there is sponsorship and this is pretty much content produced during free time I am well pleased.

So as commemoration topic I want to put a few considerations that spin off a post on the editing and share section of wet pixel.

Many people spend a lot of money on underwater video rigs and use sharing websites such as youtube and vimeo to host or promote their content. The reason is clear those sites have a huge audience and if you have original content you can get a bit of advertising revenue as well that is never a bad thing.

However most of us have noticed that once you upload a file on those websites it looks worse than the original some time much worst. Why does that happen?

The answer lies in two words video compression.

Video compression is a technical subject and my previous post tried to share some of my finding in regards of the reasons why a camera produces video better than another even if the second produces better still images. It is all in the compression effectiveness and the same issue applies when we share our videos on line.

Unfortunately many people do not really know much about this subject and assume that the video editing program they purchased has all the answers and everything is optimised. Well that is not the case. Video produced off the shelf by such programs with default settings may be watchable but are not great and usually worse than the source clip of a good deal.

Another common misconception is that you need to convert a file produced by your device to another format so you can edit.

Finally many people convert files many times and wonder why the result is far off the original clips, not realising that video compression is lossy so each time you manipulate a clip are you are making things worse.

Obviously am talking consumer and prosumer here not RAW video recording at stellar bitrates.

So what is the best way too produce an underwater clip that looks good without spending too much time on it and that when uploaded on the web looks still decent?

To give an idea why a clip like this one shot with a compact camera

Does not look to far off this other clip shot with a semipro camcorder Sony AX100

or a Panasonic GH4

What all 3 clips at 1080p on youtube and honestly evaluate if there price difference is justified you will probably think no and think the second clip is actually a pro.

So why is that?

50% of the problem comes from the editing, I don’t have the details of how the other two clips are done but I know my clip is edited with iMovie, surely not the most advanced tool on the market you would think.

However there are a few tricks of the trade that I will explain to you one at time:

1. Never let your editor convert the files at the import.

Unless your workstation can’t physically process them leave the clips as in. Even think about getting a better computer in the long run if you can’t process files as is.

Many editors convert the files at import, in intermediate formats like prores or Avid that have no temporal compression. Those files unlike the originals have each frame stored like a complete image so that it is easier to edit. If your editor allows you use the original file without any conversion. You can do this in Final Cut using proxy and cheating also in iMovie creating manually event folders and copying mov or mp4 compliant files manually into them.

2. Once you finish your editing use the highest quality option available for export.

This is sometimes a tricky issue as the default options of those programs mention sometimes just a quality option with a slider from low to best. Many programs though, like final cut offer other options and modules for advanced compression.

If you have spent money on the editor spend the extra funds on the advanced codecs as they are worth every penny.

Once you have the advanced codecs (x264 is the one I use and is free plug in for iMovie) use constant quality with factor of 18 and the slowest preset your workstation can bear.

X264 preset go from very fast to placebo, my workstation can tolerate a very slow for 1080p that applies all the most advanced compression settings. This together with quality at 18 gives me an output very similar to the input but much more efficient with a smaller file.

At this point you are nearly there and ready to upload on vimeo and youtube.

Between the two services which one has the best quality?

Vimeo plain and simple, the same file will look better than youtube with less artefacts at the same resolution, however vimeo requires you to have a plus account to upload and share in 1080p whilst youtube is free.

So this is the reason why your files do not look as good as the clips you shot with the camera when you share them.

Now onto the second part why do clips produced with my very expensive equipment look worse than someone with a much cheaper set up and inferior equipment?

This second problem has to do with the way videos are shot.

Many people look on the internet for guidance on how to produce a video clip that looks decent and are tempted by some esoteric terms such as: flat profiles, colour grading, gamma curves etc etc.

They then go into water with their camera set like they have read on the internet and then spend a long time editing their clips, after all that effort the result image is a bit soft and the colors are washed out.  This seems to be quite a common issue especially with pros.

http://www.peterwalker.com/komodo.html

Note that the two videos above are probably two of my favourites of the last few years. However check the difference between the close up shots with lights or the land shots and the wide angle with natural light? Very different

This instead is an example of someone who knows how to work with the limitation of the set up:

Flat profiles and color grading may work very well when the environment is controlled in a studio situation or where there is plenty of light but in water this is seldom the case. So the best help is to get it right first time and if needed use a filter for your ambient light shots.

Many people including me used to be a white balance evangelist but I have to say with years I have lost interest and I think is greatly overrated.

This video from ikelite is my absolute favourite

The best part is at 0:45 comparing filter with auto white balance and filter with manual white balance. The clips says looks at the purple that comes with the manual white balance but actually that is a horrible hue there!

I have spent the entire 2012-2014 trips trying to perform custom white balance with various cameras, with various degree of success. When I was in Raja Ampat I once left the camera in auto and realised the color where the best I ever got. Though this was a mistake but after few months when I reviewed the clips and how they were taken I realised the truth, even since I have never hit the custom white balance button once on my RX100 and I am preparing to do exactly the same on the GX7.

So my five cents into video editing and doing something decent for sharing on the internet is based around the following key principles:

  1. Get the clip right in camera. Use the settings that make the clip look great at the outset, experiment until you are happy of the results. Forget about theory focus on what you like.
  2. Don’t let your editor alter the clips at all and use no or minimum grading or even try to do no correction at all including contrast and exposure any time the editor touches the clip something is damaged.
  3. Export with advanced settings using all the CPU power you have at hand to produce a high quality but as small as possible file

Good luck for your next trip, I am very much looking forward to mine!

 

Underwater Video Tips: Working with AVCHD 2.0 and 1080p60 or 1080p50 files in iMovie

As hardware becomes more and more powerful video format evolve to allow higher quality capture.

AVCHD is a format that still relied on interlaced video and the classic 24p until version 2.0 where higher frame rate 1080p50 and 1080p60 have become standard with a maximum bit-rate of 28 Mbps.

To date many non linear editing programs are not capable to process such files actually most of the low cost programs are not even able to import those files at all, this is quite frustrating after spending a good amount of money on a camera.

I use iMovie for all my edits as after testing programs like Adobe Premiere I did not really find them to add many benefits to justify the price and I also find them quite slow and counter intuitive so when I got my Sony RX100 I had the issue of processing AVCHD 2.0 files 1080p50.

An AVCHD container is made of streams that have a video and an audio track plus another track of text. The video is encoded in H.264 as other formats like mp4 and the audio is AC3 usually two channels. Usually video editor like files with an H.264 video track and a stereo audio track in AAC or MP3.

So if you re-wrap the information in an mp4 or mov format there is a good chance that a program like iMovie or final cut will digest it.

After various attempts I managed to find on the internet the tools I needed, I will list them here:

  1. LAME for Mp3 encoding (mandatory)
  2. FAAC for AAC encoding (optional but I have it in my build)
  3. FFMPEG
  4. Growl
  5. Clearpipe automator Action
  6. Automator FFmpeg action
  7. MTS2MP4 automator agent

For instruction on how to build your own ffmpeg (as the static builds did not work for me) look here:

http://sesam.hu/2012/09/05/installing-ffmpeg-on-os-x-mountain-lion/

Then install growl version 1.2.2 http://growl.googlecode.com/files/Growl-1.2.2.dmg

Get clearpipe, automator ffmpeg action and the mts2mp4 finder service here http://blog.laaz.org/apps/automator/ and install in sequence.

This creates the option to right click on an MTS file and re-wrap it into an Mp4, note that there are also commercial programs that do this like clipwrap and iVi however our finder service is free and quick…

I have created this little video to show how it works in practice, as you can see it swallows entire folders which is great. So here I create an output folder in the iMovie events folder so that iMovie can edit the 1080p50 file later skipping the import, this means no time is wasted and after generating thumbnails you are ready to edit your original video at high frame rate, a feature ‘officially’ not supported…this is how I edit my video natively in iMovie. If you have a GoPro that saves 1080p50 or 1080p60 mp4 files you can start from the manual creation of an event folder.

From there onwards you can import your double frame rate video into iMovie projects, that will anyway be 24,25,30 frames per second by default but can also exported in 50/60p using x264 decoder that you can find here http://www003.upp.so-net.ne.jp/mycometg3/

This means that you can process with iMovie and also final cut pro 50/60p projects with no problems!

Update for those struggling this is the link where all the files including the ffmpeg build are: https://www.dropbox.com/sh/6m4527odhpw3hcc/nHODxg3_DL I have modified the ffmpeg automator action as I was getting a problem with growl