Answers.Body: <p>It can be done with ffmpeg. I ended up using following:</p>
  
  <pre><code>ffmpeg -i input-file -vf "setpts=ifnot(isnan(PREV_OUTPTS)\,PREV_OUTPTS) + min(1000\,PTS - PREV_INPTS)" -c:v libx264 -preset ultrafast -crf 0 output.mkv
  </code></pre>
  
  <p>You can print expressions like this, which is useful for testing:</p>
  
  <pre><code>ffmpeg -i input-file -vf "setpts=print(PREV_INPTS)\;print(PTS - PREV_INPTS)\;print(ifnot(isnan(PREV_OUTPTS)\,PREV_OUTPTS) + min(1000\,PTS - PREV_INPTS))" -c:v libx264 -preset ultrafast -crf 0 output.mkv
  </code></pre>
  
  <p>Following documentation may be helpful:</p>
  
  <p><a href="https://ffmpeg.org/ffmpeg-all.html#Expression-Evaluation" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-all.html#Expression-Evaluation</a></p>
  
  <p><a href="https://ffmpeg.org/ffmpeg-all.html#setpts" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-all.html#setpts</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-06T02:41:32.607Z
Answers.LastActivityDate: 2017-04-06T12:40:10.813Z
Answers.LastEditDate: 2017-04-06T12:40:10.813Z
Answers.UserDisplayName: brendan
Body: <p>I have a variable frame rate video file. There is a delay of over 30 seconds between some frames. Can I transcode the video and reduce all delays between frames over a certain value, say 1 second, to that value? This would mean the maximum gap or delay between any 2 consecutive frames would be 1 second.</p>
  
Tags: <framerate>
Title: Can I reduce the delay between video frames?
UserDisplayName: brendan
ThreadText: # Can I reduce the delay between video frames?
  
  (Asked by: username_0 on 2017-04-05)
  
  I have a variable frame rate video file. There is a delay of over 30 seconds between some frames. Can I transcode the video and reduce all delays between frames over a certain value, say 1 second, to that value? This would mean the maximum gap or delay between any 2 consecutive frames would be 1 second.
  
  **Tags:** framerate
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-04-06. Score: 3
  
  It can be done with ffmpeg. I ended up using following:
  
  ```
  ffmpeg -i input-file -vf "setpts=ifnot(isnan(PREV_OUTPTS)\,PREV_OUTPTS) + min(1000\,PTS - PREV_INPTS)" -c:v libx264 -preset ultrafast -crf 0 output.mkv
  
  ```
  
  You can print expressions like this, which is useful for testing:
  
  ```
  ffmpeg -i input-file -vf "setpts=print(PREV_INPTS)\;print(PTS - PREV_INPTS)\;print(ifnot(isnan(PREV_OUTPTS)\,PREV_OUTPTS) + min(1000\,PTS - PREV_INPTS))" -c:v libx264 -preset ultrafast -crf 0 output.mkv
  
  ```
  
  Following documentation may be helpful:
  
  <https://ffmpeg.org/ffmpeg-all.html#Expression-Evaluation>
  
  <https://ffmpeg.org/ffmpeg-all.html#setpts>
  
  
  ---
  
  