Skip to content

Commit

Permalink
更新gomedia, 修复mp4合并bug
Browse files Browse the repository at this point in the history
  • Loading branch information
orestonce committed Jun 21, 2022
1 parent 4ee319a commit 1f6f8b8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## m3u8d 一款m3u8下载工具
* 提供windows图形界面(Qt), mac、linux命令行, linux支持arm和386
* 使用gomedia转换、合并ts格式为mp4
* windows自带GUI界面的版本下载: [m3u8d_qt_v1.4_windows_amd64.exe](https://github.com/orestonce/m3u8d/releases/download/v1.4/m3u8d_qt_v1.4_windows_amd64.exe):
* windows自带GUI界面的版本下载: [m3u8d_qt_v1.4.2_windows_amd64.exe](https://github.com/orestonce/m3u8d/releases/download/v1.4.2/m3u8d_qt_v1.4.2_windows_amd64.exe):
![](m3u8d-qt/screenshot.png)
* 全部版本下载, 包括windows图形界面/linux命令行/mac命令行: https://github.com/orestonce/m3u8d/releases

Expand All @@ -23,7 +23,7 @@
* [x] 充分测试后,使用 https://github.com/yapingcat/gomedia 代替ffmpeg进行格式转换
* [x] 支持嵌套m3u8的url
* [x] 支持设置代理
* [ ] 增加openwrt路由器的mipsle二进制
* [x] 增加openwrt路由器的mipsle二进制
* [ ] 支持从curl命令解析出需要的header、auth-basic、cookie等信息,正如 https://github.com/cxjava/m3u8-downloader 一样
## 二次开发操作手册:
* 如果只开发命令行版本, 则只需要修改*.go文件, 然后编译 cmd/main.go 即可
Expand Down
4 changes: 4 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
var rootCmd = cobra.Command{
Use: "m3u8下载工具",
Run: func(cmd *cobra.Command, args []string) {
if gRunReq.M3u8Url == "" {
cmd.Help()
return
}
m3u8d.SetShowProgressBar()
resp := m3u8d.RunDownload(gRunReq)
fmt.Println() // 有进度条,所以需要换行
Expand Down
4 changes: 2 additions & 2 deletions export/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func main() {
BuildCliBinary() // 编译二进制
//CreateLibForQtUi() // 创建Qt需要使用的.a库文件
CreateLibForQtUi() // 创建Qt需要使用的.a库文件
}

func BuildCliBinary() {
Expand Down Expand Up @@ -43,7 +43,7 @@ func BuildCliBinary() {
},
}
for _, cfg := range list {
name := "m3u8d_cli_v1.4.1_" + cfg.GOOS + "_" + cfg.GOARCH + cfg.Ext
name := "m3u8d_cli_v1.4.2_" + cfg.GOOS + "_" + cfg.GOARCH + cfg.Ext
cmd := exec.Command("go", "build", "-ldflags", "-s -w", "-o", filepath.Join(wd, "bin", name))
cmd.Dir = filepath.Join(wd, "cmd")
cmd.Env = append(os.Environ(), "GOOS="+cfg.GOOS)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/orestonce/go2cpp v0.0.0-20220605110533-c77a8dd7fdfd
github.com/orestonce/gopool v0.0.0-20220508090328-d7d56d45b171
github.com/spf13/cobra v1.4.0
github.com/yapingcat/gomedia v0.0.0-20220621113316-0cd64b0770ac
github.com/yapingcat/gomedia v0.0.0-20220621130152-95fa86fac794
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/yapingcat/gomedia v0.0.0-20220621113316-0cd64b0770ac h1:BIZyaWddLxEAJuegSdb+SUlestsy0gUP5AvdaP8ilzc=
github.com/yapingcat/gomedia v0.0.0-20220621113316-0cd64b0770ac/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
github.com/yapingcat/gomedia v0.0.0-20220621130152-95fa86fac794 h1:6LKuTqBiq0t7gdwYtWZf2Eq8eOQWcpaSxufybzqj3vo=
github.com/yapingcat/gomedia v0.0.0-20220621130152-95fa86fac794/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc=
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9 h1:Yqz/iviulwKwAREEeUd3nbBFn0XuyJqkoft2IlrvOhc=
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
11 changes: 9 additions & 2 deletions merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
}
defer mp4file.Close()

muxer := mp4.CreateMp4Muxer(mp4file)
muxer, err := mp4.CreateMp4Muxer(mp4file)
if err != nil {
return err
}
vtid := muxer.AddVideoTrack(mp4.MP4_CODEC_H264)
atid := muxer.AddAudioTrack(mp4.MP4_CODEC_AAC, 0, 16, 44100)

Expand Down Expand Up @@ -68,6 +71,10 @@ func MergeTsFileListToSingleMp4(req MergeTsFileListToSingleMp4_Req) (err error)
if err != nil {
return err
}
err = mp4file.Sync()
if err != nil {
return err
}
DrawProgressBar(1, 1)
return err
return nil
}

0 comments on commit 1f6f8b8

Please sign in to comment.