问题
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
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?
thanks
回答1:
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
Note: For the best SVG support, ensure that ImageMagick was compiled to use the RSVG library. Details
Next, convert the raster images to H.264 in MP4 using ffmpeg
:
ffmpeg -r 1 -i bloch_%03d.png -pix_fmt yuv420p bloch2.mp4
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.
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.
来源:https://stackoverflow.com/questions/15118609/svg-slideshow-with-ffmpeg