asticode / go-astiav

Golang ffmpeg and libav C bindings
MIT License
393 stars 45 forks source link

POC: Build with FFmpeg n6.1.1 #57

Closed Tryanks closed 7 months ago

Tryanks commented 7 months ago

In this PR, I made the smallest possible changes to make go-astiav work with FFmpeg n6.1.1. It is merely a proof of concept: for tasks limited to simple encoding, decoding, and filtering, most of the library's code works effectively.

It must be stated that this library is absolutely not ready for merging, nor will it be in the future. There are many breaking changes from FFmpeg 5.x -> 6.x that need to be adapted, such as:

# github.com/asticode/go-astiav
cgo-gcc-prolog: In function ‘_cgo_62ea77cbc7a2_Cfunc_av_stream_get_side_data’:
cgo-gcc-prolog:57:2: warning: ‘av_stream_get_side_data’ is deprecated [-Wdeprecated-declarations]
In file included from /root/go/pkg/mod/github.com/!tryanks/go-astiav@v0.14.0/stream.go:4:
/usr/local/include/libavformat/avformat.h:1913:10: note: declared here
 1913 | uint8_t *av_stream_get_side_data(const AVStream *stream,
      |          ^~~~~~~~~~~~~~~~~~~~~~~
cgo-gcc-prolog: In function ‘_cgo_62ea77cbc7a2_Cfunc_av_stream_new_side_data’:
cgo-gcc-prolog:78:2: warning: ‘av_stream_new_side_data’ is deprecated [-Wdeprecated-declarations]
/usr/local/include/libavformat/avformat.h:1898:10: note: declared here
 1898 | uint8_t *av_stream_new_side_data(AVStream *stream,
      |          ^~~~~~~~~~~~~~~~~~~~~~~

And other new APIs, etc. Another issue that must be considered is that its changes are significant enough to affect any project currently using go-astiav, so it definitely should not be merged.

If this library can be of help to anyone, you could adding the following section in go.mod to use it:

replace github.com/asticode/go-astiav => github.com/Tryanks/go-astiav v0.14.0

But this fork will not receive any maintenance or updates. For anyone interested in using FFmpeg Bindings in Go, the only correct choice is still asticode/go-astiav. Have fun :)

P.S. I wrote this just to make go-astiav work with ffmpeg-rockchip so that it can utilize the hardware encoder/decoder on my RK3588 board.

EDIT: Now you could clone Quentin's great branch [bump/n6.1.1] built with FFmpeg n6.1.1 👍.

git clone -b bump/n6.1.1 https://github.com/asticode/go-astiav  /home/user/go-astiav

In your project's go.mod

replace github.com/asticode/go-astiav => /home/user/go-astiav
asticode commented 7 months ago

First off thanks for the PR 👍

However, I've had for quite some time a local branch with unfinished changes to bump to n6.0. Your PR reminded me I had to finish it and that's what I did: it's available on the branch called bump/n6.1.1

If you don't mind I'll close this PR, but I'd be happy to have your feedback on the content of this new branch 👍