Documentation ¶
Overview ¶
Package remux provides a command for remuxing a mpegts to another container.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{ Name: "remux", Usage: "Remux a mpegts to another container.", ArgsUsage: "file", Flags: []cli.Flag{ &cli.StringFlag{ Name: "output-format", Value: "mp4", Usage: "Output format of the container.", Aliases: []string{"format", "f"}, Destination: &outputFormat, }, &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 { ctx := cCtx.Context file := cCtx.Args().Get(0) if file == "" { log.Error().Msg("arg[0] is empty") return errors.New("missing file path") } if _, err := os.Stat(file); err != nil { return err } fnameMuxed := prepareFile(file, strings.ToLower(outputFormat)) fnameAudio := prepareFile(file, "m4a") log.Info().Str("output", fnameMuxed).Str("input", file).Msg("remuxing stream...") if err := remux.Do(ctx, fnameMuxed, file); err != nil { log.Error(). Str("output", fnameMuxed). Str("input", file). Err(err). Msg("ffmpeg remux finished with error") } if extractAudio { log.Error().Str("output", fnameAudio).Str("input", file).Msg("extrating audio...") if err := remux.Do(ctx, fnameAudio, file, remux.WithAudioOnly()); err != nil { log.Error(). Str("output", fnameAudio). Str("input", file). Err(err). Msg("ffmpeg audio extract finished with error") } } return nil }, }
Command is the command for remuxing a mpegts to another container.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.