使用七牛抓取资源功能,将微信上的录音的音频抓取出来,放到七牛存储,但是抓取的是amr格式,不能播放,需要将音频转化为mp3格式的.我用的是sdk是7.0.0版本,搞了一天,快崩溃了.已经成功抓取到了,就是没有办法转码.哪位仁兄知道呢?感谢感谢!我将OperationManager添加进来了,7.0.0版本没这个类.方法实现如下 Auth auth = Auth.create(QiNiuConstant.ACCESSKEY, QiNiuConstant.SECRETKEY);OperationManager operater = new OperationManager(auth);String bucket = event.getFetchVo().getBucket();String key = event.getFetchVo().getFilePath().toString() event.getFetchVo().getKey();// 设置转码操作参数String fops = "avthumb/mp3/s/640x360/vb/1.25m";// 设置转码的队列String pipeline = "weixinteachervoice";// 可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间。String urlbase64 = UrlSafeBase64.encodeToString(bucket + ":" + key);String pfops = fops + "|saveas/" + urlbase64;// 设置pipeline参数StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("persistentPipeline", pipeline);{ String persistid = operater.pfop(bucket, key, pfops, params); System.out.println("transcod success : " + persistid);} catch (QiniuException e) { Response r = e.response; logger.info("transcod fail :" + r.toString()); try { System.out.println(r.bodyString()); } catch (QiniuException e1) { logger.info("transcod fail : can't print response"); }}logger.info("transcode end " );
添加回答
举报
0/150
提交
取消