[FFmpeg-user] 1080i AVC-I 100 frame rate conversion

Mark Filipak (ffmpeg) markfilipak at bog.us
Tue Mar 30 20:59:55 EEST 2021


On 2021-03-30 08:40, Bruce Roberts wrote:
> Sorry to keep contradicting myself Mark Filipak, but I'm still wondering if
> perhaps there is something wrong in your shuffle/mix/interleave command
> because to me, having looked once again, ...

"Looked"? Have you run that filter_complex_script? I don't know what a 50Hz TV would do with it, but 
a computer running MPV should be able to play it.

>... the output sequence doesn't appear
> to included any weighted mixes of source frames 1 and 2 or 3 and 4, for
> example. ...

I don't know what frames 1 and 2 or 3 and 4 are. Let me explain my diagrams.

The source frames are
[a_____________________________________][b_____________________________________]
The diagram shows 2, 24000/1001fps frames: [a] followed by [b]. The diagram has 80 characters 
representing 83.4ms (i.e. 2*41.7ms). Thus, the diagram has ~1ms per character.

The 20 frames below (at the same ~1ms per character) are copies of the [a] & [b] frames above that 
have been rearranged by 20 shuffleframes filters. They have differing pad labels because 'a' & 'b' 
have already been used.
[1A5___________________________________________________________________________]
_______][1B2____________________________________________________________________
_______________][1B4____________________________________________________________
_______________________][1B6____________________________________________________
_______________________________][1B8____________________________________________
_______________________________________][1B5____________________________________
_______________________________________________][1A2____________________________
_______________________________________________________][1A4____________________
_______________________________________________________________][1A6____________
_______________________________________________________________________][1A8____
[2A5___________________________________________________________________________]
_______][2A8____________________________________________________________________
_______________][2A6____________________________________________________________
_______________________][2A4____________________________________________________
_______________________________][2A2____________________________________________
_______________________________________][2B5____________________________________
_______________________________________________][2B8____________________________
_______________________________________________________][2B6____________________
_______________________________________________________________][2B4____________
_______________________________________________________________________][2B2____


Each mix filter has 2 inputs and 1 output. There are 10 mix filters.
[1A5][2A5]mix=inputs=2:weights=5 5[A5A5]   ...output is (1A5*5 + 2A5*5)/10
[1B2][2A8]mix=inputs=2:weights=2 8[B2A8]   ...output is (1B2*2 + 2A8*8)/10
[1B4][2A6]mix=inputs=2:weights=4 6[B4A6]   ...output is (1B4*4 + 2A6*6)/10
[1B6][2A4]mix=inputs=2:weights=6 4[B6A4]   ...output is (1B6*6 + 2A4*4)/10
[1B8][2A2]mix=inputs=2:weights=8 2[B8A2]   ...output is (1B8*8 + 2A2*2)/10
[1B5][2B5]mix=inputs=2:weights=5 5[B5B5]   ...output is (1B5*5 + 2B5*5)/10
[1A2][2B8]mix=inputs=2:weights=2 8[A2B8]   ...output is (1A2*2 + 2B8*8)/10
[1A4][2B6]mix=inputs=2:weights=4 6[A4B6]   ...output is (1A4*4 + 2B6*6)/10
[1A6][2B4]mix=inputs=2:weights=6 4[A6B4]   ...output is (1A6*6 + 2B4*4)/10
[1A8][2B2]mix=inputs=2:weights=8 2[A8B2]   ...output is (1A8*8 + 2B2*2)/10
The pixel weights are 2, 4, 5, 6, and 8. Since the scale is not specified, the filter uses 1/(sum of 
weights) which, in every case, is 1/10. There's 2 special cases: (1A5*5 + 2A5*5)/10 & (1B5*5 + 
2B5*5)/10. What they are doing is taking (pixel_value*5 + pixel_value*5)/10 -- in other words, 
pixel_value. Seems like a busy do nothing, eh? I'm doing what seems a silly thing because it makes 
the operation on all the pixels uniform -- and, in fact, if you attempt to interleave [a] & [b] 
directly into the output you'll find it makes everything a lot more complicated.

The output is the 10 mix outputs interleaved.
[A5A5__][B2A8__][B4A6__][B6A4__][B8A2__][B5B5__][A2B8__][A4B6__][A6B4__][A8B2__]

So, as you can see, 2 input frames @24000/1001fps become 10 output frames @120000/1001fps -- that's 
a 2:10 frame rate conversion with 10 pixel value levels.

Your 100fps target would be achieved by the same method but with much bigger numbers. Here's the 
picture:
24fps
[_______________________][_______________________][_______________________][_______________________][_______________________][_______________________]
100fps
[____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____][____]

So, 6 input frames become 25 output frames. The question for you is what do the 25 pairs of 
weightings need to be for the 25 mixers?

The rest of your reply is too cryptic. I don't know what the numbers are.

Regards,
Mark.

>... Have I misunderstood something? I'm not sure if this table will
> help illustrate my question.
> 
> Best regards,
> Bruce.
> 
> Frame indexes (shuffleframes output indexes correspond to the input frame
> indexes)
> Input (24000/1001) 120000/1001 stream [1A5] [2A5] Interleavedoutput [1B2]
> [2A8] Interleavedoutput [1B4] [2A6] Interleavedoutput [1B6] [2A4]
> Interleavedoutput [1B8] [2A2] Interleavedoutput [1B5] [2B5]
> Interleavedoutput [1A2] [2B8] Interleavedoutput [1A4] [2B6]
> Interleavedoutput [1A6] [2B4] Interleavedoutput [1A8] [2B2]
> Interleavedoutput
> 0 0 0 0 0
> 0 1                                     0 1 6
> 0 2                                           0 1 7
> 0 3                                                 0 1 8
> 0 4                                                       0 1 9
> 1 5       1 0 1
> 1 6             1 0 2
> 1 7                   1 0 3
> 1 8                         1 0 4
> 1 9                               1 1 5
> 2 10 2 2 10
> 2 11                                     2 3 16
> 2 12                                           2 3 17
> 2 13                                                 2 3 18
> 2 14                                                       2 3 19
> 3 15       3 2 11
> 3 16             3 2 12
> 3 17                   3 2 13
> 3 18                         3 2 14
> 3 19                               3 3 15
> 4 20 4 4 20
> 4 21                                     4 5 26
> 4 22                                           4 5 27
> 4 23                                                 4 5 28
> 4 24                                                       4 5 29
> 5 25       5 4 21
> 5 26             5 4 22
> 5 27                   5 4 23
> 5 28                         5 4 24
> 5 29                               5 5 25
> 6 30 6 6 30
> 6 31                                     6 7 36
> 6 32                                           6 7 37
> 6 33                                                 6 7 38
> 6 34                                                       6 7 39
> 7 35       7 6 31
> 7 36             7 6 32
> 7 37                   7 6 33
> 7 38                         7 6 34
> 7 39                               7 7 35



More information about the ffmpeg-user mailing list