commit 5858e35d0fe0311a1691e016aecc7d71a6ed857c
parent 22c8ff45ecfdcd7f083bf363c017b89bdcaca1f6
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date: Tue, 13 Nov 2018 17:05:50 +1300
[-] Start and End handled in download code; so we can emit it in the
conversion code.
Diffstat:
5 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/cmd/cli/main.go b/cmd/cli/main.go
@@ -59,7 +59,7 @@ func main() {
ffmpeg := giffer.FFMpeg{
Debug: debug,
}
- gif, err := ffmpeg.Convert(videofile, start, end, fps, width, height, "gif", "gif")
+ gif, err := ffmpeg.Convert(videofile, fps, width, height, "gif", "gif")
if err != nil {
log.Fatalf("converting to gif: %v", err)
}
diff --git a/cmd/desktop/giffer.go b/cmd/desktop/giffer.go
@@ -71,7 +71,7 @@ func (g Giffer) make(
if err != nil {
return nil, errors.Wrap(err, "downloading")
}
- gif, err := g.Convert(video, start, end, fps, width, height, "gif", "gif")
+ gif, err := g.Convert(video, fps, width, height, "gif", "gif")
img := &RenderedGif{
Reader: gif,
FileName: sanitiseFilepath(strings.Split(filepath.Base(video), ".")[0] + ".gif"),
diff --git a/ffmpeg.go b/ffmpeg.go
@@ -19,18 +19,12 @@ type FFMpeg struct {
// If end is zero we convert from start until the end of the video.
func (f FFMpeg) Convert(
video string,
- start, end float64,
fps float64,
width, height int,
encoding, format string,
) (*bytes.Buffer, error) {
var out bytes.Buffer
- args := []string{
- "-ss", fmt.Sprintf("%4f", start),
- }
- if end > 0 && end-start > 0 {
- args = append(args, "-t", fmt.Sprintf("%2f", end-start))
- }
+ var args []string
args = append(args, "-i", video)
if width > 0 || height > 0 || fps > 0 {
var vfargs []string
diff --git a/go.mod b/go.mod
@@ -9,7 +9,7 @@ require (
github.com/gorilla/mux v1.6.2
github.com/gorilla/websocket v1.4.0
github.com/hashicorp/go-multierror v1.0.0
- github.com/jackmordaunt/video-downloader v0.0.0-20181113032415-88f45b3022a3
+ github.com/jackmordaunt/video-downloader v0.0.0-20181113035814-f0fc43af906f
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/pkg/errors v0.8.0
github.com/zserge/webview v0.0.0-20181018084947-f390a2df9ec5
diff --git a/go.sum b/go.sum
@@ -24,8 +24,8 @@ github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/U
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
-github.com/jackmordaunt/video-downloader v0.0.0-20181113032415-88f45b3022a3 h1:GUA1WFrAuZaFcq7S5yVNRkYgKMLBqK/t90pNZiEGLIg=
-github.com/jackmordaunt/video-downloader v0.0.0-20181113032415-88f45b3022a3/go.mod h1:0wZq7bsiv4eGa0JACeruRKck7gkYwIqJA/urPORdDh4=
+github.com/jackmordaunt/video-downloader v0.0.0-20181113035814-f0fc43af906f h1:s8lYjFD/vbFKQ6NkbDCkdTtWRb2LCNCtQXODb3EERgA=
+github.com/jackmordaunt/video-downloader v0.0.0-20181113035814-f0fc43af906f/go.mod h1:0wZq7bsiv4eGa0JACeruRKck7gkYwIqJA/urPORdDh4=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=