<p>I don't know if FFmpeg supports the Camstudio Lossless Codec, but if it would. Then replacing the area with a PNG file (hence: adding a logo) could be a solution.</p>
<p>The explanation is done here at &quot;Timing the overlay&quot;.
<a href="https://superuser.com/questions/683643/how-to-add-my-logo-for-the-first-30-seconds-in-a-video-with-ffmpeg">https://superuser.com/questions/683643/how-to-add-my-logo-for-the-first-30-seconds-in-a-video-with-ffmpeg</a></p>
<p>In that example codec:a copy was already given (for audio). If you would take any lossless videocodec the result will be lossless.</p>

CC BY-SA 4.0
2021-05-04T10:07:31.207Z
I'm surprised the overlay filter processing does not take place at RGB or YUV444. Great catch.
Skinkie
CC BY-SA 4.0
2021-05-05T06:44:59.357Z
Thanks for pointing me to overlays, Skinkie!

I've checked Low power's answer at [ffmpeg - how to apply filters without losing quality](https://stackoverflow.com/questions/20435420/ffmpeg-how-to-apply-filters-without-losing-quality) and [overlays](https://ffmpeg.org/ffmpeg-all.html#toc-overlay-1) in FFmpeg documentation.

The command that will do the magic is:

`ffmpeg -hide_banner -i input.avi -i patch.png -filter_complex "[0:v][1:v]overlay=136:144:enable=between(t\,43.88\,98.44):format=auto" -f yuv4mpegpipe -pix_fmt yuv444p output.y4m`
Petr Diblík
CC BY-SA 4.0
2021-05-06T05:32:53.027Z
OK, it's not exactly lossless because the color space conversion from bgr24 to yuv444 alters the colors slightly. But I still internally consider it lossless because no artifacts are introduced and the output still has exactly 4 colors. :-)
Petr Diblík
CC BY-SA 4.0
2021-05-01T21:51:25.687Z
2021-05-01T21:51:25.687Z
Skinkie
<p>I would use <a href="https://www.blackmagicdesign.com/products/davinciresolve/edit" rel="nofollow noreferrer">Davinci Resolve</a> to do this.
It is free, runs on windows, and <a href="https://www.premiumbeat.com/blog/make-objects-disappear-davinci-resolve/" rel="nofollow noreferrer">has great object removal tools</a>.</p>

CC BY-SA 4.0
2021-05-05T13:07:36.617Z
2021-05-05T13:07:36.617Z
tomh
<p>I have a short screen recording of an old video game (duration 1:38.72, 2468 frames, 25 fps, 320×200 px, 4 colours only, bgr24, CamStudio Lossless Codec, no sound, AVI).</p>
<p>The video contains an incorrect area (static, 16×16 px, top left corner at [136, 144]) in a range of frames (starting at 0:43.88 and ending at 1:38.44).</p>
<p>I'd like to replace that area in that range with correct data, everything losslessly.</p>
<p>I searched for &quot;replace area in range of frames&quot; on this server but didn't find anything.</p>
<p>Would you know how to do that with free software on Windows please? Maybe FFmpeg?</p>

<editing><windows>
How to losslessly replace a specific area in a range of frames
Petr Diblík
# How to losslessly replace a specific area in a range of frames

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

I have a short screen recording of an old video game (duration 1:38.72, 2468 frames, 25 fps, 320×200 px, 4 colours only, bgr24, CamStudio Lossless Codec, no sound, AVI).

The video contains an incorrect area (static, 16×16 px, top left corner at [136, 144]) in a range of frames (starting at 0:43.88 and ending at 1:38.44).

I'd like to replace that area in that range with correct data, everything losslessly.

I searched for "replace area in range of frames" on this server but didn't find anything.

Would you know how to do that with free software on Windows please? Maybe FFmpeg?

**Tags:** editing, windows


---

## 2 answers

### Answer by username_1 on 2021-05-01. Score: 0

I don't know if FFmpeg supports the Camstudio Lossless Codec, but if it would. Then replacing the area with a PNG file (hence: adding a logo) could be a solution.

The explanation is done here at "Timing the overlay".
<https://superuser.com/questions/683643/how-to-add-my-logo-for-the-first-30-seconds-in-a-video-with-ffmpeg>

In that example codec:a copy was already given (for audio). If you would take any lossless videocodec the result will be lossless.

> **Comments:**
> **username_1**: I'm surprised the overlay filter processing does not take place at RGB or YUV444. Great catch.  
> **username_0**: Thanks for pointing me to overlays, username_1!  I've checked Low power's answer at [ffmpeg - how to apply filters without losing quality](https://stackoverflow.com/questions/20435420/ffmpeg-how-to-apply-filters-without-losing-quality) and [overlays](https://ffmpeg.org/ffmpeg-all.html#toc-overlay-1) in FFmpeg documentation.  The command that will do the magic is:  `ffmpeg -hide_banner -i input.avi -i patch.png -filter_complex "[0:v][1:v]overlay=136:144:enable=between(t\,43.88\,98.44):format=auto" -f yuv4mpegpipe -pix_fmt yuv444p output.y4m`  
> **username_0**: OK, it's not exactly lossless because the color space conversion from bgr24 to yuv444 alters the colors slightly. But I still internally consider it lossless because no artifacts are introduced and the output still has exactly 4 colors. :-)  

---

### Answer by username_2 on 2021-05-05. Score: 0

I would use [Davinci Resolve](https://www.blackmagicdesign.com/products/davinciresolve/edit) to do this.
It is free, runs on windows, and [has great object removal tools](https://www.premiumbeat.com/blog/make-objects-disappear-davinci-resolve/).


---

