Thanks Brian.

My use case is explained in my prior message,
https://sourceforge.net/p/mlt/mailman/message/37413387/

As I said, what I am aiming for is for creating functions where I can
compose what I do with videos. My final profile will be something standard:
16:9 720p or 1080p with 25 or 50 fps. But I am looking for some freedom
about how I create intermediate videos in the process. For example, I load
a video (720x360 16:9). I stack them vertically (so I get 720x720 16:18).
I'd like this to be feel by the consumer as complete new video with that
information (720x720 16:18) so that I can add it to the final consumer with
the standard profile (lets say 720p and 16:9), but the "original" video
(720x720 16:18) is properly rescaled.

Let me show with an example, the sort of problems that I am facing. The
following code:
1. Loads twice the same video
2. Applies grayscale to one of them
3. Stack both videos vertically returning the tractor's producer in this
example
4. I aim to show it with the profile: hdv_720p_25
```nim
import mlt

proc main =
var f = initFactory()
var p = newProfile()

var v1 = p.newMedia("./resources/big_buck_bunny_360p.mp4")

var v2 = p.newMedia("./resources/big_buck_bunny_360p.mp4")
var gray = p.newFactoryFilter("grayscale")
v2.attach(gray)

# Call the function to stack vertically two videos.
var v = stackVertically( v1, v2 )
# Consumer using the new calculated profile
var profile = newProfile("hdv_720p_25")
var sdl = profile.newFactoryConsumer( "sdl2" )
sdl["terminate_on_pause"] = 1

# From tractor to SDL2
v > sdl
# Start the consumer
sdl.run

main()
```

The result is: https://i.imgur.com/b5ASEJg.png
where the videos are properly stacked, but the profile for SDL (720p 16:9)
is not honored as I would expect.

For sure this is due to my poor understanding of profile's behavior. I'd
like to apply the target profile at the very end of the process.






El vie, 7 ene 2022 a las 3:00, Brian Matherly (<brian.mathe...@yahoo.com>)
escribió:

> I would suggest:
>
> 1) Create a producer to open V1 (it does not matter the profile)
> 2) Query V1 for the size
> 3) Close V1 (delete the producer)
> 4) Create a producer to open V2 (it does not matter the profile)
> 5) Query V2 for the size
> 6) Close V2(delete the producer)
> 7) Calculate the profile that you want based on the size you queried from
> V1 and V2
> 8) Create a profile with the new calculated profile
> 9) Proceed to create producers, tractors and consumers all using the same
> profile
>
> I do not understand the use case you are working under. Typically people
> have a target profile that is driven by the device, platform, quality or
> player that the file will be used on. And then they work everything else to
> fit within that profile. But your profile is being calculated from
> arbitrary sized sources. Maybe this does not apply to you because any
> non-standard profile will work for you. But this is uncommon in my
> experience.
>
> ~Brian
>
>
> On Thursday, January 6, 2022, 03:53:40 AM CST, José María García Pérez <
> josemaria.alk...@gmail.com> wrote:
>
>
> Right now, when I stack videos vertically, I output the Tractor and the
> Profile: "tuple[tr:Tractor; p:Profile] "
> proc stackVertically*( v1,v2:Producer ):tuple[tr:Tractor; p:Profile]
>
> Later I apply the returned profile to the consumer:
> # Call the function to stack vertically two videos.
> # The tractor and new profile are returned
> var (newProducer, profile) = stackVertically( v1, v2 )
> # Consumer using the new calculated profile
> var sdl = profile.newFactoryConsumer( "sdl2" )
> sdl["terminate_on_pause"] = 1
>
> # From tractor to SDL2
> newProducer > sdl
>
> What I would like to do is to apply the profile to the tractor. Like
> moving the consumer within the stackVertically function and then using that
> consumer as a producer.
>
> I see that there is this plugin to use a consumer as a producer:
> https://www.mltframework.org/plugins/ProducerConsumer/
>
> but it is not very clear how I should use it and if it is appropriate for
> this purpose.
>
> On the other hand, I wonder if I should get the producer from the tractor
> and set "width", "height", "aspect_ratio". I am trying this last option
> without success.
>
> Any suggestion is welcomed.
>
> _______________________________________________
> Mlt-devel mailing list
> Mlt-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mlt-devel
>
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to