Created
May 14, 2018 17:11
-
-
Save liangchaoboy/50478c7cd458959296ade5a0236b2cde to your computer and use it in GitHub Desktop.
get_vframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package qiniustg | |
import ( | |
"config" | |
"fmt" | |
"strings" | |
"strconv" | |
"github.com/qiniu/api.v7/auth/qbox" | |
"github.com/qiniu/api.v7/storage" | |
) | |
func HttpReq(recordsCh, retCh chan string, cg config.Config) { | |
for record := range recordsCh { | |
fs := strings.Split(record, "\t") | |
key := fs[0] | |
duration := fs[1] | |
imagekey := strings.Split(key, ".mp4") | |
time, _:=strconv.Atoi(duration) | |
var list int = time/5 | |
for i:=1 ; i <= list; i++{ | |
keyplus := i*5 | |
mac := qbox.NewMac(ak, sk) | |
cfg := storage.Config{ | |
UseHTTPS: false, | |
} | |
operationManager := storage.NewOperationManager(mac, &cfg) | |
fops_key := imagekey[0] + "_" + strconv.Itoa(keyplus) + ".jpg" | |
fops := fmt.Sprintf("vframe/jpg/offset/"+strconv.Itoa(keyplus)+"|saveas/%s", storage.EncodedEntry("vdownlog",fops_key )) | |
force := true | |
pipeline := "image" | |
operationManager.Pfop("vdown", key, fops, pipeline, "", force) | |
fmt.Printf("%s\t%d\t%d\t%s\n",key, i, keyplus, fops_key) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment