How can I use ffmpeg and only extract the frames that does not have artifacts (e.g. compression artifacts) from a video and save them with good quality in jpeg format .
Asked
Active
Viewed 484 times
0
-
You can try [extracting only I-frames (key frames)](https://superuser.com/questions/669716/how-to-extract-all-key-frames-from-a-video-clip). Key frames are not necessarily the best quality frames, but they have the advantage that the artifacts are relatively bounded. In case you are looking for an algorithm that finds the best quality frames, it's a different story... You should also look at: [How can I extract quality JPEG image from an H264 video file with ffmpeg?](https://stackoverflow.com/questions/10225403/how-can-i-extract-a-good-quality-jpeg-image-from-an-h264-video-file-with-ffmpeg) – Rotem Aug 13 '19 at 21:48
-
First you need a programmatic war to detect compression artifacts. I don't believe ffmpeg has a filter for that. – szatmary Aug 13 '19 at 22:04
-
Show example image of normal frame and example of next frame with compression artefact. You can use FFmpeg to extract individual frames and pass them through your function of "check image quality" (decide what makes a "bad" image and then tell the machine to look for such pixels) and then save to JPG. Which part of that is the problem? – VC.One Aug 14 '19 at 00:32
-
@VC.One can you provide a sample code that does that? – Albert Aug 14 '19 at 16:06