该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

ffmpeg 转换压缩比例

FFMPEG如果是压缩为FLV文件 3个编码可选

1. -c:v flv 标准FLV编码 这个好处是速度快 清晰度高的话 视频文件会比较大

2. -c:v vp6 VP6编码 这个大家都很少使用 其实这个也算不错

3. -c:v libx264 H.264编码 估计使用这个的比较多 优点是同等清晰度 视频文件更小 缺点就是转换慢的吐血

以1.11G大小的电影 转换为例子

libx264 500k 出片为 572.36M

flv编码 清晰度5 出片为 872.94M

2个看起来flv的清晰度 还不如libx264的

竟然大了足足300M……

音频都是一样 都是Pass 1

下面是以前的备注文档 贴出来共享下

壓縮配置選項

===============================

512Kbps

視頻bitrate 設置為 360k 最大416k 音頻設置為64k

1Mbps

視頻bitrate 設置為720k 最大832k 音頻設置為 128k

2Mbps HD

視頻bitrate 設置為1550k 最大1792k 音頻設置為128k

視頻壓縮大小

===============================

出片 Bitrate 10分钟的视频

320p 180 kbit/s ~13 MB

360p 300 kbit/s ~22 MB

480p 500 kbit/s ~37 MB

576p 850 kbit/s ~63 MB (SD/PAL)

720p 1000 kbit/s ~75 MB

FFMPEG參數

===============================================

-i 輸入文件 test.avi 或其他

-c:v libx264 使用h.264 編碼

-vcodec libx264 強制指定視頻編碼模式

-profile:v high 使用H.264的High模式 比較消耗資源

-pre slow 使用慢速模式 耗時間 清晰度高

//該參數還可選擇 ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo

-b:v 360k / 720k / 1550k 視頻比特率 (該參數比較重要 如果是轉換Web用途 是否正確直接影響視頻播放流暢程度)

-maxrate 500k 最大比特率

-bufsize 1000k 比特率緩衝大小

-s 000×000

視頻大小 建议值

240P 320×240 //Mobile iPhone MP4

360P 640×360 //SD FLV

480P 864×480 //HD MP4

720P 960×720 //HD MP4

-threads 0 處理器核心利用數量

-aspect 16:9 / 4:3 視頻比例

-pass N 1-3可選

音頻

-acodec libfaac 強制指定音頻處理模式

-ac 2 聲道選擇

-ar 44100 音頻赫茲

-ab 128k 比特率 64k/128k

-acodec libfaac -ac 2 -ar 44100 -ab 64k

In this article we show how to resize any video file.This method is one of the bests ways to resize a video file in Linux systems (almost any distribution), and an excellent alternative to Windows and Mac users.

Changing the resolution of a video file will be one of the most common operations that we will perform when working with video files, and as such ffmpeg is able to do it perfectly. There are several reasons why we should want to change the resolution of a video file, for example:

To reduce the size of the video. This is possible by reducing the resolution of the video. If we take for example a video in HD (1920x1080 pixels) but we know that we will never see on a screen that supports a higher resolution than say 1024x768, we can reduce the video resolution to adapt to this new resolution, saving plenty of storage space and if used on Internet, saving bandwidth also.

Many times the resolution is changed on video files to standardize its format. That is, if we have several videos and we want them all in the same resolution, will have to go through this process of changing resolution.

In the development of modern websites it is quite useful to have the videos in various resolutions depending on where they appear. We can develop sites with responsive designs in which the most suitable video for the user plays. For example, if we have a video in various formats-we say 1920x1080, 1280x720, and 640x360- we can design a responsive site that makes visitors reproduce the proper video resolution depending on visitor browser saving bandwith (keep in mind that mobile users usually pay for transferred data so it is better to transfer as less traffic as possible)

In this example we will reduce the resolution of a video in HD format (1920x1080 pixels) to 640x360 (this is a fairly used configuration for aspect ratio 16:9):

ffmpeg -i video_1920.mp4 -vf scale=640:360 video_640.mp4 -hide_banner

It is only necessary to indicate the scale video filter with the new desired resolution (640:360) with -vf scale=640:360. To consider:

