使用七牛抓取资源功能,将微信上的录音的音频抓取出来,放到七牛存储,但是抓取的是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 " );
To trigger persistent transcoding, please refer to the demo collection
http://7xnonj.com2.z0.glb.qiniucdn.com/i...
After fetching, I called the conversion interface. I just did this function yesterday, but the conversion was successful, but it still cannot be played under ios, which is frustrating. . .
In addition, the official documents are inconsistent in many places, and the sdk provided also has some errors. Only by combining the two can we come up with a conversion interface that can finally be used
Sorry, it can be played after converting it to mp3. I didn't notice that my phone was in silent mode at the time, so there was no sound, but it can actually be played. For related codes, please refer to http://www.cnblogs.com /weiniu/p/qiniu_fetch_convert_php.html
I use Python code, localfile is the path of your file.
However, I encountered a problem when transcoding recently, and the callbackurl returned instantly... but it was successful.