<p>Use the select filter to drop unwanted frames.</p>
<p>This is the basic syntax:</p>
<pre><code>ffmpeg -i distorted -i ref -filter_complex &quot;[0]settb=AVTB,setpts=N[ds];[1]settb=AVTB,select='not(eq(n\,3)+eq(n\,717))',setpts=N[rf];[ds][rf]ssim&quot; -f null -
</code></pre>

CC BY-SA 4.0
2021-01-07T04:18:51.230Z
2021-01-07T04:18:51.230Z
Gyan
<p>I would like to calculate the SSIM for two videos by ffmpeg: the original video and the distorted video.</p>
<p>The case is the distorted video was generated by some kind of GPU of android devices, and it might miss some frames, for example, the original video has <code>720</code> frames, meanwhile the distorted one has <code>718</code>.</p>
<p>Suppose we know the specific indices of the frames that was drop(For example, by calculating the <code>MSE_U</code> frame by frame), how to calculate the SSIM by ignoring some specific frames of the original video?</p>
<p>For example, we have know that the index <code>3</code> and index <code>717</code> was not exists in the distorted one, in order to SSIM, we should ignore these frames from the original one.</p>
<p>I've read the post <a href="https://video.stackexchange.com/questions/28936/comparing-psnr-ssim-of-two-videos-with-different-fps-bit-depth">Comparing PSNR/SSIM of two videos with different fps/bit-depth</a> , <a href="https://video.stackexchange.com/questions/12233/drop-similar-frames">drop similar frames</a> and <a href="https://video.stackexchange.com/questions/20958/ffmpeg-dropping-duplicate-frames">FFmpeg - dropping duplicate frames</a> , it seems that they are not applying to my specific case.</p>

<ffmpeg>
Is it possible to drop some specific frames when comparing SSIM by ffmpeg?
alwaysday1
# Is it possible to drop some specific frames when comparing SSIM by ffmpeg?

(Asked by: username_0 on 2021-01-07)

I would like to calculate the SSIM for two videos by ffmpeg: the original video and the distorted video.

The case is the distorted video was generated by some kind of GPU of android devices, and it might miss some frames, for example, the original video has `720` frames, meanwhile the distorted one has `718`.

Suppose we know the specific indices of the frames that was drop(For example, by calculating the `MSE_U` frame by frame), how to calculate the SSIM by ignoring some specific frames of the original video?

For example, we have know that the index `3` and index `717` was not exists in the distorted one, in order to SSIM, we should ignore these frames from the original one.

I've read the post [Comparing PSNR/SSIM of two videos with different fps/bit-depth](https://video.stackexchange.com/questions/28936/comparing-psnr-ssim-of-two-videos-with-different-fps-bit-depth) , [drop similar frames](https://video.stackexchange.com/questions/12233/drop-similar-frames) and [FFmpeg - dropping duplicate frames](https://video.stackexchange.com/questions/20958/ffmpeg-dropping-duplicate-frames) , it seems that they are not applying to my specific case.

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2021-01-07. Score: 1 | Accepted answer

Use the select filter to drop unwanted frames.
This is the basic syntax:
ffmpeg -i distorted -i ref -filter_complex "[0]settb=AVTB,setpts=N[ds];[1]settb=AVTB,select='not(eq(n\,3)+eq(n\,717))',setpts=N[rf];[ds][rf]ssim" -f null -


---

