FFMediaToolkit icon indicating copy to clipboard operation
FFMediaToolkit copied to clipboard

Incorrect rotation calculation

Open hey-red opened this issue 7 months ago • 1 comments

I think something wrong with rotation in current version. https://github.com/radek-k/FFMediaToolkit/blob/master/FFMediaToolkit/Decoding/VideoStreamInfo.cs#L32

Previous version:

4.5.1. FFmpeg 6.1

var file = MediaFile.Open(@"C:\out.webm");
Console.WriteLine(file.VideoStreams.First().Info.Rotation); //=> 90

Current version:

4.6.0. FFmpeg 7.1

var file = MediaFile.Open(@"C:\out.webm");
Console.WriteLine(file.VideoStreams.First().Info.Rotation); //=> 179,99999966727137

hey-red avatar Jun 01 '25 12:06 hey-red

Oh well, you should pass value like this.

var packetSideData = ffmpeg.av_packet_side_data_get(codec->coded_side_data, codec->nb_coded_side_data, AVPacketSideDataType.AV_PKT_DATA_DISPLAYMATRIX);
if (packetSideData != null)
{
    Rotation = CalculateRotation((IntPtr)packetSideData->data);
}

hey-red avatar Jun 01 '25 13:06 hey-red