[FFmpeg-user] tinterlace broken - SAR & DAR wrong

Mark Filipak (ffmpeg) markfilipak at bog.us
Mon Jan 4 23:09:12 EET 2021


On 01/04/2021 03:52 PM, pdr0 wrote:
> Mark Filipak (ffmpeg) wrote
>>   
>>>
>>> You can't interleave images with different dimensions
>>>
>>> Aout has separated fields, to 720x240 , but Bout is 720x480
>>
>> [Bout] is 720x240: I'm using 'mode=send_field' in 'bwdif=mode=send_field',
>> and the following
>> 'decimate' doesn't change that. The problem is that 'tinterleave' is
>> marking the output as "SAR =
>> 16:9" instead of "8:9" (which is what it should be and should never be
>> changed).
> 
> No, [Bout] is 720x480
> 
> bwdif in send_field mode means double rate deinterlacing. 720x480 59.94
> fields per second interlaced input becomes 720x480 59.94 progressive images
> 
> Test it out yourself on the the Bout branch
> ffmpeg -i "INPUT.VOB" -filter_complex "separatefields, shuffleframes=0 1 2 4
> 3 6 5 7 8 9,
> select=eq(mod(n\,10)\,2)+eq(mod(n\,10)\,3)+eq(mod(n\,10)\,6)+eq(mod(n\,10)\,7),
> tinterlace, setsar=sar=8/9, bwdif=mode=send_field:deint=all,
> decimate=cycle=2" -an -c:v libx264 -crf 18 -t 00:00:10 bout.mkv -y

Yes, I knew all that, and bwdif is doing that right thing given what it's told to do. What's wrong 
is with tinterlace. tinterlace is changing SAR from 8:9 to 16:9 before bwdif gets the stream. Adding 
setsar ahead of bwdif can change SAR back to 8:9, but it also changes DAR from 4:3 (which it should 
be) to 8:3 [note 1].

[note 1] setsar has no choice. For a 720x240 picture (i.e. PAR = 6:3), if it changes SAR from 16:9 
(which is wrong) to 8:9 (which is right), then it has to change DAR from 4:3 (which is right) to 8:3 
(which is wrong). The problem is with tinterlace.


More information about the ffmpeg-user mailing list