Reputation: 2860
I have to cut my video exactly. This video could have 25fps or 30fps (i dont know). is there a Variable in ffmpeg for the framerate so i could calculate on which frame i had to Cut? I only have the seconds of my video. something like this (for example 80sec video):
vf "fade=in:0:12,fade=out:(80*r):12"
-vf "fade=in:0:12,fade=out:2500:12"
Upvotes: 1
Views: 1174
Reputation: 4856
You can specify the fade in start time and duration time in addition to start frame and frame duration.
-vf "fade=in:st=0.0:d=0.5,fade=out:st=75.5:d=0.5"
Upvotes: 1
Reputation: 28285
ffmpeg comes installed with
ffprobe
which shows stats of given media file ... here is an example
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.
so now you have both total time and fps so you can calculate total number of frames or just use time to cut your video
Upvotes: 1