了解/控制MLT融化幻灯片显示吗? [英] Understanding/controlling MLT melt slideshow?

查看:154
本文介绍了了解/控制MLT融化幻灯片显示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下bash脚本(在Ubuntu 18.04,melt 6.6.0上),该脚本使用melt制作幻灯片并在窗口(SDL使用者)中本地播放,主要从 https://superuser.com/questions/833232/create-video-with-5-images-with-fadein-out-effect-in-ffmpeg/834035#834035 -但是这种方法似乎可以在转换过程中缩放图像,并且需要在SDL窗口中播放之前需要相当长一段时间才能渲染",而这个几乎可以即时播放):

Consider the following bash script (on Ubuntu 18.04, melt 6.6.0), which uses melt to make a slideshow and play it locally in a window (SDL consumer), mostly copied from https://mltframework.org/blog/making_nice_slideshows/ ( edit: I'm aware that's its possible to specify files individually as in https://superuser.com/questions/833232/create-video-with-5-images-with-fadein-out-effect-in-ffmpeg/834035#834035 - but that approach seems to scale images during transition, and takes quite a while to "render" before playing in SDL window, while this one has nearly instant playback):

echo "
description=DV PAL
frame_rate_num=25
frame_rate_den=1
width=720
height=576
progressive=0
sample_aspect_num=59
sample_aspect_den=54
display_aspect_num=4
display_aspect_den=3
colorspace=601
" > my-melt.profile

mkdir tmppics
convert -background lightblue -fill blue -size 3840x2160  -pointsize 200  -gravity center label:"Test A" tmppics/pic_01.jpg
convert -background lightblue -fill blue -size 3840x2160  -pointsize 200  -gravity center label:"Test B" tmppics/pic_02.jpg

