当前位置:网站首页>FFmpeg转换视频格式与导出GIF动态图的方法
FFmpeg转换视频格式与导出GIF动态图的方法
2022-07-17 17:06:00 【zorchp】
tags: FFmpeg Media Tips
写在前面
以前一直觉得一款名叫格式工厂的软件特别厉害, 什么媒体格式都能互相转化, 后来发现格式工厂其实就是一个套壳的FFmpeg, FFmpeg1这款命令行软件可以说是相当强大了, 支持音频视频等的各种转换, 以及图片等的互相转换, 甚至还能捕获网络上的m3u8文件, 可以参考我之前的关于如何下载钉钉直播视频的文章. 总之, 学会了一些基本的命令行操作之后, 以后就完全不需要下载其他软件了, 不仅方便还支持批处理操作, 简直就是必备的效率工具~
下面我总结一下我常用的几个结合FFmpeg和imagemagick的媒体文件处理操作, 主要涉及视频格式转换, 视频到GIF的转换等, 主要参考当然是FFmpeg的官方文档2, 当然也有一些现成的国外博客以及Stack Overflow.
视频格式互相转换
通过下面的命令3实现mkv->mp4的转换, 如果不加-c(-codec)选项可能会导致编码失真, 码率降低.
ffmpeg -i input.mkv -c copy output.mp4
可以达到无损转换, 支持的格式可参见4.
视频转换为动图GIF
这个比较常用了, 特别是制作动画表情等的时候, 下面是转换的命令5:
ffmpeg -ss 00:00:20 -i sample.mp4 -to 10 -r 10 -vf scale=200:-1 cutekid_cry.gif
其中各个选项的解释如下:
- -ss : indicates the starting point of GIF
- -i : input file
- sample.mp4 : My video file name
- -to : End position of the GIF file
- -r : frame rate. You can increase the value to get more quality GIF file
- -vf : filter graph. To scale the GIF image in the desired size.(In this example, size is 200:auto)
参考
边栏推荐
- Cloud health management system based on STM32 (using Alibaba cloud Internet of things platform)
- Investment logic in market "uncertainty" 2020-03-18
- Mysql的知识梳理
- [C language programming 7] BTB model
- 云犀&腾讯云达成战略合作,加速拓展全球直播市场
- Acwing786. 第k个数
- Ah Qu's thinking
- When will the deflationary market reverse? How should we operate? 2020-03-13
- Pytorch version: yolov4 integrating attention and mobilenet
- Ultrasonic sensor (ch101 & ch201) - Ⅱ
猜你喜欢

ASP.NET协同OA办公服务管理平台源码

ATT&CK实战系列——红队实战(—)

Ultrasonic sensor (chx01) learning notes Ⅲ - I2C reading and writing operation

市场“不确定性”中的投资逻辑 2020-03-18

CMOS开关学习(一)

Stable super odds, 9 years old mixin | 2022 Jincang innovative product launch was successfully held

动态内存规划

Detailed explanation of RAID disk array, raid classification, advantages and disadvantages

通货收缩的市场何时反转?我们该如何操作?2020-03-13

Yunxi focuses on store broadcast solutions to accelerate global layout
随机推荐
收益风险比:投资机会最重要指标 2020-03-14
2022 global developer salary exposure: China ranks 19th, with an average annual salary of $23790
ASP.NET协同OA办公服务管理平台源码
MOF customized product | n-k2ti4o9/g-c3n4/uio-66 ternary composite | paper based au-aginse2-zif-8 Nanocomposite
虞美人·寄公度
Can you view MySQL data table structure in two ways?
10 minutes to customize the pedestrian analysis system, detection and tracking, behavior recognition, human attributes all in one!
PostgreSQL 函数使用记录
Yunxi focuses on store broadcast solutions to accelerate global layout
Flask源码分析(三):上下文
2022年最新吉林建筑安全员模拟题库及答案
Acwing4405. Statistical submatrix
Stable super odds, 9 years old mixin | 2022 Jincang innovative product launch was successfully held
可视化ETL工具Kettle概念、安装及实战案例
Investment logic in market "uncertainty" 2020-03-18
Swiftui data persistence in swift, different methods of saving data
【错误记录/selectpicker】dropdown menu显示位置出现偏移
Yunxi and Tencent cloud have reached a strategic cooperation to accelerate the expansion of the global live broadcast market
Pytorch version: yolov4 integrating attention and mobilenet
運維小白成長記—架構第6周