Skip to content

Commit

Permalink
比特率为空则不使用比特率
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyiming748 committed Dec 27, 2023
1 parent da78bba commit de54cfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions conf.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[main]
# mission = i&v
# mission = video
mission = video
# mission = OGG
# mission = audio
# mission = image
Expand All @@ -17,7 +17,7 @@
# mission = v2a
# mission = aspect
# mission = louder
mission = ytdlp
# mission = ytdlp
[log]
level = Debug
# level = Info
Expand All @@ -33,7 +33,7 @@ txt = txt
folder = /Users/zen/git
image = /Volumes/noname
audio = /mnt/e/audio
video = /media/zen/Disk2/video
video = /mnt/f/large/artistress/littleSubGirl
gif = /Users/zen/Downloads/Fugtrup collection/archive/webp
txt = /Users/zen/Downloads/tele
bilibili = /sdcard/Android/data/tv.danmaku.bili/download
Expand Down
5 changes: 3 additions & 2 deletions processVideo/h265.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ func ProcessVideo2H265(in GetFileInfo.BasicInfo, threads string) {
cmd := exec.Command("ffmpeg", "-threads", threads, "-i", in.FullPath, "-c:v", "libx265", "-c:a", "aac", "-ac", "1", "-tag:v", "hvc1", "-map_chapters", "-1", "-threads", threads, mp4)
bitRate, _ := GetFileInfo.GetBitRate(in.FullPath)
slog.Debug("bitrate in h265", slog.String("bitrate", bitRate))

b := strings.Join([]string{bitRate, "k"}, "")
slog.Debug("获取的比特率", slog.String("bitrate", b))
cmd = exec.Command("ffmpeg", "-threads", threads, "-i", in.FullPath, "-c:v", "libx265", "-b:v", b, "-c:a", "aac", "-ac", "1", "-tag:v", "hvc1", "-map_chapters", "-1", "-threads", threads, mp4)

if bitRate == "" {
cmd = exec.Command("ffmpeg", "-threads", threads, "-i", in.FullPath, "-c:v", "libx265", "-c:a", "aac", "-ac", "1", "-tag:v", "hvc1", "-map_chapters", "-1", "-threads", threads, mp4)
}
if mi.VideoWidth > 1920 && mi.VideoHeight > 1920 {
slog.Warn("视频大于1080P需要使用其他程序先处理视频尺寸", slog.Any("原视频", in))
ResizeVideo(in, threads)
Expand Down

0 comments on commit de54cfe

Please sign in to comment.