Mike-Dax / gatsby-transformer-ffmpeg

A Gatsby file transformer that transcodes videos with ffmpeg statically. Used on https://electricui.com
MIT License
9 stars 5 forks source link

No audio #15

Open maxcct opened 2 years ago

maxcct commented 2 years ago

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.

xshadowlegendx commented 2 years ago

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

xshadowlegendx commented 2 years ago

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?

maxcct commented 2 years ago

That makes sense – I did try using that flag, but couldn't find a param for it that worked

On Sun, 30 Jan 2022 at 13:19, xshadowlegendx @.***> wrote:

hello @maxcct https://github.com/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?

— Reply to this email directly, view it on GitHub https://github.com/Mike-Dax/gatsby-transformer-ffmpeg/issues/15#issuecomment-1025141917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEH54SIVHSXOUYXGOJ2KA3UYU3FVANCNFSM5MZBBPQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

ivyrze commented 1 year ago

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.