[FFmpeg-user] Decombing via screening - 'tblend' bug (?)
Mark Filipak
markfilipak.windows+ffmpeg at gmail.com
Thu Apr 16 06:27:34 EEST 2020
Hello!
On 04/15/2020 07:13 PM, pdr0 wrote:
> On 04/15/2020 00:25 AM, I wrote:
>> This:
>>
>> ffmpeg -i IN -filter_complex
>> "telecine=pattern=5,split[A][B],[A]select='not(eq(mod(n+1\,5)\,3))'[C],[B]select='eq(mod(n+1\,5)\,3)',split[E][F],[E][F]blend[D],[C][D]interleave"
>> OUT
>>
>> outputs 598 frames. 'blend' outputs as expected.
May I make it plainer?
Filtergraph using 'blend':
IN (240 fr) > telecine (600 fr) > (cont. below)
split#1 [A] > select (480 progressive frames) > [C]
[B] > select (120 combed frames) > [D]
[C] > (480 progressive frames) > interleave (600 fr)
[D] > split#2 > (120 Cframes) > blend (120 fr) >
> (120 Cframes) >
Note: interleave output is actually 598 frames.
>> This:
>>
>> ffmpeg -i IN -filter_complex
>> "telecine=pattern=5,split[A][B],[A]select='not(eq(mod(n+1\,5)\,3))'[C],[B]select='eq(mod(n+1\,5)\,3)',separatefields,scale=height=2*in_h:sws_flags=neighbor,setsar=1,tblend[D],[C][D]interleave"
>> OUT
>>
>> outputs 716 frames. 'tblend' (documented in the same article) outputs extra
>> frames.
Filtergraph using 'tblend':
IN (240 fr) > telecine (600 fr) > (cont. below)
[C] > (480 progressive frames) > interleave (720 fr)
[D] > separatefields (240 fr) > tblend (240 fr) >
Note: interleave output is actually 716 frames.
My point is that 'blend' outputs 120 frames while 'tblend' outputs 240 (actually, 219) frames.
Due to slipshod documentation -- the documentation is combined -- the difference is not noted.
Of course, my complaint began as a bug complaint, not a documentation complaint.
I can live with behavior differences.
> You would expect 719 frame output if you started with a 240 frame, 23.976p
> clip
Sure.
> tblend changes the frame count by -1 . Default mode doesn't appear to do
> anything except drop the original frame zero. When you use all_mode=average,
> it blends adjacent frames. The new frame zero becomes 50/50 mix of (old
> frame 0,1). New frame one becomes a 50/50 mix of (old frame 1,2). You can
> test the filter by itself to verify this
>
> When you separate fields, you have 2 times the number of original frames.
> If you resize them to full height and treat them as frames, you still have 2
> times the number of frames on that selection set
Of course.
> If you started with a 240 frame clip , you should end up with a 600 frame
> clip after that telecine filter only with those settings.
Of course.
> If you take every 5th frame from the telecine output ; 600/5 =120 .
> Separating fields give you 120*2 =240. Applying tblend=all_mode=average
> after gives you 240-1=239 frames. This is [D] .
Of course.
> [C] is the other frame selection set; 600-120=480
>
> Interleaving selection [C] with [D] should give you (600-120) + (240-1) =
> 719
>
> The 716 might be from interleave dropping frames at the end when it hangs.
> Expect it to hang because there is no end-of-stream signal when used with
> select.
>
> https://ffmpeg.org/ffmpeg-filters.html#interleave_002c-ainterleave
You have confirmed everything that I assert. Thank you.
More information about the ffmpeg-user
mailing list