• 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 度
     
     

      

  • 相关阅读:
    HDU5890:Eighty seven(Bitset优化背包)
    AtCoder3857:Median Sum (Bitset优化背包&&对称性求中位数)
    POJ3275:Ranking the Cows(Bitset加速floyd求闭包传递)
    Gym
    POJ2443 Set Operation (基础bitset应用,求交集)
    POJ2976:Dropping tests(01分数规划入门)
    HihoCoder1084: 扩展KMP(二分+hash,求T串中S串的数量,可以失配一定次数)
    扩展KMP(占位)
    MySQL主备模式的数据一致性解决方案
    MaxCompute问答整理之6月
  • 原文地址:https://www.cnblogs.com/xuguangzong/p/15741571.html
Copyright © 2020-2023  润新知