We can indicate any resolution we want, but the resulting video will always have the same aspect ratio. That is, it will not distort the images, if video is in 16:9 aspect ratio, it will keep the video in 16:9 aspect ratio. The program will adjust the resulting video so it can fit in the resolution that we have given.

When changing resolution, the video must go throught the encoding process another time, so the process can be slow depending on the output format and the codec you're using for the output.

We have not mentioned it, but most of the time it does not make sense to transform a video to a higher resolution because, there can't be any improvement in video quality.

Changing the video aspect ratio

If we want to change the look of the video, knowing that the image will appear distorted, we can use an additional filter "setdar". Imagine that in the previous case we want to change the 16:9 aspect ratio to 4:3, and therefore the video at a resolution of 4:3 aspect ratio, which in this case it will be 640x480. The ffmpeg command to make this transformation would be:

ffmpeg -i video_1920.mp4 -vf scale=640:480,setdar=4:3 video_640x480.mp4 -hide_banner

The video output that we get in this case video_640x480.mp4 changes the appearance of the original video and has distorted images a bit, but it will get the resolution we want with new look.

If on the other hand, we do not want to rely on using an aspect ratio which could be "more normal" (4:3, 16:9) or if we want to make changes to other resolutions with undefined aspect ratio and we are not afraid of possible deformations of images that will appear, we can use the "setsar" filter that will save you from having to keep those aspect ratios. In this way we could transform the previous video to a resolution of 200x400 for example, with the following command:

ffmpeg -i video_1920.mp4 -vf scale=200:400,setsar=1:1 video_200x400.mp4 -hide_banner

The result in 200x400 resolution from 1920x1080 resolution makes the video output to have a distorted appearance.

Examples of video resizing

We are going to see some examples of video resizing using ffmpeg. We have an original video with a resolution of 320x180 pixels. Here it is.

As we have seen previously we can resize the video to half its original size. We are resizing it from a 320x180 pixels resolution to a 160x90 pixels resolution with the following command:

ffmpeg -i video_320x180.mp4 -vf scale=160:90 video_180x90.mp4 -hide_banner

The video has gone from a size of 1.18MB to a 354KB video (one quarter). Here is the result:

Note that the video is smaller, but we can tell the browser to make it bigger with some loss of quality compared to the original.

Now let's change the original video aspect ratio from 16:9 to 4:3. To do this we are resizing video from 320x180 to 320x240 with the following command:

ffmpeg -i video_320x180.mp4 -vf scale=320:240,setdar=4:3 video_320x240.mp4 -hide_banner

And here is the result (you can see that images appear distorted):

And now at last we will resize the video as if it has to fit in a vertical screen, so we resize from 320x180 pixels to 180x320 pixels. Here is the command which will do the task:

ffmpeg -i video_320x180.mp4 -vf scale=180:320,setsar=1:1 video_180x320.mp4 -hide_banner

And here is the distorted result:

Note that in this videos I have also included a source in webm format for maximum compatibility. I have done this way so if your browser is not able to work directly with mp4 files you can see the results in a similar webm file.