melt -verbose -profile ./my-melt.profile \
./tmppics/.all.jpg ttl=6 \
-attach crop center=1 \
-filter luma cycle=6 duration=4 \
-consumer sdl

  • 当我运行上面的命令时,视频显示了两个图像循环,但是帧计数器持续运行,并且无限增加.如何使它在循环很长的确切帧数后停止?
  • 据我所知,输出视频的大小由配置文件控制;也就是说,即使我未指定-profile,也会采用默认值;正确吗?
  • 原始图像如下:
    • When I run the above command, the video shows the two images loop, but the frame counter keeps on going, increasing indefinitely. How do I make it stop after the exact amount of frames that the loop is long?
    • As far as I can see, the size of the output video is controlled by a profile; that is, even if I don't specify -profile, a default one is assumed; is that correct?
    • The original images look like this:
    • ...,视频看起来像这样:

      ... and the video looks like this:

      ...这意味着长宽比是错误的;此外,我还能看到锯齿状的边缘,这意味着视频中缩放后的图像没有抗锯齿.

      ... which means the aspect ratio is wrong; additionally I can see jagged edges, meaning the scaled image in the video is not antialiased.

      如何使用正确的宽高比和抗锯齿/平滑功能使图像适合视频尺寸? (我想这与-attach crop center=1有关,但是我找不到关于它的文档).

      How do I make the image fit in video size with correct aspect ratio, with antialiasing/smoothing? (I guess it has to do with -attach crop center=1, but I couldn't find documentation on that).

      • 在SDL中查看内容并逐步查看帧时,帧是从0开始编号的,还是从1开始,并且在帧0处仅显示与1相同的帧?

      • When viewing stuff in SDL and stepping through frames, are frames numbered 0-based, - or are they 1-based, and at frame 0 simply the same frame as 1 is shown?

      如果我使用ttl=6-filter luma cycle=6 duration=4,我会得到:

      If I use ttl=6 and -filter luma cycle=6 duration=4, I get this:

      ...,即可见过渡从帧7开始(帧6是完整图像A),持续到帧7和8,结束于帧9(是完整图像B);然后再次在第13帧和第14帧(第15帧是完整图像A)

      ... that is, visible transition starts at frame 7 (frame 6 is full image A), lasts for frames 7 and 8, and ends at frame 9 (which is full image B); then again at frames 13 and 14 (frame 15 is full image A)

      但是,如果我使用ttl=6-filter luma cycle=6 duration=2,那么我会得到:

      However, if I use ttl=6 and -filter luma cycle=6 duration=2, then I get this:

      ...即没有过渡,图像在第7帧立即更改,然后在第13帧再次更改,依此类推.

      ... that is, there is no transition, image instantly changes at frame 7, then again at frame 13, etc.

      因此,我将第一种情况称为过渡持续时间为2帧,第二种情况称为持续时间为0帧-但选项分别为duration=4duration=2.谁能解释为什么?这两帧差异在哪里去了?

      So, I'd call the first case a transition duration of 2 frames, and the second case a duration of 0 frames - yet the options are duration=4 and duration=2, respectively. Can anyone explain why? Where are those 2 frames of difference gone?

      • 我可以(如果可以的话)如何进行相同的幻灯片显示,除了淡入黑色之外?我想定义每个图像6帧的生存时间"(ttl),以及4帧的过渡,例如:

      • Can I - and if so, how - do the same kind of slideshow, except with fade to black? I'd like to define a "time to live" (ttl) of 6 frames per image, and a transition of 4 frames, such that:

        首先,显示图像A的4帧; 然后,一帧图像A淡入淡出,然后是一帧黑色(图像A的TTL为6帧,最后2个过渡);
      • 然后两帧图像B淡入(与先前的2帧过渡为4帧),随后又是另外两帧图像B充满(因此图像B为4帧);
      • 然后一帧图像B淡出,然后一帧黑色(图像B相当于TTL的6帧);
      • first, 4 frames are shown of image A;
      • then one frame image A faded, followed by one frame black (amounting to 6 frames TTL for image A, the last 2 transition);
      • then two frames image B faded (amounting to 4 frames transition with previous 2), followed by two more frames image B full (so 4 frames here of image B);
      • then one frame image B faded, followed by one frame black (amounting to 6 frames TTL for image B);

      ...等等

      • Is it possible to persuade melt to use globbing to select images for slideshow, instead of using .all.jpg? As far as I can see on MLT (Media Lovin' Toolkit) Photo Slide Video no - but maybe there is another approach...

      推荐答案

      好,所以,我花了一些时间研究melt的命令,结果发现实际上有一种相当有效的方法来更改一堆图像(如果参数数量太长或终端无法处理的字符太多.

      Ok, so, I spent some time looking into the commands for melt and turns out there is actually a pretty effective way of altering a bunch of images (if the number of arguments is too long or there are too many characters for your terminal to handle).

      您要做的是使用-serialise <name of file>.melt来存储命令(您也可以手动创建此文件).然后,要执行该文件,请使用melt <name of file>.melt以及视频文件具有的其他任何选项.

      What you want to do is to use -serialise <name of file>.melt which will store your commands (you can also create this file manually). Then to execute that file, use melt <name of file>.melt along with any other options you have for your video file.

      melt <images and what to do to them> -serialise <name of file>.melt

      melt image1.png out=50 image2.png out=75 -mix 25 -mixer luma image3.png out=75 -mix 25 -mixer luma image3.png out=75 -mix 25 -mixer luma image4.png out=75 -mix 25 -mixer luma <...> -serialise test.melt

      image1.png out=50 image2.png out=75 -mix 25 -mixer luma image3.png out=75 -mix 25 -mixer luma image3.png out=75 -mix 25 -mixer luma image4.png out=75 -mix 25 -mixer luma <...>

      image1.png out=50 image2.png out=75 -mix 25 -mixer luma image3.png out=75 -mix 25 -mixer luma image3.png out=75 -mix 25 -mixer luma image4.png out=75 -mix 25 -mixer luma <...>

      melt test.melt -profile atsc_1080p_60 -consumer avformat:output.mp4 vcodec=libx264 an=1

      熔解文件的末尾应该有一个额外的返回字符.如果没有,将输出Exceeded maximum line length (2048) while reading a melt file.

      注意-serialise <name of file>.melt将不在.melt文件中

      Notice that -serialise <name of file>.melt will not be in the .melt file

      在编码过程开始之前,融解实际上会花费一些时间来加载融化文件

      这篇关于了解/控制MLT融化幻灯片显示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