jpeg sample error
Error opening codec 'jpeg2000:JPEG 2000', averror: Invalid argument
error code line
codeCtx.go : 200 line
if averr := C.avcodec_open2(this.avCodecCtx, this.codec.avCodec, &avDict); averr < 0 { return errors.New(fmt.Sprintf("Error opening codec '%s:%s', averror: %s", this.codec.Name(), this.codec.LongName(), AvError(int(averr)))) }
Help me
@webinone Looks like you don't have jpeg2000 codec, check it with ffmpeg -codecs | grep -i jpeg
Hi, I'm getting the same error using your sample video:
2018/08/01 21:49:32 worker started 2018/08/01 21:49:32 worker started 2018/08/01 21:49:32 worker started [jpeg2000 @ 0x7000000] The encoder timebase is not set. [jpeg2000 @ 0x7800000] The encoder timebase is not set. goroutine 10 [running]: runtime/debug.Stack(0x43, 0xc4200f0000, 0x40cc4a0) /usr/local/Cellar/go/1.10.3/libexec/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /usr/local/Cellar/go/1.10.3/libexec/src/runtime/debug/stack.go:16 +0x22 main.fatal(0x4103720, 0xc4200da050) /Users/maurorappa/Go/video-to-jpeg.go:18 +0x22 main.encodeWorker(0xc42007c060, 0xc420016070, 0xc42000c0c0) /Users/maurorappa/Go/video-to-jpeg.go:73 +0x417 created by main.main /Users/maurorappa/Go/video-to-jpeg.go:138 +0x272 [jpeg2000 @ 0x6027200] 2018/08/01 21:49:32 Error opening codec 'jpeg2000:JPEG 2000', averror: Invalid argument The encoder timebase is not set. 2018/08/01 21:49:32 worker started exit status 1
here some info of my setup:
go version go1.10.3 darwin/amd64
ffmpeg -codecs | grep -i jpeg ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.39.2) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100 DEVILS jpeg2000 JPEG 2000 DEVILS jpegls JPEG-LS .EVI.S ljpeg Lossless JPEG DEVIL. mjpeg Motion JPEG D.VIL. mjpegb Apple MJPEG-B D.V.L. nuv NuppelVideo/RTJPEG D.V... smvjpeg Sigmatel Motion Video D.VIL. sp5x Sunplus JPEG (SP5X) D.A.L. adpcm_ima_smjpeg ADPCM IMA Loki SDL MJPEG
it seems installed, what else can I check?
@maurorappa Hi, your problem is different. [jpeg2000 @ 0x7000000] The encoder timebase is not set. The example is pretty old, now you have to set timebase for this encoder.
Just add
cc.SetTimeBase(AVR{1, 25})
Great! it's working! I'll raise a PR to update the example