FFmpeg - 使用帧率计算?

时间:2017-05-31 20:07:33

标签: video ffmpeg frame-rate ffmpeg-php

我必须完全剪切我的视频。这个视频可能有25fps或30fps(我不知道)。 ffmpeg中有一个变量用于帧率,所以我可以计算出我必须剪切的帧吗?我只有我的视频秒。 像这样的东西(例如80秒视频):

vf" fade = in:0:12,fade = out:(80 * r):12"

-vf "fade=in:0:12,fade=out:2500:12"

2 个答案:

答案 0 :(得分:1)

除了开始帧和帧持续时间之外,您还可以指定开始时间和持续时间的淡入淡出。

-vf "fade=in:st=0.0:d=0.5,fade=out:st=75.5:d=0.5"

答案 1 :(得分:0)

ffmpeg随

一起安装
ffprobe

显示给定媒体文件的统计信息...这是一个示例

ffprobe "The Fourth Phase of Water - Dr. Gerald Pollack at TEDxGuelphU-i-T7tCMUDXU.mp4"

... here is output of above command

ffprobe version N-86279-gac8dfcbd89 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.3.0 (Ubuntu 6.3.0-12ubuntu2) 20170406
  configuration: 
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 90.100 /  6. 90.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'The Fourth Phase of Water - Dr. Gerald Pollack at TEDxGuelphU-i-T7tCMUDXU.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-25T12:06:13.000000Z
  Duration: 00:24:14.34, start: 0.000000, bitrate: 923 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720, 794 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2016-08-25T12:06:13.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2016-08-25T12:06:13.000000Z
      handler_name    : ISO Media file produced by Google Inc.

所以现在你有总时间和fps,所以你可以计算总帧数或只是用时间来剪切你的视频