Transcoding to fast decode AVC for timeline edit performance
EDIT: Now that Hitfilm has hardware decode for typical AVC (8-bit 4:2:0) the exact AVC settings for fast decode performance are not as important. Either way, it always works well.
As typically encoded, AVC has a high decode overhead. AVC is commonly found in MP4 and MOV file containers. Most cameras like DSLRs, digicams, action cameras, phones and web cams encode to a higher overhead AVC. AVC can be encoded to a lower overhead configuration.
I created some settings using the x264 AVC/H.264 encoder that creates files that have much better decode performance in your editor. Those settings are duplicated and scattered about this forum. Lets just say this is the "official" thread on the topic.
Fast decode AVC (Norman AVC) will not perform as well as things like Cineform, DNxHD/HR or Prores in quickly scrubbing the timeline back and forth. However, it is not too far off. It does perform quite well in Hitfilm in most other aspects.
What it does offer is much smaller file sizes that those intermediate codecs. GoPro/action cam users and video game users can end up with very long and thus large video files. Most of which gets edited out. If you have a 3GB file and transcode to one of these intermediates you can end up with a 12GB file. That can be a lot of backup. This low overhead AVC provides an alternative with very good performance.
I use ffmpeg (free), a technical command line tool, to do these fast decode AVC conversions. The Handbrake (free) utility is a nice GUI for something with a user interface to do these transcodes.
Here is a screenshot of Handbrake settings. Video tab.
Critical items to set are checking the "fast decode" option and the extra options "keyint=8:bframes=0".
Encoder Profile = High and Encoder Level = auto. Medium preset and constant quality of 20.
H.264(x264) video codec. Framerate, constant. Framerate -> "same as source". If you are transcoding variable framerate media then you need to select the target frame rate.
The constant quality setting is something that is debatable. For me 20 seems fine and compares favorably to common intermediate codecs. Smaller x264 quality value/settings generate larger files. Those who more concerned about quality loss in the transcode might try a value of 17. It's a little more conservative than 20. Moving by values of 3 will give large reasonable bitrate differences and greater chance of seeing any difference. Choosing smaller values most certainly increases quality retention but while software/machines can measure the difference, can you actually see any difference (human eyes watching a video).
Remember we are transcoding to increase editing performance. With the same settings (aka fast decode) then smaller files will decode faster.
Also, remember that with the constant quality setting we have no idea what the result bitrate of our video will be. If you transcode a talking head type interview the bitrate can be shockingly low but the quality is the still the same as a first person moving, shaking jiggling camera like a GoPro mounted to a mountain bike that has 10 times the bitrate.
In something like the talking head, or a Hitfilm video tutorial, the video encoder is finding lots of static and/or predictable movement of objects and this stuff compresses, for lack of a better word, visually "perfectly". The encoder encodes it once and just copies the static or predictable movement to the next frames. In my example, the bike video does not get much of this so the encoder has to encode nearly whole frames for every frame.
The Medium encoder preset is the x264 default and affects encoder speed and file size some. You can try Fast or Faster if you want to experiment. They will not speed things up as much as you think, do to the fast decode settings turning various things off.
Here is a screenshot of the audio tab. Choose AAC audio and a bitrate of 192.
After you have these items setup you can save a Handbrake preset to easily set all these separate settings the next time you do a transcode. In the screenshots you can see I have a "fast decode" user preset created.
If your video is not interlaced you can turn off interlacing in the filters tab. Normally the auto detection handles this properly. Turning it off is even safer.
Here is a link for a ZIP file with a set of fast decode AVC ffmpeg windows scripts. These are the ones that I created for my use. The ZIP file has a readme with some instructions. These scripts allow drag and drop of media files onto them to easily transcode files. You can also put a shortcut link to them in your "SendTo" menu item for easy use. Any questions, post them in this thread.
A short video demoing how the ffmpeg scripts can be used. Drag and drop and via SendTo.
For tech heads only. What is the fast decode doing? AVC is a very large and feature rich video codec. It is designed to be capable of high compression (low bitrates like Youtube) and still retain reasonable quality. All these fancy features take time for the encoder to compute what to use and when, where and how to use each feature. There are some AVC features that do affect the video decoder speed. It is these that we are turning off.
CABAC. This is a lossless encoder used in the spec. It saves about 14% over the CAVLC encoder also in the spec. However, CABAC is very compute intensive to decode. This is the biggest decode speed boost of the fast decode settings.
Loop deblocking filter. This really comes in and is designed for low bitrates. At high bitrates it really does little/nothing to the image. Generally you may not want this off, but with high bitrate intermediate/edit files you are unlikely to miss it. Most editors that have a draft/preview mode are turning this off in those modes to boost their performance. Hitfilm has no such mode. Keeping the bitrate high effectively neutralizes the function of the filter and we want high bitrates because we want to preserve the quality of our source media.
We turn b-frames off. I don't know if this really helps or how much but we are simplifying the video frame stream to make it more like an All-I frame codec. Also, it does speed up the transcode process and that is nice. Temporal compression (inter frame) can still be effectively utilized with P-frames. Finding temporal compression does reduce resultant bitrate.
keyint=8. This creates a very short GOP. Group of pictures. This speeds up timeline scrubbing, especially backwards, and seeking to specific frames in the file (like timeline thumbnails).
There are some items I don't understand so I will just mention them in passing. Weighted P-frames and weighted B-frames off.