format

package
v0.0.0-...-0fe5c75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

README

creamy-transcode/format

Parse human-readable format strings into well-defined machine-readable objects.

Usage

package main

import (
	"encoding/json"
	"log"

	"github.com/AlbinoDrought/creamy-transcode/format"
)

func main() {
  // parse format
	parsed, err := format.Parse("mp4:hevc_720p_1500k")
	if err != nil {
		log.Fatal(err)
	}

  // convert to nicely-readable thing for dumping
	json, _ := json.MarshalIndent(parsed, "", "  ")
	log.Printf("%+v\n", string(json))
}

// output:
/*
{
  "Container": "mp4",
  "VideoSpecs": {
    "Disabled": false,
    "ResolutionHeight": 720,
    "ResolutionWidth": 1280,
    "BitrateKbps": 1500,
    "Codec": "hevc",
    "FPS": ""
  },
  "AudioSpecs": {
    "Disabled": false,
    "Codec": "aac",
    "BitrateKbps": 128,
    "SampleRateHz": 44100,
    "AudioChannel": "stereo"
  },
  "FormatOptions": {
    "TwoPass": false
  }
}
*/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioSpecs

type AudioSpecs struct {
	Disabled     bool
	Codec        string
	BitrateKbps  int
	SampleRateHz int
	AudioChannel string
}

type Format

type Format struct {
	Container     string
	VideoSpecs    VideoSpecs
	AudioSpecs    AudioSpecs
	FormatOptions FormatOptions
}

func Parse

func Parse(input string) (Format, error)

Parse a format string like "mp4:1080p" into a well-defined Format

type FormatOptions

type FormatOptions struct {
	TwoPass bool
}

type VideoSpecs

type VideoSpecs struct {
	Disabled         bool
	ResolutionHeight int
	ResolutionWidth  int
	BitrateKbps      int
	Codec            string
	FPS              string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL