"transparent" is not a valid color name:  See
https://mltframework.org/plugins/ProducerColor/
It just so happens to work though since it tries to convert the string to
an int resulting in 0, which is equivalent.

The higher order track gets priority when using multitrack, and there is no
automatic blending or mixing of audio.
But the workaround does not need to be so heavy as to require blending with
transparent. Why does Flowblade, Shotcut, and Kdenlive not suffer from this
problem? I am quite certain this used to work in melt without multiple
tracks - probably before the audio pipeline became more powerful and
flexible. These apps automatically add track mixers and include a hidden,
silent, black track:
melt -track color out=75 -track color:red in=0 out=25 -blank 25 color:blue
in=0 out=25 -transition mix -consumer avformat:test.mp4

Now, how can it work without that? The default sample format in MLT is
signed 16-bit (as produced in mlt_frame_get_audio() for frames with dummy
audio). However, avformat consumer tries to render using the selected
codec's default sample format (at some point it did not). The implied codec
of test.mp4 is aac, which is float (mlt_audio_f32le). If we instead change
the audio codec to pcm_s16le and the filename extension to .mov (pcm is not
supported in MP4 by standards and ffmpeg), then it succeeds:
melt color:red in=0 out=25 -blank 25 color:blue in=0 out=25 -consumer
avformat:test.mov acodec=pcm_s16le

In any case, if you play this back you see white frames in between the
colors red and blue. That brings up another point: is that what you expect
in "blank?" In MLT the dummy image for frames is solid white. This was
chosen to facilitate troubleshooting because it should be generally
avoided, and black is too easily overlooked. That is why most MLT apps are
mixing with a silent black track - to explicitly give users black when they
expect it.

I found you are working on your own new video editor
<https://rickardlindberg.me/writing/writing-my-own-video-editor/>. You are
free to do whatever you want, but I do encourage you to work with one of
the existing projects. I do not want to speak for Brian, but he and I make
Shotcut.


On Mon, Jul 24, 2023 at 4:02 AM Brian Matherly via Mlt-devel <
mlt-devel@lists.sourceforge.net> wrote:

