bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.51k stars 1.58k forks source link

FFmpegFrameRecorder no longer support "rotate" metadata #1976

Closed b005t3r closed 1 year ago

b005t3r commented 1 year ago

I think somewhere between version 1.5.4 and 1.5.7 rotation got moved to "Display Matrix" side data, when in 1.5.4 and prior it was set as "rotate" metadata, when decoding a video with ffmpeg. However, I don't think there's a matching change done in FFmpegFrameRecorder - in 1.5.4 is was simply setting the "rotate" metadata to a desired rotation value, but now it has no effect and I don't see a way of altering the side data on the output video.

Am I missing something or is it a bug?

saudet commented 1 year ago

That was removed with FFmpeg 5.0, so to support that with FFmpegFrameRecorder with FFmpeg 5.x, we probably need to go through AVPacketSideData as with FFmpegFrameGrabber, yes. As usual, contributions are welcome!

saudet commented 1 year ago

Concretely, we need to add a pair of getVideoSideData()/setVideoSideData() property methods to mirror FFmpegFrameGrabber as well as a helper method like setDisplayRotation().

saudet commented 1 year ago

I've added those in commit https://github.com/bytedeco/javacv/commit/b1c95f1fa838a9e3b11084095e11cb237682fbee. Please give it a try with the snapshots: http://bytedeco.org/builds/

saudet commented 1 year ago

JavaCV 1.5.9 has been released with those new methods! Enjoy