mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
More FFmpeg optimizations when writer is a file
This commit is contained in:
parent
cddb6ce033
commit
8525b913b8
1 changed files with 9 additions and 7 deletions
|
|
@ -160,9 +160,9 @@ func (d Downloader) mergeSegmentsFFmpeg(files []string) error {
|
|||
}
|
||||
|
||||
var tmpfile string
|
||||
if _, ok := d.Writer.(*io.PipeWriter); ok {
|
||||
if _, ok := d.Writer.(*io.PipeWriter); !ok {
|
||||
if file, ok := d.Writer.(*os.File); ok {
|
||||
tmpfile = filepath.Base(file.Name())
|
||||
tmpfile = file.Name()
|
||||
}
|
||||
}
|
||||
if filepath.Ext(tmpfile) == "" {
|
||||
|
|
@ -198,12 +198,14 @@ func (d Downloader) mergeSegmentsFFmpeg(files []string) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if f, ok := d.Writer.(*os.File); !ok || f.Name() != tmpfile {
|
||||
file, err := os.Open(tmpfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
_, err = io.Copy(d.Writer, file)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue