Mike-Dax/gatsby-transformer-ffmpeg

No audio

Opened this issue · 4 comments

Hello, I've used the plugin per the examples provided, but the video is ending up with no audio. The sound icon is displayed but grayed out.

My query is as follows:

      updateVideo: file(relativePath: {eq: "update.mp4"}) {
        childVideoFfmpeg {
          webm: transcode(
            outputOptions: ["-crf 20", "-b:v 0"]
            maxWidth: 900
            maxHeight: 480
            fileExtension: "webm"
            codec: "libvpx-vp9"
          ) {
            width
            src
            presentationMaxWidth
            presentationMaxHeight
            originalName
            height
            fileExtension
            aspectRatio
          }
          mp4: transcode(
            maxWidth: 900
            maxHeight: 480
            fileExtension: "mp4"
            codec: "libx264"
          ) {
            width
            src
            presentationMaxWidth
            presentationMaxHeight
            originalName
            height
            fileExtension
            aspectRatio
          }
        }
      }

and I'm using the component like this:

      <Video
        controls
        poster={Poster}
        sources={[updateVideo.childVideoFfmpeg.webm, updateVideo.childVideoFfmpeg.mp4]}
      />

Any help greatly appreciated.

hello I also encounter this problem, I believe this is because there is -an option being used by default which you can see when turn on debug mode DEBUF_FFMPEG=true

hello @maxcct so I read the code, in order to have audio u would have to specify audioCodec or the library will append -an to ffmpeg, I guess this should have been written in the documentation?

I was able to get it working using audioCodec: libmp3lame — the full list of supported/encodable codecs on your system are at ffmpeg -codecs. You might also have to clear /.ffmpeg-cache to force it to re-transcode.