imkira / go-libav Goto Github PK
View Code? Open in Web Editor NEWGo language bindings for ffmpeg libraries
License: MIT License
Go language bindings for ffmpeg libraries
License: MIT License
mingw-w64-i686-ffmpeg 4.0-1
# github.com/SpalkLtd/go-libav/avcodec
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:201:45: could not determine kind of name for C.CODEC_CAP_AUTO_THREADS
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:197:45: could not determine kind of name for C.CODEC_CAP_CHANNEL_CONF
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:192:45: could not determine kind of name for C.CODEC_CAP_DELAY
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:189:45: could not determine kind of name for C.CODEC_CAP_DR1
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:188:45: could not determine kind of name for C.CODEC_CAP_DRAW_HORIZ_BAND
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:196:45: could not determine kind of name for C.CODEC_CAP_EXPERIMENTAL
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:198:45: could not determine kind of name for C.CODEC_CAP_FRAME_THREADS
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:203:45: could not determine kind of name for C.CODEC_CAP_INTRA_ONLY
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:204:45: could not determine kind of name for C.CODEC_CAP_LOSSLESS
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:200:45: could not determine kind of name for C.CODEC_CAP_PARAM_CHANGE
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:199:45: could not determine kind of name for C.CODEC_CAP_SLICE_THREADS
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:193:45: could not determine kind of name for C.CODEC_CAP_SMALL_LAST_FRAME
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:195:45: could not determine kind of name for C.CODEC_CAP_SUBFRAMES
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:190:45: could not determine kind of name for C.CODEC_CAP_TRUNCATED
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:202:45: could not determine kind of name for C.CODEC_CAP_VARIABLE_FRAME_SIZE
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:179:34: could not determine kind of name for C.CODEC_FLAG2_CHUNKS
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:177:34: could not determine kind of name for C.CODEC_FLAG2_DROP_FRAME_TIMECODE
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:181:34: could not determine kind of name for C.CODEC_FLAG2_EXPORT_MVS
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:174:34: could not determine kind of name for C.CODEC_FLAG2_FAST
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:178:34: could not determine kind of name for C.CODEC_FLAG2_IGNORE_CROP
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:176:34: could not determine kind of name for C.CODEC_FLAG2_LOCAL_HEADER
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:175:34: could not determine kind of name for C.CODEC_FLAG2_NO_OUTPUT
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:180:34: could not determine kind of name for C.CODEC_FLAG2_SHOW_ALL
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:182:34: could not determine kind of name for C.CODEC_FLAG2_SKIP_MANUAL
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:153:28: could not determine kind of name for C.CODEC_FLAG_4MV
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:165:28: could not determine kind of name for C.CODEC_FLAG_AC_PRED
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:164:28: could not determine kind of name for C.CODEC_FLAG_BITEXACT
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:168:28: could not determine kind of name for C.CODEC_FLAG_CLOSED_GOP
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:163:28: could not determine kind of name for C.CODEC_FLAG_GLOBAL_HEADER
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:158:28: could not determine kind of name for C.CODEC_FLAG_GRAY
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:161:28: could not determine kind of name for C.CODEC_FLAG_INTERLACED_DCT
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:167:28: could not determine kind of name for C.CODEC_FLAG_INTERLACED_ME
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:166:28: could not determine kind of name for C.CODEC_FLAG_LOOP_FILTER
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:162:28: could not determine kind of name for C.CODEC_FLAG_LOW_DELAY
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:154:28: could not determine kind of name for C.CODEC_FLAG_OUTPUT_CORRUPT
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:156:28: could not determine kind of name for C.CODEC_FLAG_PASS1
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:157:28: could not determine kind of name for C.CODEC_FLAG_PASS2
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:159:28: could not determine kind of name for C.CODEC_FLAG_PSNR
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:155:28: could not determine kind of name for C.CODEC_FLAG_QPEL
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:152:28: could not determine kind of name for C.CODEC_FLAG_QSCALE
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:160:28: could not determine kind of name for C.CODEC_FLAG_TRUNCATED
..\.gopath\src\github.com\SpalkLtd\go-libav\avcodec\avcodec.go:151:28: could not determine kind of name for C.CODEC_FLAG_UNALIGNED
Hi,
Is there a way to include hlsenc (a part of libavformat) to be able to encrypt HLS content?
./transcoder.go:114: codecCtx.CopyTo undefined (type *avcodec.Context has no field or method CopyTo)
./transcoder.go:224: ctx.encCodec.CopyTo undefined (type *avcodec.Context has no field or method CopyTo)
./transcoder.go:257: ctx.decCodec.DecodeVideo undefined (type *avcodec.Context has no field or method DecodeVideo)
./transcoder.go:315: ctx.encCodec.EncodeVideo undefined (type *avcodec.Context has no field or method EncodeVideo)
Hi, I'm just wondering if @imkira and @Prendo93 (SparkLtd) are working together on the changes to (the now-divered?) go-libav projects? SparkLtd seems to be fixing bugs and adjusting APIs, but I'm not sure if they will contribute back?
Which project should one use?
FWIW, I can't get the transcoding example to work with either master branch right now... Are there other examples?
I use this function from example
func firstVideoStream(fmtCtx *avformat.Context) *avformat.Stream { for _, stream := range fmtCtx.Streams() { switch stream.CodecContext().CodecType() { case avutil.MediaTypeVideo: return stream } } return nil }
Why I always get 0 (zero) from this call stream.CodecContext().CodecType()? Test with type data video, image, text, etc.
Got the following errors
$ go get -u github.com/imkira/go-libav/avfilter
# github.com/imkira/go-libav/avfilter
../../imkira/go-libav/avfilter/avfilter.go:234: l.CAVFilterLink.status undefined (type *C.struct_AVFilterLink has no field or method status)
../../imkira/go-libav/avfilter/avfilter.go:242: l.CAVFilterLink.frame_count undefined (type *C.struct_AVFilterLink has no field or method frame_count)
It seems in ffmpeg 3.3, status got repurposed as "ready" in FFmpeg/FFmpeg@02aa070#diff-922654fd0bdecbcd8ccee2c39549c46f
and frame_count turned into frame_count_in and frame_count_out in commit FFmpeg/FFmpeg@183ce55#diff-922654fd0bdecbcd8ccee2c39549c46f
One way to resolve would be to remove these functions:
func (l *Link) Status() int {
return int(l.CAVFilterLink.status)
}
func (l *Link) FrameCount() int64 {
return int64(l.CAVFilterLink.frame_count)
}
any idea?
dear author,how to push video frame image to rtmp server,like this:
./ffmpeg -re -rtsp_transport tcp -i "rtsp://192.168.10.64:554/h264/ch1/sub/av_stream" -s 800x600 -an -f flv "rtmp://192.168.10.107:10000/stream/hello"
This should be easy but I'm having trouble :)
How to add time out when OpenInput. Because it will be block infinity when open input then disable network.
Hi all!
Tell me please which current ffmpeg docker image is right to use go-libav with it?
For example I'm trying use it with ffmpeg3.1.3 from https://hub.docker.com/r/alfpark/ffmpeg
In my case in Dockerfile has next steps:
FROM alfpark/ffmpeg:3.1.3.as ffmpeg
FROM golang:alpine
RUN apk add --update --no-cache \
git faac\
musl-dev coreutils build-base nasm ca-certificates curl tar \
openssl-dev zlib-dev yasm-dev lame-dev freetype-dev opus-dev \
rtmpdump-dev x264-dev x265-dev xvidcore-dev libass-dev libwebp-dev \
libvorbis-dev libogg-dev libtheora-dev libvpx-dev pkgconfig
COPY --from=ffmpeg /usr/local /usr/local
//create my go repo and app
....
ENTRYPOINT /go/bin/run_my_go_app
In my app I just try register all codecs avformat.RegisterAll()
But it return's me error
# github.com/myrepo/vendor/github.com/imkira/go-libav/avcodec
/usr/lib/gcc/x86_64-alpine-linux-musl/8.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lfaac
collect2: error: ld returned 1 exit status
At the same time I'll add faac package at the begging
Thanks!
The fact that ffmpeg API support is stuck at v3.3 and ffmpeg 5.0 is out, is this project dead?
I tried to Cross-compile this library from linux to windows.
I modified the Makefile (ffmpeg30 part) as follow:
wget -O ffmpeg30.tar.bz2 http://ffmpeg.org/releases/ffmpeg-3.0.8.tar.bz2 mkdir ffmpeg30 && tar xf ffmpeg30.tar.bz2 -C ffmpeg30 --strip-components=1 && cd ffmpeg30 && ./configure --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --prefix=/usr/local --disable-debug --enable-pthreads --enable-nonfree --enable-gpl --disable-indev=jack && make -j6 && sudo make install
and it all works good but when I try to compile the example with:
GOOS=windows GOARCH=386 CGO_ENABLED=1 CXX=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc go build -tags ffmpeg30
i get the following error:
# github.com/imkira/go-libav/avutil /usr/local/lib/libavutil.a(log.o):log.c:(.text+0x1da): undefined reference to 'pthread_mutex_lock' /usr/local/lib/libavutil.a(log.o):log.c:(.text+0x69a): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x20): undefined reference to 'pthread_mutex_lock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x31): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x81): undefined reference to 'pthread_mutex_destroy' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x767): undefined reference to 'pthread_mutex_init' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x7f3): undefined reference to 'pthread_mutex_destroy' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x81f): undefined reference to 'pthread_mutex_lock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x8a6): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x956): undefined reference to 'pthread_mutex_unlock' /usr/local/lib/libavutil.a(buffer.o):buffer.c:(.text+0x968): undefined reference to 'pthread_mutex_unlock' collect2: error: ld returned 1 exit status
so I tried to modify the source adding some CFLAGS:
//#cgo CFLAGS: -pthread //#cgo CFLAGS: -lpthread //#cgo CFLAGS: -pedantic //#cgo CFLAGS: -Wextra //#cgo CFLAGS: -Wall //#include <pthread.h> //#include <lpthread.h> import "C"
I didn't read it was supposed to work on windows nor i did read the opposit tho
Is there an example on how to do this? How would this be done?
mudu ~/gopath/src/github.com/imkira/go-libav/examples $ go build
./# github.com/imkira/go-libav/avutil
cgo-gcc-prolog:273:48: warning: incompatible pointer types passing 'void *const *' to parameter of type 'double (*const *)(void *, double)' [-Wincompatible-pointer-types]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavutil/eval.h:76:69: note: passing argument to parameter 'funcs1' here
cgo-gcc-prolog:273:62: warning: incompatible pointer types passing 'void *const *' to parameter of type 'double (*const *)(void *, double, double)' [-Wincompatible-pointer-types]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavutil/eval.h:77:69: note: passing argument to parameter 'funcs2' here
e
# github.com/imkira/go-libav/avcodec
cgo-gcc-prolog:37:2: warning: 'av_bitstream_filter_close' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:5881:6: note: 'av_bitstream_filter_close' has been explicitly marked deprecated here
cgo-gcc-prolog:52:25: warning: 'av_bitstream_filter_init' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:5837:27: note: 'av_bitstream_filter_init' has been explicitly marked deprecated here
cgo-gcc-prolog:245:6: warning: 'avcodec_copy_context' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:4241:5: note: 'avcodec_copy_context' has been explicitly marked deprecated here
cgo-gcc-prolog:266:6: warning: 'avcodec_decode_audio4' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:4763:5: note: 'avcodec_decode_audio4' has been explicitly marked deprecated here
cgo-gcc-prolog:287:6: warning: 'avcodec_decode_video2' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:4812:5: note: 'avcodec_decode_video2' has been explicitly marked deprecated here
cgo-gcc-prolog:360:6: warning: 'avcodec_encode_audio2' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:5284:5: note: 'avcodec_encode_audio2' has been explicitly marked deprecated here
cgo-gcc-prolog:381:6: warning: 'avcodec_encode_video2' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavcodec/avcodec.h:5323:5: note: 'avcodec_encode_video2' has been explicitly marked deprecated here
# github.com/imkira/go-libav/avformat
cgo-gcc-prolog:43:6: warning: 'av_apply_bitstream_filters' is deprecated [-Wdeprecated-declarations]
/usr/local/Cellar/ffmpeg/3.2.4/include/libavformat/avformat.h:2940:5: note: 'av_apply_bitstream_filters' has been explicitly marked deprecated here
mudu ~/gopath/src/github.com/imkira/go-libav/examples $ ./examples
Killed: 9
Not only this,
it seems all ffmpeg golang-binding has the same problem
i very recently tried to run transcoder.go
ffmpeg -version
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.1.1 (GCC) 20170516
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
i tried it with input files as mp4 and mkv
the error seems to be either naming or invalid combination of filters in the input buffer
running the transcoder with a test file from http://jell.yfish.us/ to make sure its reproduceable
/tmp/Transcodergo --input=jellyfish-3-mbps-hd-h264.mkv --output=out.mkv
GOROOT=/usr/lib/go
GOPATH=/home/nikky/go
/usr/lib/go/bin/go build -tags ffmpeg33 -o /tmp/Transcodergo /home/nikky/dev/GCT/transcoder.go
[NULL @ 0x1affe40] Opening 'jellyfish-3-mbps-hd-h264.mkv' for reading
[file @ 0x1b005c0] Setting default whitelist 'file,crypto'
[matroska,webm @ 0x1affe40] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 0x1affe40] Before avformat_find_stream_info() pos: 5527 bytes read:32768 seeks:0 nb_streams:1
[h264 @ 0x1b02260] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x1b02260] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x1b02260] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x1b02260] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x1b02260] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x1b02260] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x1b02260] no picture
[matroska,webm @ 0x1affe40] All info found
[matroska,webm @ 0x1affe40] After avformat_find_stream_info() pos: 75158 bytes read:98304 seeks:0 frames:3
Input #0, matroska,webm, from 'jellyfish-3-mbps-hd-h264.mkv':
Metadata:
encoder : libebml v1.2.0 + libmatroska v1.1.0
creation_time : 2016-02-06T03:58:03.000000Z
Duration: 00:00:30.03, start: 0.000000, bitrate: 2984 kb/s
Stream #0:0(eng), 3, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
[h264 @ 0x1b07e60] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x1b07e60] nal_unit_type: 8, nal_ref_idc: 3
detected 4 logical cores
[in @ 0x1b06a60] Invalid parameters provided.
2017/06/30 20:33:29 Failed to initialize buffer filter: Invalid argument
Process finished with exit code 1
because i know barely anything about lib-av or ffmpeg i am not able to figure out if the C calls or the values ffmpeg expects have changed.. just to make sure its not a problem with this system i will try out on a windows machine later today or tomorrow
also.. is there a easy to use guide to be able to convert commandline ffmpeg options into the corresponding commands that have to be called in C / Go ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.