Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{ Name: "remux", Usage: "Remux a mpegts to mp4 or m4a.", ArgsUsage: "file", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "extract-audio", Value: false, Usage: "Generate an audio-only copy of the stream.", Aliases: []string{"x"}, Destination: &extractAudio, }, }, Action: func(cCtx *cli.Context) error { file := cCtx.Args().Get(0) if file == "" { logger.I.Error("arg[0] is empty?! Use --help for remux usage.") return errors.New("missing file path") } if _, err := os.Stat(file); err != nil { return err } fnameMuxed := prepareFile(file, "mp4") fnameAudio := prepareFile(file, "m4a") logger.I.Info( "remuxing stream...", zap.String("output", fnameMuxed), zap.String("input", file), ) if err := remux.Do(file, fnameMuxed, false); err != nil { logger.I.Error("ffmpeg remux finished with error", zap.Error(err)) } if extractAudio { logger.I.Info( "extrating audio...", zap.String("output", fnameAudio), zap.String("input", file), ) if err := remux.Do(file, fnameAudio, true); err != nil { logger.I.Error("ffmpeg audio extract finished with error", zap.Error(err)) } } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.