zoukankan      html  css  js  c++  java
  • FFmpeg命令 ---- 封装和图片转换

    转封装

    保持编码格式:
    ffmpeg -i test.mp4 -vcodec copy -acodec copy test_copy.ts
    ffmpeg -i test.mp4 -codec copy test_copy2.ts

    改变编码格式:
    ffmpeg -i test.mp4 -vcodec libx265 -acodec libmp3lame out_h265_mp3.mkv

    修改帧率:
    ffmpeg -i test.mp4 -r 15 -codec copy output.mp4 (错误命令)
    ffmpeg -i test.mp4 -r 15 output2.mp4

    修改视频码率:
    ffmpeg -i test.mp4 -b 400k output_b.mkv (此时音频也被重新编码)

    修改视频码率:

    ffmpeg -i test.mp4 -b:v 400k output_bv.mkv

    修改音频码率:
    ffmpeg -i test.mp4 -b:a 192k output_ba.mp4
    如果不想重新编码video ,需要加上-vcodec copy

    修改音视频码率
    ffmpeg -i test.mp4 -b:v 400k -b:a 192k output_bva.mp4

    修改视频分辨率:
    ffmpeg -i test.mp4 -s 480x270 output_480x270.mp4

    修改音频采样率 :
    ffmpeg -i test.mp4 -ar 44100 output_44100hz.mp4

    图片和视频转换

    截取一张图片
    ffmpeg -i test.mp4 -y f image2 -ss 00:00:02 -vframes 1 -s 640x360 test.jpg
    ffmpeg -i test.mp4 -y f image2 -ss 00:00:02 -vframes 1 -s 640x360 test.bmp
    -i 输入
    -y 覆盖
    -f 格式
    image2 一种格式
    -ss 起始值
    -vframes 帧 如果大于 1 那么 输出加 %03d test%03d.jpg
    -s 格式大小 size

    转换视频为图片(每帧一张图)
    ffmpeg -i test.mp4 -t 5 -s 640x360 -r 15 frame%03d.jpg

    图片转换为视频
    ffmpeg -f image2 -i frame%03d.jpg -r 25 video.mp4

    从视频中生成 GIF 图片
    ffmpeg -i test.mp4 -t 5 -r 1 image1.gif
    ffmpeg -i test.mp4 -t 5 -r 25 -s 640x360 image2.gif

    将 GIF 转化为 视频
    ffmpeg -f gif -i image2.gif image2.mp4

  • 相关阅读:
    关于微服务的协议概述
    Eclipse 安装阿里巴巴代码规范插件
    Eclipse安装LomBok插件
    关于JAVA架构师
    关于Object类的一些方法
    [SoapUI] SoapUI官方文档
    [Jmeter] 用xsltproc生成html格式的报告
    [RF] Robot Framework新手干货(转载)
    【SoapUI】比较Json response
    怎样查看一个端口有无开启
  • 原文地址:https://www.cnblogs.com/vczf/p/13471795.html
Copyright © 2011-2022 走看看