Video Interlacing Analysis
Hybrik can analyze your video content to determine if it has interlaced frames. Some reasons why you may want to perform this type of analysis are:
- [Case 1 - see below] You need to know if a deinterlace filter should be applied during a
transcode
of this source asset to produce a progressive scan video output. - [Case 2 - see below] You need to verify that the metadata for a file matches the actual video interlacing.
The image below shows an example of interlacing, sometimes also referred to as combing. When present, it is most visible in scenes which have objects moving horizontally across the screen, or when the camera pans from one side to the other. Interlacing is most often seen in older content that was shot on video at 29.97fps or 25fps, or older film content that was converted to video.
Sample Usage
The sample json below shows an analyze
task that is set to detect interlaced video.
{
"uid": "analyze_task",
"kind": "analyze",
"payload": {
"general_properties": {
"enabled": true
},
"deep_properties": {
"video": {
"interlacing": {
"enabled": true
}
}
}
}
}
Analyzer Results
Results from running this analysis on a file will be reported in the job summary json, in the “analyzer / deep_properties” section of the job result json:
{
"deep_properties": {
"video": {
"interlacing": {
"tff": 1771,
"bff": 0,
"progressive": 0,
"undetermined": 27,
"interlacing_ratio": 1,
"is_4th_frame_telecined": false,
"is_3_2_telecined": false
}
}
}
}
Case 1
If your goal is to produce a progressive output from any video source - without knowing if interlacing is present in the video - you can set a deinterlace filter on your target that uses a conditional operator to decide if the filter is applied. In other words, if the analyze task results indicate that the source video does contain interlacing, then the deinterlace filter is applied in the transcode. If not, the filter is not applied.
The condition in this case will include the deinterlace filter if the ratio of interlaced frames detected is above 20%.
analyzer.deep_properties.video.interlacing.interlacing_ratio > 0.2
This example job shows how to make use of this analysis information in a transcode task video filter.
Case 2
A common pattern would be to analyze for interlacing and set your target to match. This example job shows how to make use of this analysis information in a transcode task. In the video settings of the transcode task, an overrides
object is used to control which interlace_mode
setting is applied to the output video. The expression is made to reference the results from the previous analyze task, and then decide which of the three modes should be applied to the output’s metadata.
JSON Snippet using Override based on the Source:
{
"video": {
"codec": "prores",
"profile": "apco",
"width": 960,
"height": 540,
"interlace_mode": "progressive",
"overrides": {
"interlace_mode": "analyzer.deep_properties.video.interlacing.interlacing_ratio > 0.9 ? (analyzer.deep_properties.video.interlacing.bff > analyzer.deep_properties.video.interlacing.tff ? 'bff' : 'tff') : 'progressive'"
}
}
}
The expression above is a ternary operator from the world of programming. It’s simple syntax looks like this:
condition ? true : false
In the above statement we are combining 2 statments with the following pseudocode:
if the video is 90% or more interlaced:
if the video is more bottom field first interlaced:
set the transcode to 'tff'
else:
set the transcode to 'bff'
else:
set the transcode to 'progressive'
An important point to be aware of is that the interlace_mode
setting does not affect the processing of the video itself. It only sets the value in the file’s metadata. To convert a video, you will need to use an deinterlace
video filter to go from interlaced to progressive or use a telecine
filter to go from progressive to interlaced.