From 74b2f9899a271ca5eef01931acef4492c8ef47b4 Mon Sep 17 00:00:00 2001 From: nareix Date: Fri, 29 Jul 2016 08:16:24 +0800 Subject: [PATCH] avconv: fix encoder find bug --- av/avconv/avconv.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/av/avconv/avconv.go b/av/avconv/avconv.go index fdb0203..cde02f9 100644 --- a/av/avconv/avconv.go +++ b/av/avconv/avconv.go @@ -81,15 +81,17 @@ func (self *Demuxer) prepare() (err error) { } ok = true + var enctype av.CodecType for _, typ:= range supports { if typ.IsAudio() { - if enc, _ = avutil.DefaultHandlers.NewAudioEncoder(typ); dec != nil { + if enc, _ = avutil.DefaultHandlers.NewAudioEncoder(typ); enc != nil { + enctype = typ break } } } if enc == nil { - err = fmt.Errorf("avconv: convert %s failed", codec.Type()) + err = fmt.Errorf("avconv: convert %s->%s failed", codec.Type(), enctype) return }