I removed many duplicate frames from video (and completely removed audio) by this command
ffmpeg -i scene.mkv -vf mpdecimate,setpts=N/FRAME_RATE/TB -map:v 0 scene3.mp4
(by an Mulvya's answer, thanks again).
The resulting video is OK but the total duration will not change - the last frame of original video is frozen to fill the remaining time (when playing back the video).
Is there some way to trim the video so that it will finish at this last frame?