iosswiftavplayerscreen-recording

Is it possible to record the playback of a video without losing video quality?


I am displaying a video in my app using AVPlayer. I want to build a feature that lets users make a video copy of themselves manipulating the video in the player, and I'd love it if I didn't lose quality.

The reason for this feature is to allow users to decide how they want the playback to go. It could be that they want to let it go, pause it, rewind it, fast forward it, etc. I want to make a video copy of them as they slide the video forward and backward.

I could obviously accomplish this with the screen recording API, but that means that the video quality would go down dramatically. I'm not even sure if what I am looking for is possible.


Solution

  • If the resolution and frame rate of the original material is sufficiently lower than the resolution of the screen and the rate at which you capture it, then it's certainly possible. Consider the limiting case of a single 100x100 "pixel" that changes color exactly once a second. It would certainly be possible to build something that captured that with perfect fidelity.

    But in general, the source material is likely of higher resolution and frame rate than your sampling will be, and you will lose quality, generally substantial quality (as you've discovered). Even if they were equal, you will lose some due to rendering artifacts. To do this, the source must be significantly lower quality than the capturing system, which probably does not match your hopes.

    If you controlled the software that was doing the manipulation, you could screen record the manipulation and then re-insert the video at its original quality (or as close as possible, given the likely smaller target resolution). Alternately, you could post-process the screen capture to insert the video within the application. (This final approach is likely unworkable in practice.)