Closed AugustusGreenwood closed 10 months ago
This is fantastic! We have been wanting to update this for some time, but this code was originally written by a student who no longer works with us, and unfortunately, none of us have any experience with ffmpeg. I've tested this, and it works great on my end.
Thank you so much!
Great! Love your guys' project, extremely happy to contribute!
Fixed depreciated FFmpeg functions, brought to version 6.0.
Explanation: avpicture_fill is almost 1-1 to av_image_fill_arrays.
avcodec_register_all is not required in newer versions, but wanted it to remain backwards compatible so I wrapped it in an if pre-processor statement checking ffmpeg version.
avcodec_encode_video2 was depreciated to manually sending frames and receiving packets, I enclosed this functionality in another MPEGAnimation method, 'EncodeVideo', which should work as the encode video function did. To see an example I followed, see the following example file on ffmpeg's official documentation: https://ffmpeg.org/doxygen/6.0/encode_video_8c-example.html
My understanding is that except for avcodec_register_all, the functions I included are compatible with all versions of FFmpeg so backwards compatibility shouldn't be an issue regardless of version, but I tested with 6.1 and 3.4.
In the CMakeLists file, I removed the "libavresample" requirement in the cmake file, this made the windows and unix the same so I deleted the if else block.
Testing: I built with both ffmpeg version 6.1 and 3.4 and had no problems starting, recording, pausing and outputting animations with either. No problems afterwards viewing, no signs of incorrectly outputted data or corruption.