Skip to content

Commit 8290b25

Browse files
authored
Merge pull request #469 from MobyGamer/deinterlace_updates
Update deinterlacing methods to current best practices
2 parents dada53d + 5333403 commit 8290b25

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

img/deinterlaced_video_frames.png

741 KB
Loading

img/interlaced_video_fields.png

422 KB
Loading

index.html

+37
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,43 @@ <h2>Example</h2>
14091409
</div>
14101410
<!-- ends Deinterlace video -->
14111411

1412+
<!-- Deinterlace video fields -->
1413+
<label class="recipe" for="deinterlace_fields">Deinterlace video fields to frames</label>
1414+
<input type="checkbox" id="deinterlace_fields">
1415+
<div class="hiding">
1416+
<h5>Deinterlace video fields to frames</h5>
1417+
<p><code>ffmpeg -i <em>input_file</em> -c:v libx264 -vf "idet,bwdif,format=yuv420p" <em>output_file</em></code></p>
1418+
<p>This command takes an interlaced input file and outputs a deinterlaced H.264 MP4, with each field separated into its own frame. This is preferred for interlaced video that contains a lot of motion, as the double-rate output preserves the visual cadence of the source material.</p>
1419+
<dl>
1420+
<dt>ffmpeg</dt><dd>starts the command</dd>
1421+
<dt>-i <em>input file</em></dt><dd>path, name and extension of the input file</dd>
1422+
<dt>-c:v libx264</dt><dd>tells FFmpeg to encode the video stream as H.264</dd>
1423+
<dt>-vf</dt><dd>video filtering will be used (<code>-vf</code> is an alias of <code>-filter:v</code>)</dd>
1424+
<dt>"</dt><dd>start of filtergraph (see below)</dd>
1425+
<dt>idet</dt><dd>detect interlaced video field order<br>
1426+
<a href="https://ffmpeg.org/ffmpeg-filters.html#idet" target="_blank">idet</a> will try to detect if the video is interlaced, and if so, what the order of the fields are (top-field-first, or bottom-field-first). This is done to ensure the output of the deinterlacing filter is correct.</dd>
1427+
<dt>bwdif</dt><dd>deinterlacing filter (‘Bob Weaver Deinterlacing Filter’)<br>
1428+
By default, <a href="https://ffmpeg.org/ffmpeg-filters.html#bwdif-1" target="_blank">bwdif</a> will output one frame for each field, matching the visual cadence of interlaced video. </dd>
1429+
<dt>,</dt><dd>separates filters</dd>
1430+
<dt>format=yuv420p</dt><dd>chroma subsampling set to 4:2:0<br>
1431+
By default, <code>libx264</code> will use a chroma subsampling scheme that is the closest match to that of the input. This can result in Y′C<sub>B</sub>C<sub>R</sub> 4:2:0, 4:2:2, or 4:4:4 chroma subsampling. QuickTime and most other non-FFmpeg based players can’t decode H.264 files that are not 4:2:0, therefore it’s advisable to specify 4:2:0 chroma subsampling.</dd>
1432+
<dt>"</dt><dd>end of filtergraph</dd>
1433+
<dt><em>output file</em></dt><dd>path, name and extension of the output file</dd>
1434+
</dl>
1435+
<p><code>"idet,bwdif,format=yuv420p"</code> is an FFmpeg <a href="https://trac.ffmpeg.org/wiki/FilteringGuide#FiltergraphChainFilterrelationship" target="_blank">filtergraph</a>. Here the filtergraph is made up of one filter chain, which is itself made up of the three filters (separated by the comma).<br>
1436+
The enclosing quote marks are necessary when you use spaces within the filtergraph, e.g. <code>-vf "idet, bwdif, format=yuv420p"</code>, and are included above as an example of good practice.</p>
1437+
<p><strong>Note:</strong> bwdif also supports the older method of outputting one frame for each frame (thereby halving the number of output frames per second) with the syntax <code>bwdif=mode=send_frame</code>. This can be used when the presentation device is not capable of reproducing 50 (PAL) or 60 (NTSC) frames per second.</p>
1438+
<p>For more H.264 encoding options, see the latter section of the <a href="#transcode_h264">encode H.264 command</a>.</p>
1439+
<div class="sample-image">
1440+
<h2>Example</h2>
1441+
<p>Before and after deinterlacing with bwdif:</p>
1442+
<img src="img/interlaced_video_fields.png" alt="VLC screenshot of original interlaced video">
1443+
<img src="img/deinterlaced_video_frames.png" alt="VLC screenshot of deinterlaced video">
1444+
</div>
1445+
<p class="link"></p>
1446+
</div>
1447+
<!-- ends Deinterlace video fields -->
1448+
14121449
<!-- Inverse telecine -->
14131450
<label class="recipe" for="inverse-telecine">Inverse telecine</label>
14141451
<input type="checkbox" id="inverse-telecine">

0 commit comments

Comments
 (0)