[FFmpeg-devel] [PATCH] vf_scale: Detecting changes of incoming frame properties and dinamically evaluate width and height expressions

Bodecs Bela bodecsb at vivanet.hu
Tue Jan 19 22:08:26 CET 2016



2016.01.19. 21:42 keltezéssel, Paul B Mahol írta:
> On 1/19/16, wm4 <nfxjfg at googlemail.com> wrote:
>> On Tue, 19 Jan 2016 19:00:18 +0100
>> Bodecs Bela <bodecsb at vivanet.hu> wrote:
>>
>>> 2016.01.19. 16:53 keltezessel, Carl Eugen Hoyos irta:
>>>> Bodecs Bela <bodecsb <at> vivanet.hu> writes:
>>>>
>>>>> To retain the current behaviour and not to break any
>>>>> earlier app, a new config parameter has been introduced.
>>>> Is the current behaviour useful or do you consider it a bug?
>>> First I thought that it was a bug, but I borrowed an idea from
>>> vf_overlay filter, where there is a very same config parameter causing a
>>> very similar behaviour distinction on expression evaluation.
>>> I will soon post a patch to vf_overlay where there was really a bug in
>>> this behaviour.
>> I think it's actually a bug. From what I can tell libavfilter's design
>> doesn't actually support mid-stream reconfiguration, although it
>> happens to work in some cases?
> It appears it's undocumented feature. Filter which changes parameters just calls
> avfilter_config_links().
>
> But not all filter have been tested with this in mind.
Working with mpeg-ts streams this feature is very usefull.
I have tested vf_scale and vf_overlay, both of them work well now.
This is the scenario where I use them:
You have an mpeg-ts incoming stream and you transcode it to hls with a 
scaled down resolution.
The incoming stream has constant PAL width and height but the aspect 
ratio regularly changes between 4/3 and 16/9 in the middle of the stream.
But you want to create a 16/9 output with constant width/height 
regardless of incoming aspect ratio. In the 4/3 case you put black bars 
to both sides of screen.
With my two recent patch - regarding vf_scale and vf_overlay - it is 
possible.
Cascade the vf_scale and the vf_overlay filters.
First you create a fix height but variable width output with vf_scale 
and than you overlay its output onto a fixed sized 16/9 black 
background, positioned dynamically to the center by vf_overlay.
In case of incoming 16/9 a.r., the whole background will be covered by 
the usefull content and in case of 4/3 a.r. the usefull content only 
partially will cover the black background.
These options were almost ready in these filters.
(I know the padding filter would do the same job, but it lacks a dynamic 
frame-by-frame pad sizing feature)

bb
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list