> Yeah. That is a good point. You would need to add a transition so that the
> transparent is blended with the red. I guess it is not a perfect work
> around.
>
> ~Brian
>
>
> On Monday, July 24, 2023 at 12:17:45 AM CDT, Rickard Lindberg <
> rick...@rickardlindberg.me> wrote:
>
>
> Hmm.
>
> Do I need to add some kind of transition for the transparent color to have
> any effect?
>
> I expected both of these to generate 100 (or 101?) red frames:
>
> $ mlt-melt -track color:red in=0 out=100 -track color:transparent in=0
> out=100
> $ mlt-melt -track color:transparent in=0 out=100 -track color:red in=0
> out=100
>
> But the first one only shows black frames for me.
>
> /Rickard
>
> On Mon, Jul 24, 2023, at 06:48, Rickard Lindberg wrote:
>
> Thanks for your support! This workaround works fine for me.
>
> /Rickard
>
> On Sun, Jul 23, 2023, at 00:22, Brian Matherly wrote:
>
>
> > mlt-melt color:red in=0 out=25 -blank 25 color:blue in=0 out=25
> -consumer avformat target=/tmp/export.mp4
>
> Thanks for the example command. I reproduce this and I confirm it is a
> bug. I have filed it here:
> https://github.com/mltframework/mlt/issues/931
>
> As a workaround, you can use transparent clips instead of blank:
> mlt-melt color:red in=0 out=25 color:transparent in=0 out=25 color:blue
> in=0 out=25 -consumer avformat target=/tmp/export.mp4
>
> ~Brian
>
>
> On Friday, July 21, 2023 at 04:30:59 AM CDT, Rickard Lindberg <
> rick...@rickardlindberg.me> wrote:
>
>
> I managed to reproduce the problem with melt:
>
> $ mlt-melt color:red in=0 out=25 -blank 25 color:blue in=0 out=25
> -consumer avformat target=/tmp/export.mp4
> +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
> |1=-10| |2= -5| |3= -2| |4= -1| |5=  0| |6=  1| |7=  2| |8=  5| |9= 10|
> +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
> +---------------------------------------------------------------------+
> |               H = back 1 minute,  L = forward 1 minute              |
> |                 h = previous frame,  l = next frame                 |
> |           g = start of clip, j = next clip, k = previous clip       |
> |                0 = restart, q = quit, space = play                  |
> +---------------------------------------------------------------------+
> [libx264 @ 0x7fe9d80023c0] interlace + weightp is not implemented
> [mp4 @ 0x7fe9d8000f40] Using AVStream.codec to pass codec parameters to
> muxers is deprecated, use AVStream.codecpar instead.
> [mp4 @ 0x7fe9d8000f40] Using AVStream.codec to pass codec parameters to
> muxers is deprecated, use AVStream.codecpar instead.
> [aac @ 0x7fe9d8004e40] Input contains (near) NaN/+-Inf
> [consumer avformat] error with audio encode: -22 (frame 28)
> [aac @ 0x7fe9d8004e40] Input contains (near) NaN/+-Inf
> [consumer avformat] error with audio encode: -22 (frame 28)
> [aac @ 0x7fe9d8004e40] Input contains (near) NaN/+-Inf
> [consumer avformat] error with audio encode: -22 (frame 29)
> [aac @ 0x7fe9d8004e40] 5 frames left in the queue on closing
> Current Position:         28
>
> /Rickard
>
> On Fri, Jul 21, 2023, at 10:44, Rickard Lindberg wrote:
>
> If I attach the audioconvert filter like this, the export works:
>
>     playlist.attach(mlt.Filter(profile, "audioconvert"))
>
> When loading the xml, this filter seems to be attached automatically,
> along with avcolor_space. But it is not set for the playlist that I create.
>
> Should I wrap my playlist in something so that the loader can do its
> thing? Or should I add these filters manually?
>
> /Rickard
>
>
> On Thu, Jul 20, 2023, at 22:19, Rickard Lindberg wrote:
>
> I tried to generate an XML file using the "xml" consumer and got this:
>
> <?xml version="1.0"?>
> <mlt LC_NUMERIC="C" version="6.26.1" producer="playlist0">
>   <profile description="DV/DVD PAL" width="720" height="576"
> progressive="0" sample_aspect_num="16" sample_aspect_den="15"
> display_aspect_num="4" display_aspect_den="3" frame_rate_num="25"
> frame_rate_den="1" colorspace="601"/>
>   <producer id="producer0" in="0" out="14999">
>     <property name="length">15000</property>
>     <property name="eof">pause</property>
>     <property name="resource">red</property>
>     <property name="aspect_ratio">1.06667</property>
>     <property name="mlt_service">color</property>
>   </producer>
>   <producer id="producer1" in="0" out="14999">
>     <property name="length">15000</property>
>     <property name="eof">pause</property>
>     <property name="resource">green</property>
>     <property name="aspect_ratio">1.06667</property>
>     <property name="mlt_service">color</property>
>   </producer>
>   <playlist id="playlist0">
>     <entry producer="producer0" in="0" out="25"/>
>     <blank length="26"/>
>     <entry producer="producer1" in="0" out="25"/>
>   </playlist>
> </mlt>
>
> Melt seems to be able to render this just fine using
>
> mlt-melt test.xml -consumer avformat target=export.mp4 acodec=aac
>
> So my guess is that I need to do something different in my code. Question
> is what...
>
> /Rickard
>
> On Thu, Jul 20, 2023, at 22:16, Brian Matherly wrote:
>
>
> Your MLT is over 2 years old. Can you try with a newer version?
>
> Also, it would be helpful to reproduce with a melt command so that others
> can easily recreate the problem.
>
> ~Brian
>
>
> On Thursday, July 20, 2023 at 03:00:45 PM CDT, Rickard Lindberg <
> rick...@rickardlindberg.me> wrote:
>
>
> Hi,
>
> I'm having trouble exporting a playlist that contains blanks. Here is a
> small
> program to reproduce the problem:
>
>     mlt.Factory().init()
>     profile = mlt.Profile()
>     playlist = mlt.Playlist()
>     playlist.append(mlt.Producer(profile, "color:red"), 0, 25)
>     playlist.blank(25)
>     playlist.append(mlt.Producer(profile, "color:green"), 0, 25)
>     consumer = mlt.Consumer(profile, "avformat")
>     consumer.set("target", "export.mp4")
>     consumer.connect(playlist)
>     consumer.start()
>     while consumer.is_stopped() == 0:
>         time.sleep(1)
>
> The output:
>
>     [libx264 @ 0x7f61740023c0] interlace + weightp is not implemented
>     [mp4 @ 0x7f6174000f40] Using AVStream.codec to pass codec parameters
> to muxers is deprecated, use AVStream.codecpar instead.
>     [mp4 @ 0x7f6174000f40] Using AVStream.codec to pass codec parameters
> to muxers is deprecated, use AVStream.codecpar instead.
>     [aac @ 0x7f6174004e40] Input contains (near) NaN/+-Inf
>     [consumer avformat] error with audio encode: -22 (frame 28)
>     [aac @ 0x7f6174004e40] Input contains (near) NaN/+-Inf
>     [consumer avformat] error with audio encode: -22 (frame 28)
>     [aac @ 0x7f6174004e40] Input contains (near) NaN/+-Inf
>     [consumer avformat] error with audio encode: -22 (frame 29)
>     [aac @ 0x7f6174004e40] 5 frames left in the queue on closing
>
> Without
>
>     playlist.blank(25)
>
> the export works fine.
>
> I assumed that if no producer exist to produce sound, silence will be
> used. Is
> that assumption wrong? Do I need to insert a producer for silence? Or is
> this
> an issue with the aac encoder?
>
> Versions:
>
>     mlt: 6.26.1
>     ffmpeg: 4.4.1
>
> /Rickard
>
> _______________________________________________
> 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
>
>
>
>
> _______________________________________________
> 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