Using ffmpeg, I want to overlay Line.avi on top of Stationary.avi, using a black color…
- User
Using ffmpeg, I want to overlay
Line.avion top ofStationary.avi, using a black color key on the former. I've come up with this command line:codeffmpeg -y -i Stationary.avi -i Line.avi -filter_complex "[1:v]colorkey=0x000000[l]; [0:v][l]overlay" -vcodec zmbv -acodec copy out.aviHowever, the colors in the output are ruined, presumably because they get converted from RGB to YUV in the process. How can I perform the overlay entirely within the RGB colorspace?
Assistant
The issue you're encountering is indeed due to colorspace conversion. FFmpeg often converts RGB to YUV by default, which can cause color shifts. Here's how to perform the overlay entirely within the RGB colorspace:
bashffmpeg -y -i Stationary.avi -i Line.avi -filter_complex "[1:v]format=rgb24,colorkey=0x000000:0.1:0.1[l]; [0:v]format=rgb24[bg]; [bg][l]overlay:format=rgb24" -vcodec zmbv -acodec copy out.aviKey changes made:
- : This ensures both videos are processed in RGB24 format
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.