That may work for a simple media player scenario. What if you are working
with a multitrack composition and need to determine the image format for
frame N where there is potentially a video on each track? Then, you have to
repeat the logic that MLT does to determine which producer of which track
will be used.

A while ago, I worked on something for a client with a similar request. If
you specify format mlt_image_none and set width and height to zero, then
you will get back an image in some mlt_image_format that is closest to
source format (as long as the producer correctly handles mlt_image_none
request format in its get_image function). So, MLT can do the above logic
for you. There should exist similar functionality for mlt_audio_none. To
make this work while continuing to use the "loader" producer, you must
specify to use the "abnormal" to suppress the normalization filters. But,
like I said, once you start using MLT modules' filters and transitions with
this capability, you can expect problems. Also, you must be aware that if
the consumer "real_time" property is not zero, then there are
worker/rendering threads that request an image format. They default to
mlt_image_yuv422, but you can override that with the "mlt_image_format"
property:
https://github.com/mltframework/mlt/blob/master/src/framework/mlt_consumer.c#L475


On Wed, Jul 27, 2016 at 1:01 PM Brian Matherly <c...@brianmatherly.com>
wrote:

> Depending on the producer, you might be able to query the image metadata
> and determine the native format.
>
> For example, the avformat_producer will often set the pix_fmt. Try to
> query "meta.media.0.codec.pix_fmt" on a frame from the avformat producer
> widget.
>
> Perhaps you could query the pix_fmt on the first frame and falllback to a
> default format if it is not set.
>
> ~Brian
>
>
> ------------------------------
> *From:* Paweł Goliński <golp...@gmail.com>
> *To:* mlt-devel@lists.sourceforge.net
> *Sent:* Wednesday, July 27, 2016 11:24 AM
> *Subject:* [Mlt-devel] Avoiding implicit conversions when fetching
> image/audio from frame
>
> Hi,
>
> I want to pass as much of rescaling/resampling/color conversion tasks
> to my consumer as I can. So, when calling, e.g. mlt_frame_get_image()
> for image, I want to use parameters that guarantee the least number of
> implicit
> conversions will take place, as I can take care of them in my consumer.
> What’s
> the best way to do that? Is there some way to ask a „loader" producer to
> produce
> „the most native” frame possible?
>
> Example - when I pass „mlt_image_rgb24a” to mlt_frame_get_image(), the MLT
> loader producer does its best to produce what I want, so on some video
> sources
> there is an implicit y420->rgba conversion. But my consumer could handle
> y420
> as well, so I could avoid this conversion. Question is, how to know which
> format
> to request, to avoid such conversion?
>
>
> Best,
> Paweł
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports.http://sdm.link/zohodev2dev
> _______________________________________________
> 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
>
------------------------------------------------------------------------------
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to