Closed LentilStew closed 3 years ago
hi @LentilStew nice addition, usually the overlay is handled by the ffmpeg filtering (my intent is to do a next chapter on that).
If anyone wants to overlay the image this way, without it being ugly, you have to copy the frame and send the encoder a copy of the frame Remember to free the new frame
cool @LentilStew thanks for sharing!
Why do you need to copy format, width... even using the av_frame_copy_props
? (I don't know this API, just curious, by its name I suppose it should copy all the properties, I'm guessing)
I copied the code from here stackoverflow
But the av_frame_get_buffer() function says that "format (pixel format for video, sample format for audio)- width and height for video- nb_samples and channel_layout for audio" must be set before calling the function
and the function av_frame_copy_props() says that it does not copy pts, sample rate (for audio) or sample aspect ratio (for video), but not width/height or channel layout.
the av_frame_copy_props() only copies "metadata" fields from src to dst
I added this function in 3_transcoding.c It's called to draw an square in every frame it only changes the Y of the YUV file, I made it just to see if I could overlay images this way This is the fist frame of the video, screenshot from VLC^^ This is the last frame of the video, screenshot from VLC^^ This is the pgm output of the save_gray_frame function^^ This is another example of the save_gray_Frame function ^^ Is this the intended way to overlay images?, Are there other ways of doing it? I imagine that the image is weird because of the compression