ffmpeg-libav-tutorial icon indicating copy to clipboard operation
ffmpeg-libav-tutorial copied to clipboard

warning messages (forced frame type (5) at 80 was changed to frame type (3)) Solution

Open LentilStew opened this issue 2 years ago β€’ 1 comments

I'm making a transcoder and I had a similar issue, console output image

I found out, that if you copy the decoded frame to a new AVFrame and free the old frame, this doesn't appear anymore new console output image

I didn't make a pull request because I tried running the 3_transcoding.c file on my computer and I didn't see this error in the console, and I also don't know if this fix, is what you are looking for, or if it was already fixed

Now, to be honest, this was harder than I thought it'd be and I had to dig into the FFmpeg command line source code and test it a lot and I think I'm missing something because I had to enforce force-cfr for the h264 to work and I'm still seeing some warning messages like warning messages (forced frame type (5) at 80 was changed to frame type (3)).

C code copyFrame function snippet

int copyFrame(AVFrame* oldFrame, AVFrame* newFrame)
{
	int response;
	newFrame->pts = oldFrame->pts;
	newFrame->format = oldFrame->format;
	newFrame->width = oldFrame->width;
	newFrame->height = oldFrame->height;
	newFrame->channels = oldFrame->channels;
	newFrame->channel_layout = oldFrame->channel_layout;
	newFrame->nb_samples = oldFrame->nb_samples;
	response = av_frame_get_buffer(newFrame, 32);
	if (response != 0)
	{
		return ERROR;
	}
	response = av_frame_copy(newFrame, oldFrame);
	if (response >= 0)
	{
		return ERROR;
	}
	response = av_frame_copy_props(newFrame, oldFrame);
	if (response == NULL)
	{
		return ERROR;
	}
	return 0;
}

I don't have much experience using github, let me know if this is not the correct use for the issues page

LentilStew avatar Jul 19 '21 21:07 LentilStew

@LentilStew thanks for sharing, I'll try it later :) (the way I made it disappear, I think was by introducing the keyint parameters)

leandromoreira avatar Jul 28 '21 12:07 leandromoreira