zoukankan      html  css  js  c++  java
  • ffmpeg视频的翻转相关

    由于项目上需要使用到ffmpeg做视频处理所以不得不学习一下,同时做一些简单的记录

     一、视频的翻转相关

      水平翻转

      参数说明:-i 指定输入的文件;-vf filter_graph,用来设置: video filters

      原视频:

      

    ffmpeg -i test.mp4 -vf "hflip" "C:\Users\amin\Desktop\test2.mp4"

      水平翻转后的:

      

       垂直翻转

      

    ffmpeg -i test.mp4 -vf "vflip" "C:\Users\amin\Desktop\test2.mp4"

      垂直翻转后的视频

      

      指定角度旋转

      transpose:指定旋转的效果

      参数说明:0:逆时针旋转90度并垂直翻转;1:顺时针旋转90度;2:逆时针旋转90度;3:顺时针旋转90度后并垂直翻转

      逆时针旋转90度并垂直翻转

      

    ffmpeg -i test.mp4 -vf "transpose=0" "C:\Users\amin\Desktop\test2.mp4"

      结果见下图:

      

      顺时针旋转90度

      

    ffmpeg -i test.mp4 -vf "transpose=1" "C:\Users\amin\Desktop\test3.mp4"

      结果见下图:

       

      逆时针旋转90度

      

    ffmpeg -i test.mp4 -vf "transpose=2" "C:\Users\amin\Desktop\test3.mp4"

      结果见下图:

       

      顺时针旋转90度后并垂直翻转

      

    ffmpeg -i test.mp4 -vf "transpose=3" "C:\Users\amin\Desktop\test3.mp4"

      结果见下图:

       

    顺时针旋转180度
    ffmpeg -i test.mp4 -vf "transpose=1,transpose=1" "C:\Users\amin\Desktop\test2.mp4"
    逆时针旋转180度
    ffmpeg -i test.mp4 -vf "transpose=2,transpose=2" "C:\Users\amin\Desktop\test2.mp4"

      其他角度旋转 

      PI:指180度  顺时针

      参数说明:PI/2: 90度,注意,视频旋转90度后,原宽高没变,所以显示两侧有黑边       #画面有被隐藏掉的部分

      弧度旋转

      需要注意的是当度数为小数时会出现多边形

    ffmpeg -i test.mp4 -vf "rotate=PI/2" "C:\Users\amin\Desktop\test2.mp4"     # 90度
    
    ffmpeg -i test.mp4 -vf "rotate=PI" "C:\Users\amin\Desktop\test2.mp4"    # 180度

    ffmpeg -i test.mp4 -vf "rotate=PI/3" "C:\Users\amin\Desktop\test2.mp4"       #60度

    ffmpeg -i test.mp4 -vf "rotate=PI/4" "C:\Users\amin\Desktop\test2.mp4"       45 度
     
     

      

  • 相关阅读:
    java操作docker示例(docker-java)
    istio实现对外暴露服务
    istio实现自动sidecar自动注入(k8s1.13.3+istio1.1.1)
    k8s1.13.3安装istio(helm方式)
    wrk http压测工具介绍
    etcd 相关介绍
    openresty 常用API学习
    Lua 相关知识点
    Lua 获取table的长度
    Lua 字符串相关操作
  • 原文地址:https://www.cnblogs.com/xuguangzong/p/15741571.html
Copyright © 2011-2022 走看看