On Tue, Nov 28, 2023 at 12:48 PM Iza i Tomek <izato...@gmail.com> wrote:
> I use melt 7.4.0, which came with my Linux Mint. > > I'm not sure whether I found a bug, a feature ;-) but I found it > very strange. > > I use MLT with XML (mlt) files, and some presents in dv_custom file. > What exactly is "dv_custom" file? If presets, for what? If a "profile" in the manner in which MLT uses that terminology, how are you supplying it? > > Let's assume I'd like to make a movie with an image and an audio. I > have two separate files: one PNG, and one m4a (audio). Here's my XML > file: > > <mlt> > This XML is missing a <profile> element. > <producer id="audio" resource="file.m4a" /> > <producer id="img" resource="file.png" /> > > <playlist id="clip-video"> > <entry producer="img" in="0" out="500" /> > </playlist> > > <playlist id="clip-audio"> > <entry producer="audio" in="10000" out="10500" /> > These time values are frame counts. But actual time depends on the frame rate in the consumer or profile. > </playlist> > > <tractor id="track"> > <multitrack> > <track producer="clip-video" /> > <track producer="clip-audio" /> > </multitrack> > </tractor> > > </mlt> > > It can be rendered to mp4 with the command: > > melt file.xml -consumer avformat:"video.mp4" acodec=aac vcodec=libx265 \ > width=1280 height=720 frame_rate_num=30 frame_rate_den=1 frequency=48000 > \ > OK, here is your explicit frame rate: 30 fps. > progressive=1 display_aspect_num=16 display_aspect_den=9 \ > sample_aspect_num=1 sample_aspect_den=1 > > And the produced video.mp4 file is fine. > > When I use SDL consumer, though: > > melt file.xml > You have not provided a profile or consumer frame rate properties. Thus, melt tries to guess. But since none of your media has a frame rate (video does), it falls back to using the 25 fps in the dv_pal profile. > > the audio is out-of-sync with the clip-audio specified in the XML file. > > Be careful with the term "sync" as that implies the relative timing of multiple things such as audio and video. How do you know there is a synchronization problem between audio and a still image? Maybe you mean the "timing" for the audio producer is incorrect. Remember, frame units depend on frame rate. > I have found a weird workaround for that problem, though. When I make > a short video sequence from the PNG file: > > melt file.png out=30 -consumer avformat:"file.mp4" vcodec=libx265 \ > width=1280 height=720 frame_rate_num=30 frame_rate_den=1 \ > progressive=1 display_aspect_num=16 display_aspect_den=9 \ > sample_aspect_num=1 sample_aspect_den=1 > > and use a single frame from this video in XML file, instead of PNG > file producer: > > <mlt> > <producer id="audio" resource="file.m4a" /> > <producer id="frame-workaround" mlt_service="hold" resource="file.mp4" > frame="1" /> > > <playlist id="clip-video"> > <entry producer="frame-workaround" in="0" out="500" /> > </playlist> > > <playlist id="clip-audio"> > <entry producer="audio" in="10000" out="10500" /> > </playlist> > > <tractor id="track"> > <multitrack> > <track producer="clip-video" /> > <track producer="clip-audio" /> > </multitrack> > </tractor> > > </mlt> > > everything is fine in both rendered video.mp4, and in the SDL > preview/consumer. > > Now, the melt command line utility has a video with a frame rate to guess that the sdl(2) consumer should run at 30 fps and timing information in the XML that uses frame values is based on 30 fps. > Is it a problem with SDL consumer, or am I doing something wrong? > Put a named "profile" attribute in the <mlt> element or place a <profile> element as the first child of the <mlt> element. I am sorry that our documentation is a little weak in this area by not mentioning XML on the profiles page or profile on the XML page. However, if you use any tool that uses MLT and generates XML (including `melt -consumer xml ...` or Shotcut), then you would have seen that.
_______________________________________________ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel