带有ffmpeg的svg幻灯片 [英] svg slideshow with ffmpeg

查看:69
本文介绍了带有ffmpeg的svg幻灯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以向我指出如何制作带有svg图像的幻灯片(使用ffmpeg).通常的方法,

can anyone point out to me, how to make a slideshow (with ffmpeg) with svg images. The usual way,

ffmpeg -i bloch_0%2d.svg bloch2.mp4

由于ffmpeg无法明显处理svg文件(处理输入时发现无效数据),因此无法正常工作吗?

doesn't work since ffmpeg can't handle svg files obviously (Invalid data found when processing input) is there an easy way to do this?

谢谢

推荐答案

首先将SVG图像转换为栅格格式,例如PNG或JPEG.如果您的SVG编辑器不支持导出为栅格格式,则可以使用ImageMagick的 convert 命令来完成:

First convert the SVG images to a raster format, such as PNG or JPEG. If your SVG editor does not support exporting to a raster format, this can be done using ImageMagick's convert command:

convert bloch_*.svg bloch_%03d.png

注意:为了获得最佳的SVG支持,请确保已将ImageMagick编译为使用RSVG库.详细信息

Note: For the best SVG support, ensure that ImageMagick was compiled to use the RSVG library. Details

接下来,使用 ffmpeg 将光栅图像转换为MP4中的H.264:

Next, convert the raster images to H.264 in MP4 using ffmpeg:

ffmpeg -r 1 -i bloch_%03d.png -pix_fmt yuv420p bloch2.mp4

-r 1 选项将输入的帧速率设置为每秒1帧,但是您可以根据输入是独立图像还是某些图像的连续动画将其设置为任意值.排序.

The -r 1 option sets the frame rate of the input to 1 frame per second, but you can set it to whatever you like depending on whether these are independent images or a continuous animation of some sort.

不需要 -pix_fmt yuv420p ,但是不会对PNG颜色进行二次采样.H.264视频可以支持具有特殊配置文件的非子采样颜色,但是大多数播放器仅支持4:2:0颜色子采样,因此您可能需要将其转换为4:2:0.JPEG通常使用4:2:0,因此,如果您输入的是JPEG,则通常不需要此选项.

The -pix_fmt yuv420p is not required, however PNG color is not subsampled. H.264 video can support non-subsampled color with a specialized profile, but most players only support 4:2:0 color subsampling, so you will probably want to convert it to 4:2:0. JPEG normally uses 4:2:0 so if your input is JPEG then you would not normally need this option.

这篇关于带有ffmpeg的svg幻灯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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