使用开源软件FFmpeg将各种格式视频转换成MP4视频格式(最简单方法)



前言

这是FFmpeg的官方介绍:
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
It contains libavcodec, libavutil, libavformat, libavfilter, libavdevice, libswscale and libswresample which can be used by applications. As well as ffmpeg, ffplay and ffprobe which can be used by end users for transcoding and playing.
The FFmpeg project tries to provide the best technically possible solution for developers of applications and end users alike. To achieve this we combine the best free software options available. We slightly favor our own code to keep the dependencies on other libs low and to maximize code sharing between parts of FFmpeg. Wherever the question of “best” cannot be answered we support both options so the end user can choose.
FFmpeg官方网站



简单来说,FFmpeg开源免费,功能强大,视频转码只是它部分功能。

此文章只介绍使用此工具进行各种视频转成mp4。转成其他格式视频方法差不多。

  • 我的电脑系统:windows10
  • FFmpeg版本:ffmpeg 4.3.1

下载FFmpeg客户端

在FFmpeg官网下载界面内进行下载

FFmpeg下载界面:http://ffmpeg.org/download.html

将发现如下图所示界面,根据你的电脑系统来下载,有linux,windows,mac


在这里插入图片描述
先将鼠标放到win图标上面,将出现两个链接,如上图。两个都可以下载。我以第一个链接为例。
点开出现下图界面。




在这里插入图片描述

找到 release(发行版本较稳定),这几个链接都可以下载,我是从第一个链接下载


# 安装FFmpeg 安装很简单,直接解压就好了。下载好之后,解压你的压缩包。 这是我的安装的文件夹目录 ![一级目录](https://img-blog.csdnimg.cn/20210130094439726.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NyYXlvbnhpbjIwMDA=,size_16,color_FFFFFF,t_70#pic_center) ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210130094522678.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NyYXlvbnhpbjIwMDA=,size_16,color_FFFFFF,t_70#pic_center) 你会发现在bin文件夹里有三个文件,ffmpeg.exe,ffplay.exe,ffprobe.exe。本文章内容只用到ffmpeg.exe

开始使用

打开PowerShell页面

按住shift同时,右键文件夹空的地方,会出现如下菜单,点击“在此处打开…”,进入powershell界面。
(也可以打开cmd,cd命令切到这个目录下。后期如果经常转换的话,可以设置一下系统变量,以后也方便)。

在这里插入图片描述

在这里插入图片描述

输入ffmpeg ,验证是否可以使用;

在这里插入图片描述
出现上图界面,就可以使用了,如果报错;
可以尝试加这个代码试试:

start ffmpeg

然后ffmpeg应该可以了。

开始转换视频

 ffmpeg -i E:\影音\影视\汪汪队立大功第三季第一集.ts  D:\转换后的文件名.mp4 

E:\影音\影视\汪汪队立大功第三季第一集.ts 这是你要转的视频文件。

D:\转换后的文件名.mp4 这是你的视频文件,文件后缀名为你想要转的格式名字。
在这里插入图片描述
等一会就好了。


总结

其实FFmpeg加上参数可以使用更多的功能,上述只是最简单的方法,还可以加参数例如
-f 指定格式
-r 指定帧率
-s分辨率
-b:v 指定码率



详细请看官方文档:http://ffmpeg.org/ffmpeg.html


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章