parent
e732a7b860
commit
0414e09d58
3 changed files with 11 additions and 7 deletions
|
@ -319,8 +319,8 @@ func (c *Convert) AvcBitrate(f *MediaFile) string {
|
|||
|
||||
if bitrate <= 0 {
|
||||
return "8M"
|
||||
} else if bitrate >= 50 {
|
||||
return "50M"
|
||||
} else if bitrate >= 100 {
|
||||
return "100M"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%dM", bitrate)
|
||||
|
@ -337,13 +337,17 @@ func (c *Convert) AvcConvertCommand(f *MediaFile, avcName, codecName string) (re
|
|||
c.conf.FFmpegBin(),
|
||||
"-i", f.FileName(),
|
||||
"-c:v", codecName,
|
||||
"-c:a", "copy",
|
||||
"-c:a", "libmp3lame",
|
||||
"-vf", format,
|
||||
"-num_output_buffers", strconv.Itoa(c.conf.FFmpegBuffers()+8),
|
||||
"-num_capture_buffers", strconv.Itoa(c.conf.FFmpegBuffers()),
|
||||
"-max_muxing_queue_size", "1024",
|
||||
"-crf", "23",
|
||||
"-vsync", "vfr",
|
||||
"-r", "30",
|
||||
"-b:v", c.AvcBitrate(f),
|
||||
"-f", "mp4",
|
||||
"-y",
|
||||
avcName,
|
||||
)
|
||||
} else {
|
||||
|
|
|
@ -311,6 +311,6 @@ func TestConvert_AvcBitrate(t *testing.T) {
|
|||
mf.width = 4096
|
||||
mf.height = 2160
|
||||
|
||||
assert.Equal(t, "50M", convert.AvcBitrate(mf))
|
||||
assert.Equal(t, "100M", convert.AvcBitrate(mf))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ func ConvertWorker(jobs <-chan ConvertJob) {
|
|||
case job.convert == nil:
|
||||
continue
|
||||
case job.file.IsVideo():
|
||||
if _, err := job.convert.ToJson(job.file); err != nil {
|
||||
logError(err, job)
|
||||
} else if _, err := job.convert.ToJpeg(job.file); err != nil {
|
||||
_, _ = job.convert.ToJson(job.file)
|
||||
|
||||
if _, err := job.convert.ToJpeg(job.file); err != nil {
|
||||
logError(err, job)
|
||||
} else if metaData := job.file.MetaData(); metaData.CodecAvc() {
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue