Skip to content

Transfer NV24 format Packet to Frame for encoding #102

Closed Answered by Tryanks
Tryanks asked this question in Q&A
Discussion options

You must be logged in to vote

Ah... converting through a rawvideo decoder:

package main

import (
    "errors"
    "fmt"

    "github.com/asticode/go-astiav"
)

type Rawvideo struct {
    decoder *astiav.Codec
    context *astiav.CodecContext
}

func NewRawvideo() (*Rawvideo, error) {
    r := &Rawvideo{}

    r.decoder = astiav.FindDecoder(astiav.CodecIDRawvideo)
    if r.decoder == nil {
        return nil, errors.New("could not find Rawvideo decoder")
    }

    r.context = astiav.AllocCodecContext(r.decoder)
    if r.context == nil {
        return nil, errors.New("unable to allocate context")
    }

    r.context.SetPixelFormat(astiav.PixelFormatNV12) // Anything
    r.context.SetWidth(1920)
    r.context.SetHeight(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@asticode
Comment options

Answer selected by Tryanks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants