You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varbuf []image.Image// the codec is h264cap:=opencv.NewFileCapture("video.avi")
ifcap==nil {
panic("can not open video")
}
for {
ipli:=cap.QueryFrame()
ifipli==nil {
break
}
i:=ipli.ToImage()
buf=append(buf, i)
}
props:=videoProps{
fps: cap.GetProperty(opencv.CV_CAP_PROP_FPS),
fourcc: cap.GetProperty(opencv.CV_CAP_PROP_FOURCC),
width: cap.GetProperty(opencv.CV_CAP_PROP_FRAME_WIDTH),
height: cap.GetProperty(opencv.CV_CAP_PROP_FRAME_HEIGHT),
}
// fourcc is always 0 on mac, but it works wellw:=opencv.NewVideoWriter(v.destFile, int(props.fourcc), float32(props.fps), int(props.width), int(props.height), 1)
for_, img:=rangebuf {
w.WriteFrame(opencv.FromImage(image))
}
cap.Release()
w.Release()
On my mac, the above code can write video correctly, but it can just output a corrupt file when it runs on ubuntu. The corrupt file is very small, and can't be opened.
The text was updated successfully, but these errors were encountered:
On my mac, the above code can write video correctly, but it can just output a corrupt file when it runs on ubuntu. The corrupt file is very small, and can't be opened.
The text was updated successfully, but these errors were encountered: