FFMPEG脚本将文件夹中的所有Webm文件转换为Gif,然后删除那些Webm

时间:2021-09-05 00:29:30

I'm using FFmpeg with DirectoryMonitor, a folder watching program. When a webm is added to the folder i want to execute a script to convert all webm files in that folder to gif, and then delete those webm files.

我正在使用带有DirectoryMonitor的FFmpeg,这是一个文件夹观看程序。当webm添加到文件夹时,我想执行一个脚本将该文件夹中的所有webm文件转换为gif,然后删除这些webm文件。

1 个解决方案

#1


2  

Ffmpeg can often deduce the output type by its file extension, so just write to a .gif and you're usually good.

Ffmpeg通常可以通过文件扩展名来推断输出类型,所以只需写入.gif文件就可以了。

#!/bin/bash

for w in ./*.webm; do 
  ffmpeg -i $w ${w%.*}.gif && rm $w 
done 

#1


2  

Ffmpeg can often deduce the output type by its file extension, so just write to a .gif and you're usually good.

Ffmpeg通常可以通过文件扩展名来推断输出类型,所以只需写入.gif文件就可以了。

#!/bin/bash

for w in ./*.webm; do 
  ffmpeg -i $w ${w%.*}.gif && rm $w 
done