jogramming / dca

Go implementation for the DCA audio format
BSD 3-Clause "New" or "Revised" License
75 stars 60 forks source link

Output becomes an empty file #3

Closed lon9 closed 6 years ago

lon9 commented 6 years ago

I wrote the code below, but the file size of output.dca is 0 byte. How do it work fine?

package main

import (
    "io"
    "os"

    "github.com/jonas747/dca"
)

func main() {
    opts := dca.StdEncodeOptions
    opts.RawOutput = true
    encodeSession, err := dca.EncodeFile("hello.wav", opts)
    if err != nil {
        panic(err)
    }
    defer encodeSession.Cleanup()

    output, err := os.Create("output.dca")
    if err != nil {
        panic(err)
    }

    io.Copy(output, encodeSession)
}

Environment

Mac OS X
ffmpeg 3.3.4
jogramming commented 6 years ago

Dump the output of encodeSession.FFMPEGMessages() after io.Copy finishes

lon9 commented 6 years ago
ffmpeg version 3.3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.2.0/include/openjpeg-2.2 --enable-nonfree --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Unrecognized option 'application'.
Error splitting the argument list: Option not found
jogramming commented 6 years ago

Your ffmpeg isn't compiled with libopus support, did you install ffmpeg through homebrew? if so you have to redo it with brew install ffmpeg --with-opus

lon9 commented 6 years ago

It worked, thank you.