Answers.Body: <p>You have to perform all filtering in a single filtergraph.</p>
  <p><code>ffmpeg -i .\a.mp4 -i .\a.mp4 -filter_complex &quot;[0:v]setpts=N/FR/TB[v0];[1:v]select=gte(n\,1),setpts=N/FR/TB[v1];[v0][v1]ssim=f=stats.log&quot; -f null -</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-28T06:37:29.950Z
Answers.Text: ffmpeg says  `Filter setpts has an unconnected output` is this normal?
Answers.UserDisplayName: est
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-28T09:36:52.500Z
Answers.Text: No see edited answer
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-24T08:59:54.717Z
Answers.LastActivityDate: 2023-04-28T09:36:35.767Z
Answers.LastEditDate: 2023-04-28T09:36:35.767Z
Answers.UserDisplayName: Gyan
Body: <p>I would like to be able to take a single video, run it through ffmpeg, and have it spit out a log containing the SSIM of each frame with respect to the previous - that is, I want the SSIM scores comparing the previous frame to the current one. </p>
  
  <p>I am attempting to do so by running ffmpeg with the same video input twice, with the second input skipping ahead by one frame.</p>
  
  <pre><code>ffmpeg -i .\a.mp4 -i .\a.mp4 -filter_complex "[1:v]select=gte(n\,1)[f]" -map 0:v:0 -map "[f]" -lavfi ssim -f null -
  </code></pre>
  
  <p>When attempting to run this, I am given the error:</p>
  
  <pre><code>Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_ssim_0
  </code></pre>
  
  <p>Is there a way I can correct this so that the second input skips one frame and both are run through <code>-lavfi ssim</code>?</p>
  
Tags: <ffmpeg>
Title: Using FFmpeg -lavfi to calculate the SSIM of each frame
UserDisplayName: w0f
ThreadText: # Using FFmpeg -lavfi to calculate the SSIM of each frame
  
  (Asked by: username_0 on 2020-04-24)
  
  I would like to be able to take a single video, run it through ffmpeg, and have it spit out a log containing the SSIM of each frame with respect to the previous - that is, I want the SSIM scores comparing the previous frame to the current one.
  
  I am attempting to do so by running ffmpeg with the same video input twice, with the second input skipping ahead by one frame.
  
  ```
  ffmpeg -i .\a.mp4 -i .\a.mp4 -filter_complex "[1:v]select=gte(n\,1)[f]" -map 0:v:0 -map "[f]" -lavfi ssim -f null -
  
  ```
  
  When attempting to run this, I am given the error:
  
  ```
  Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_ssim_0
  
  ```
  
  Is there a way I can correct this so that the second input skips one frame and both are run through `-lavfi ssim`?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-24. Score: 0 | Accepted answer
  
  You have to perform all filtering in a single filtergraph.
  
  `ffmpeg -i .\a.mp4 -i .\a.mp4 -filter_complex "[0:v]setpts=N/FR/TB[v0];[1:v]select=gte(n\,1),setpts=N/FR/TB[v1];[v0][v1]ssim=f=stats.log" -f null -`
  
  > **Comments:**
  > **username_2**: ffmpeg says  `Filter setpts has an unconnected output` is this normal?  
  > **username_1**: No see edited answer  
  
  ---
  
  