ffmpeg 声音参数_ffmpeg转换参数和压缩输出大小的比率相关推荐

  1. ffmpeg 转换flv压缩大小_ffmpeg转换参数和压缩输出大小的比率 参考 最新版本FFMPEG...

    https://blog.cnlabs.NET/3668.html ffmpeg 转换压缩比例 FFMPEG如果是压缩为FLV文件 3个编码可选 1. -c:v flv 标准FLV编码 这个好处是速度 ...

  2. ffmpeg 转换flv压缩大小_ffmpeg转换参数和对几种视频格式的转换分析

    对于其他诸如-i.-y.-s等参数基本上都是可以很好理解的了.我们上面提到的几个参数前四个主要是用来设置音频的,后三个主要是用来设置视频的.对于音频的ar(采样率)可以指定为22050.24000.4 ...

  3. ffmpeg 声音参数_ffmpeg之参数详解

    本文讲述参数详解 1. ffmpeg.exe -i F:\ 闪 客 之 家 \ 闪 客 之 歌 .mp3 -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 f:\11. ...

  4. 南方h5手簿求转换参数_如何使用RTK手簿求坐标转换参数(四参数/七参数)

    参数计算是用于两个坐标系统之间的转换关系,GPS 接收机输出的数据是CGCS2000经纬度坐标,但是有些时候根据甲方的要求,需要转化到施工测量坐标,这个时候就需要软件进行坐标转换参数的计算和设置,而转 ...

  5. 工程之星位置服务器,工程之星4.0——转换参数、坐标转换等操作步骤

    工具菜单中包括:计算转换参数.坐标转换.校正向导.计算四参数.计算七参数.计算空间距离.计算三角形. ▌ 图1工具菜单 计算转换参数 GPS 接收机输出的原始坐标数据是WGS-84坐标,而通常施工所用 ...

  6. 中海达ihand30手簿使用说明_如何使用RTK手簿求坐标转换参数(四参数/七参数)...

    参数计算是用于两个坐标系统之间的转换关系,GPS 接收机输出的数据是CGCS2000经纬度坐标,但是有些时候根据甲方的要求,需要转化到施工测量坐标,这个时候就需要软件进行坐标转换参数的计算和设置,而转 ...

  7. 格式工厂视频转换参数设置攻略

    格式工厂是一个常用且好用的视频转换工具,但是怎么设置参数才能使转换后的视频更清晰且视频体积又不过于庞大呢?下面我们就来看看格式工厂输出设置更清晰视频的方法,需要的朋友可以参考下. 首先提供格式工厂视频 ...

  8. PowerCLI脚本,利用哈希表对参数进行转换

    在使用PowerCLI的编写powershell脚本的过程中,有这样一个需求:例如需要重启一个指定的虚拟机,运行脚本时输入的参数,参数为虚拟机的名字,但是虚拟机的名字在建立的时候可能是千奇百怪,我们想 ...

  9. Vue中向js中传递参数并在js中定义对象并转换参数

    场景 有下面这种主从表结构 上面的信息是主表的信息,下面是从表的信息. 在Vue中将页面的信息传递到js的方法中,在js方法中将参数进行转换使其与后台接收的参数相匹配. 注: 博客: https:// ...

最新文章

  1. BOW模型在ANN框架下的解释
  2. 【五线谱】踏板标记 ( 踩下踏板 Ped 标记 | 松开踏板 * 标记 | MIDI 中的对应踏板指令 | 连续控制信号 | 开关控制信号 )
  3. search strategies
  4. 猜数字游戏python123_【趣味数学】可以说谎的猜数字游戏
  5. MySQL数据约束和关联查询
  6. 马尔可夫过程及其例题分析
  7. 自考 软件工程专业 07028 软件测试 总结
  8. 读取xlsx文件错误
  9. python 函数 与 open打开文件的三种模式:r读、w写、a追加、
  10. UE4 VR官方教程学习总结-项目设置
  11. 相对位置编码 relative position encoding
  12. 如何写出一份完美的BP(商业计划书)?
  13. 爱也可以量化?用4个公式表征爱情
  14. 温控驱动(五)dts参数解析、节点作用
  15. JAVA数字大写金额转换
  16. Linux系统中安装软件的几种方式
  17. Linux学习——文件权限及文件查找
  18. 【历史上的今天】4 月 30 日:信息论之父出生;万维网对所有人免费开放;图灵奖算法先驱诞生
  19. java实现监听文件
  20. 2021-AFCTF

热门文章

  1. sqoop将关系型数据库的表导入hive中
  2. SqlServer 0和空字符串''等价?-----类型的隐式转换问题
  3. 工业机器人电路图讲解话术_6张经典电路图分析助你进阶高级电工,你都会了吗?...
  4. android 不可点击状态,Android系统.如何使用setClickable同时设置所有按钮可点击或不可点击?...
  5. mac地址厂商对应表_网络工程师一分钟搞懂MAC地址表知识点全部内容,建议收藏...
  6. 电子测量与仪器第四版pdf_固定资产管理系统_资产分类名称(电子和通信测量分析仪器篇)...
  7. dataset中的数据批量导入oracle数据库,c#如何将dataset中的数据批量导入oracle数据库...
  8. linux性能测试命令h,Linux性能测试 pmap命令详解
  9. linux 虚拟机新增磁盘,linux(虚拟机)下新增磁盘配置
  10. 思科服务器型号m1414,Cisco UCS M 系列模块化服务器