Does not compile
When I run the encode_video example, I get the following output when compiling:
../../audio_codec_context.go:22:13: cannot use _Ctype_long(bitrate) (type _Ctype_long) as type _Ctype_longlong in assignment
../../audio_codec_context.go:24:19: cannot use chLayout.ctype() (type _Ctype_ulong) as type _Ctype_ulonglong in assignment
../../audio_codec_context_opt.go:9:28: cannot use _Ctype_long(bitrate) (type _Ctype_long) as type _Ctype_longlong in assignment
../../audio_codec_context_opt.go:21:34: cannot use _Ctype_ulong(layout) (type _Ctype_ulong) as type _Ctype_ulonglong in assignment
../../audio_frame.go:17:19: cannot use channelLayout.ctype() (type _Ctype_ulong) as type _Ctype_ulonglong in assignment
../../audio_frame.go:51:20: cannot use _Ctype_long(pts) (type _Ctype_long) as type _Ctype_longlong in assignment
../../codec_parametes.go:111:3: cannot use parms.ChannelLayout.ctype() (type _Ctype_ulong) as type _Ctype_ulonglong in field value
../../video_codec_context.go:50:19: cannot use _Ctype_long(calculateBitrate(int(context.height), int(context.framerate.num))) (type _Ctype_long) as type _Ctype_longlong in assignment
../../video_codec_context.go:61:20: cannot use _Ctype_long(calculateBitrate(int(context.height), int(context.framerate.num))) (type _Ctype_long) as type _Ctype_longlong in assignment
../../video_codec_context_opt.go:10:29: cannot use _Ctype_long(bitrate) (type _Ctype_long) as type _Ctype_longlong in assignment
../../video_codec_context_opt.go:10:29: too many errors
I noticed that you do not use pkg-config anywhere. Maybe this is your issue? For cross-platform support, this library most likely needs the line
#cgo pkg-config: <libavutil> <libavcodec>
where you would put libavutil, libavcodec, and other libraries based on if they are needed. Example code
sory for late reply.
what version of libavcodec do you use? how did you install it?
I have not got such a problem.
#cgo pkg-config:
the latest revision of code has many errors. use the latest tag instead.
I am on macOS, maybe compiling is different? I will try using the latest tag
I don't know. I am on linux and I can't reproduce this error. try to install ffmpeg from source.
https://github.com/FFmpeg/FFmpeg/blob/1ad554a00b4df43605cc4d74b781aec0711afc20/libavcodec%2Favcodec.h#L576 bit_rate is an int64_t field. int64_t is a long type, not longlong.